| Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
WaypointWalkMC.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_WaypointWalk_h_ 00003 #define INCLUDED_WaypointWalk_h_ 00004 00005 #include "IPC/ListMemBuf.h" 00006 #include "WaypointEngine.h" 00007 #include "WalkMC.h" 00008 00009 //! Combines a WaypointEngine with a WalkMC so you can walk between a set of waypoints 00010 /*! Note the use of a template so we can have dedicate more or less 00011 * space without modifying the class. 00012 * 00013 * But for everyday use, you can just use the ::WaypointWalkMC typedef 00014 * which will default to a maximum of 100 waypoints */ 00015 class WaypointWalkMC : public WalkMC, public WaypointEngine { 00016 public: 00017 00018 //!constructor 00019 WaypointWalkMC() 00020 : WalkMC(), WaypointEngine() 00021 {} 00022 00023 //!constructor 00024 WaypointWalkMC(char * f) 00025 : WalkMC(), WaypointEngine(f) 00026 {} 00027 00028 //! so we can get our hooks in to modify the target velocity 00029 virtual int updateOutputs() { 00030 //std::cout << "WaypointWalkMC::updateOutputs() " << WaypointEngine::curVel[0] << " " << WaypointEngine::curVel[1] << " " << WaypointEngine::curVel[2] << " isRunning=" << isRunning << " dirty=" << dirty << std::endl; 00031 #ifdef TGT_HAS_WHEELEDWALK 00032 dirty = true; // necessary so the null case with no waypoints still generates a LocomotionEvent 00033 #endif 00034 if ( WaypointEngine::cycle() ) 00035 WalkMC::setTargetVelocity(WaypointEngine::curVel[0],WaypointEngine::curVel[1],WaypointEngine::curVel[2]); 00036 //cout << get_time()-waypointTime << " Cur: ("<<curPos[0]<<','<<curPos[1]<<','<<curPos[2]<<") Ideal: ("<<idealPos[0]<<','<<idealPos[1]<<','<<idealPos[2]<<','<<idealPos[3]<<") Vel: ("<<curVel[0]<<','<<curVel[1]<<','<<curVel[2]<<")" << endl; 00037 return WalkMC::updateOutputs(); 00038 } 00039 00040 virtual int LoadWaypointFile(const char * f) { return WaypointEngine::loadFile(f); } //!< allows loading a waypoint file 00041 virtual int SaveWaypointFile(const char * f) const { return WaypointEngine::saveFile(f); } //!< allows saving a waypoint file 00042 virtual int LoadWalkMCFile(const char * f) { return WalkMC::loadFile(f); } //!< allows loading a WalkMC parameter file 00043 virtual int SaveWalkMCFile(const char * f) const { return WalkMC::saveFile(f); } //!< allows saving a WalkMC parameter file 00044 00045 }; 00046 00047 /*! @file 00048 * @brief Defines WaypointWalk, which combines a WaypointEngine with a WalkMC so you can walk between a set of waypoints 00049 * @author ejt (Creator) 00050 */ 00051 00052 #endif |
|
Tekkotsu v5.1CVS |
Generated Fri Mar 16 05:26:54 2012 by Doxygen 1.6.3 |