Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
CameraBehavior.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_CameraBehavior_h_ 00003 #define INCLUDED_CameraBehavior_h_ 00004 00005 #include "Behaviors/BehaviorBase.h" 00006 #include "Motion/MotionManager.h" 00007 00008 //! Will take images and write to log file 00009 /*! Press the head button to take a picture, back button to write to memory 00010 * stick. The leds will flash when finished writing. 00011 * 00012 * The reason for this is to provide sample code for accessing vision 00013 * data, and also simply because we should have a way to save 00014 * pictures to memstick instead of relying solely on having wireless 00015 * to transmit them over. 00016 * 00017 * Image format is chosen by current config settings for the 00018 * Config::vision_config::rawcam_compression and 00019 * Config::vision_config::rawcam_channel. However, the double 00020 * resolution layer is always saved instead of whatever the current 00021 * config skip value indicates. 00022 */ 00023 class CameraBehavior : public BehaviorBase { 00024 public: 00025 //! constructor, just sets up the variables 00026 CameraBehavior() 00027 : BehaviorBase("CameraBehavior"), camera_click(EventBase::buttonEGID,0,EventBase::deactivateETID,150), index(0), ledID(MotionManager::invalid_MC_ID) 00028 {} 00029 00030 //! Register for events 00031 virtual void DoStart(); 00032 00033 //! Removes its two motion commands 00034 virtual void DoStop(); 00035 00036 //! Handles event processing - determines which generator to save from and writes to current file 00037 virtual void processEvent(const EventBase& e); 00038 00039 static std::string getClassDescription() { return "Push head button to save a picture"; } 00040 virtual std::string getDescription() const { return getClassDescription(); } 00041 00042 protected: 00043 //! opens the next file to be saved to (with @a ext extension on the file name) 00044 FILE * openNextFile(const std::string& ext); 00045 00046 //! returns the path and name of the next file to be saved to (with @a ext extension on the file name) 00047 std::string getNextName(const std::string& ext); 00048 00049 //! scans the /ms/data directory for image files and assigns the next unused index to #index 00050 void initIndex(); 00051 00052 EventBase camera_click; //!< event mask for taking a picture (head button) 00053 unsigned int index; //!< the index to use for the next image saved 00054 00055 MotionManager::MC_ID ledID; //!< the id of the LedMC used to signal completion 00056 }; 00057 00058 /*! @file 00059 * @brief Describes CameraBehavior, for taking pictures 00060 * @author alokl (Creator) 00061 * @author ejt (rewrite for new vision system) 00062 * 00063 * $Author: ejt $ 00064 * $Name: tekkotsu-2_4_1 $ 00065 * $Revision: 1.8 $ 00066 * $State: Exp $ 00067 * $Date: 2004/11/11 01:45:35 $ 00068 */ 00069 00070 #endif |
Tekkotsu v2.4.1 |
Generated Tue Aug 16 16:32:46 2005 by Doxygen 1.4.4 |