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 "WalkMC.h" 00007 #include "WaypointEngine.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 template<unsigned int MAX_WAY> 00016 class WaypointWalk : public WalkMC, public WaypointEngine<MAX_WAY> { 00017 public: 00018 static const unsigned int MAX_WAYPOINTS=MAX_WAY; //!< for external access to maximum waypoints 00019 00020 //!constructor 00021 WaypointWalk() 00022 : WalkMC(), WaypointEngine<MAX_WAYPOINTS>() 00023 {} 00024 00025 //!constructor 00026 WaypointWalk(char * f) 00027 : WalkMC(), WaypointEngine<MAX_WAYPOINTS>(f) 00028 {} 00029 00030 //! so we can get our hooks in to modify the target velocity 00031 virtual int updateOutputs() { 00032 WaypointEngine<MAX_WAY>::cycle(); 00033 WalkMC::setTargetVelocity(WaypointEngine<MAX_WAY>::curVel[0]*1000,WaypointEngine<MAX_WAY>::curVel[1]*1000,WaypointEngine<MAX_WAY>::curVel[2]); 00034 //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; 00035 return WalkMC::updateOutputs(); 00036 } 00037 00038 virtual int LoadWaypointFile(const char * f) { return WaypointEngine<MAX_WAYPOINTS>::loadFile(f); } //!< allows loading a waypoint file 00039 virtual int SaveWaypointFile(const char * f) const { return WaypointEngine<MAX_WAYPOINTS>::saveFile(f); } //!< allows saving a waypoint file 00040 virtual int LoadWalkMCFile(const char * f) { return WalkMC::loadFile(f); } //!< allows loading a WalkMC parameter file 00041 virtual int SaveWalkMCFile(const char * f) const { return WalkMC::saveFile(f); } //!< allows saving a WalkMC parameter file 00042 00043 }; 00044 00045 typedef WaypointWalk<100> WaypointWalkMC; //!< unless you need more/less waypoints, just use this type 00046 00047 00048 /*! @file 00049 * @brief Defines WaypointWalk, which combines a WaypointEngine with a WalkMC so you can walk between a set of waypoints 00050 * @author ejt (Creator) 00051 * 00052 * $Author: ejt $ 00053 * $Name: tekkotsu-4_0 $ 00054 * $Revision: 1.5 $ 00055 * $State: Exp $ 00056 * $Date: 2006/09/09 04:32:58 $ 00057 */ 00058 00059 #endif |
Tekkotsu v4.0 |
Generated Thu Nov 22 00:54:56 2007 by Doxygen 1.5.4 |