Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

LoadWalkControl.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_LoadWalkControl_h
00003 #define INCLUDED_LoadWalkControl_h
00004 
00005 #include "FileBrowserControl.h"
00006 #include "Motion/WalkMC.h"
00007 #include "Shared/Config.h"
00008 #include <string>
00009 
00010 //! When activated, loads a set of walk parameters from a file specified by user
00011 class LoadWalkControl : public FileBrowserControl {
00012 public:
00013   //! constructor, pass the MC_ID of the WalkMC which you want to save
00014   LoadWalkControl(const std::string& n, MotionManager::MC_ID w)
00015     : FileBrowserControl(n,"Loads a set of walk parameters from a file specified by user",config->portPath(config->motion.root)), walk_id(w), thewalk(NULL)
00016   {
00017     setFilter("*.prm");
00018   }
00019 
00020   //! constructor, pass a pointer to the WalkMC which you want to save
00021   LoadWalkControl(const std::string& n, WalkMC * awalk)
00022     : FileBrowserControl(n,"Loads a set of walk parameters from a file specified by user",config->portPath(config->motion.root)), walk_id(MotionManager::invalid_MC_ID), thewalk(awalk)
00023   {
00024     setFilter("*.prm");
00025   }
00026 
00027   //! destructor
00028   virtual ~LoadWalkControl() {}
00029 
00030 protected:
00031   //!does the actual loading of the MotionSequence
00032   virtual ControlBase* selectedFile(const std::string& f) {
00033     MotionManager::MC_ID id = thewalk==NULL?walk_id:thewalk->getID();
00034     WalkMC* walk=thewalk;
00035     if(id!=MotionManager::invalid_MC_ID)
00036       walk = (WalkMC*)motman->checkoutMotion(id);
00037     if(walk==NULL)
00038       serr->printf("Invalid walk for loading\n");
00039     else {
00040       walk->LoadFile(f.c_str());
00041       motman->checkinMotion(id);
00042     }
00043     return NULL;
00044   }
00045 
00046   MotionManager::MC_ID walk_id; //!< the MC_ID of the walk to load into
00047   WalkMC * thewalk; //!< the walk to load into (if NULL, check walk_id)
00048 
00049 private:
00050   LoadWalkControl(const LoadWalkControl&); //!< don't call
00051   LoadWalkControl operator=(const LoadWalkControl&); //!< don't call
00052 };
00053 
00054 /*! @file
00055  * @brief Defines LoadWalkControl, which when activated, loads a set of walk parameters from a file read from cin.
00056  * @author ejt (Creator)
00057  *
00058  * $Author: ejt $
00059  * $Name: tekkotsu-2_4_1 $
00060  * $Revision: 1.9 $
00061  * $State: Exp $
00062  * $Date: 2005/06/06 23:05:51 $
00063  */
00064 
00065 #endif

Tekkotsu v2.4.1
Generated Tue Aug 16 16:32:47 2005 by Doxygen 1.4.4