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