Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

CameraBehavior Class Reference

Will take images and write to log file. More...

#include <CameraBehavior.h>

Inheritance diagram for CameraBehavior:

Detailed Description

Will take images and write to log file.

Press the head button to take a picture, back button to write to memory stick. The leds will flash when finished writing.

The reason for this is to provide sample code for accessing vision data, and also simply because we should have a way to save pictures to memstick instead of relying solely on having wireless to transmit them over.

Image format is chosen by current config settings for the Config::vision_config::RawCamConfig::compression and Config::vision_config::RawCamConfig::channel. However, the double resolution layer is always saved instead of whatever the current config skip value indicates.

Definition at line 24 of file CameraBehavior.h.

List of all members.

Public Member Functions

 CameraBehavior ()
 constructor, just sets up the variables
virtual void doStart ()
 Register for events.
virtual void doStop ()
 Removes its two motion commands.
virtual void doEvent ()
 Handles event processing - determines which generator to save from and writes to current file.
virtual std::string getDescription () const
 Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis).

Static Public Member Functions

static std::string getClassDescription ()
 Gives a short description of what this class of behaviors does... you should override this (but don't have to).

Protected Member Functions

FILE * openNextFile (const std::string &ext)
 opens the next file to be saved to (with ext extension on the file name)
std::string getNextName (const std::string &ext)
 returns the path and name of the next file to be saved to (with ext extension on the file name)
void initIndex ()
 scans the /ms/data directory for image files and assigns the next unused index to index

Protected Attributes

EventBase camera_click
 event mask for taking a picture (head button)
unsigned int index
 the index to use for the next image saved
MotionManager::MC_ID ledID
 the id of the LedMC used to signal completion

Constructor & Destructor Documentation

CameraBehavior::CameraBehavior (  ) 

constructor, just sets up the variables

Definition at line 27 of file CameraBehavior.h.


Member Function Documentation

void CameraBehavior::doEvent (  )  [virtual]

Handles event processing - determines which generator to save from and writes to current file.

The format used depends on the current config settings. If JPEG is the current choice, then a JPEG file will be written. Otherwise, RawCameraGenerator::saveFile() will be called.

write actual image data

write actual image data

write actual image data

Reimplemented from BehaviorBase.

Definition at line 59 of file CameraBehavior.cc.

void CameraBehavior::doStart (  )  [virtual]

Register for events.

Reimplemented from BehaviorBase.

Definition at line 32 of file CameraBehavior.cc.

void CameraBehavior::doStop (  )  [virtual]

Removes its two motion commands.

Reimplemented from BehaviorBase.

Definition at line 46 of file CameraBehavior.cc.

static std::string CameraBehavior::getClassDescription (  )  [static]

Gives a short description of what this class of behaviors does... you should override this (but don't have to).

If you do override this, also consider overriding getDescription() to return it

Reimplemented from BehaviorBase.

Definition at line 40 of file CameraBehavior.h.

Referenced by getDescription().

virtual std::string CameraBehavior::getDescription (  )  const [virtual]

Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis).

By default simply returns getName(), because any calls from a BehaviorBase function to getClassDescription() are going to call BehaviorBase::getClassDescription(), not ~YourSubClass~getClassDescription(), because static functions can't be virtual in C++ (doh!)

This means that getDescription called on a pointer to a BehaviorBase of unknown subtype would always return an empty string, which is pretty useless. So instead we return the name in this situation. If you want getDescription to return getClassDescription, you'll have to override it in your subclass to do so.

Reimplemented from BehaviorBase.

Definition at line 41 of file CameraBehavior.h.

std::string CameraBehavior::getNextName ( const std::string &  ext  )  [protected]

returns the path and name of the next file to be saved to (with ext extension on the file name)

Definition at line 213 of file CameraBehavior.cc.

Referenced by openNextFile().

void CameraBehavior::initIndex (  )  [protected]

scans the /ms/data directory for image files and assigns the next unused index to index

Definition at line 222 of file CameraBehavior.cc.

Referenced by doStart().

FILE * CameraBehavior::openNextFile ( const std::string &  ext  )  [protected]

opens the next file to be saved to (with ext extension on the file name)

Definition at line 200 of file CameraBehavior.cc.

Referenced by doEvent().


Member Data Documentation

event mask for taking a picture (head button)

Definition at line 53 of file CameraBehavior.h.

Referenced by doEvent(), and doStart().

unsigned int CameraBehavior::index [protected]

the index to use for the next image saved

Definition at line 54 of file CameraBehavior.h.

Referenced by getNextName(), and initIndex().

the id of the LedMC used to signal completion

Definition at line 56 of file CameraBehavior.h.

Referenced by doEvent(), doStart(), and doStop().


The documentation for this class was generated from the following files:

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:05 2016 by Doxygen 1.6.3