Homepage Demos Overview Downloads Tutorials Reference
Credits
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Search

SaveWalkControl.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_SaveWalkControl_h
00002 #define INCLUDED_SaveWalkControl_h
00003 
00004 #include "ControlBase.h"
00005 #include "Motion/MotionManager.h"
00006 #include "Motion/WalkMC.h"
00007 #include <string>
00008 
00009 //! When activated, saves walk parameters to a file specified from cin
00010 class SaveWalkControl : public ControlBase {
00011  public:
00012   //! constructor, pass the MC_ID of the walk you want to save
00013   SaveWalkControl(const std::string& n, MotionManager::MC_ID w) : ControlBase(n), walk_id(w) {}
00014   //! destructor
00015   virtual ~SaveWalkControl() {}
00016 
00017   //! when called, prompts on cin for file to save into -- will overwrite this file
00018   virtual ControlBase * activate(MotionManager::MC_ID disp_id, Socket*) {
00019     if(disp_id!=MotionManager::invalid_MC_ID) {
00020       MMAccessor<LedMC> display(disp_id);
00021       display.mc()->cset(FaceLEDMask,.5);
00022     }
00023 
00024     char cur[33];
00025     std::cout << "#> " << std::flush;
00026     std::cin >> cur;
00027     std::cout << std::endl;
00028     if(strlen(cur)>0) {
00029       WalkMC* walk = (WalkMC*)motman->checkoutMotion(walk_id);
00030       walk->save(cur);
00031       motman->checkinMotion(walk_id);
00032     }
00033     return NULL;
00034   }
00035   //! does nothing
00036   virtual void deactivate() {}
00037 
00038  protected:
00039   MotionManager::MC_ID walk_id; //!< MC_ID of walk to save from
00040 };
00041 
00042 /*! @file
00043  * @brief Defines SaveWalkControl, which when activated, saves walk parameters to a file specified from cin
00044  * @author ejt (Creator)
00045  *
00046  * $Author: ejt $
00047  * $Name: tekkotsu-1_4_1 $
00048  * $Revision: 1.4 $
00049  * $State: Exp $
00050  * $Date: 2003/06/07 22:03:53 $
00051  */
00052 #endif

Tekkotsu v1.4
Generated Sat Jul 19 00:06:31 2003 by Doxygen 1.3.2