Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

PIDNode.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_PIDNode_h_
00002 #define INCLUDED_PIDNode_h_
00003 
00004 #include "MCNode.h"
00005 #include "Motion/PIDMC.h"
00006 
00007 //! Default name for PIDNodes (have to instantiate a variable in order to use as a template argument)
00008 /*! instantiation will be placed in MCNode.cc (instead of PITNode.cc) to avoid file bloat */
00009 extern const char defPIDNodeName[];
00010 
00011 //!default description for PIDNode (have to instantiate a variable in order to use as a template argument)
00012 /*! instantiation will be placed in MCNode.cc (instead of PIDNode.cc) to avoid file bloat */
00013 extern const char defPIDNodeDesc[];
00014 
00015 //! A simple StateNode that executes a PIDMC motion command
00016 class PIDNode : public MCNode<PIDMC,defPIDNodeName,defPIDNodeDesc,true> {
00017  public:
00018   //! constructor, take an instance name
00019   PIDNode(const std::string& nm) : MCNode<PIDMC,defPIDNodeName,defPIDNodeDesc,true>(nm),
00020                                    low(0), high(0), powerlevel(0), weight(0) {}
00021 
00022   //! constructor, take PIDMC arguments; note that @high should be one past the last joint to modify
00023   PIDNode(const std::string& nm, unsigned int _low, unsigned int _high, float _powerlevel, float _weight=1) :
00024     MCNode<PIDMC,defPIDNodeName,defPIDNodeDesc,true>(nm),
00025     low(_low), high(_high), powerlevel(_powerlevel), weight(_weight) {}
00026 
00027   virtual void preStart() {
00028     MCNode<PIDMC,defPIDNodeName,defPIDNodeDesc,true>::preStart();
00029     getMC()->setRangePowerLevel(PIDJointOffset, low, 0.f, 0.f);
00030     getMC()->setRangePowerLevel(low, high, powerlevel, weight);
00031     getMC()->setRangePowerLevel(high, PIDJointOffset+NumPIDJoints, 0.f, 0.f);
00032   }
00033 
00034 private:
00035   unsigned int low;
00036   unsigned int high;
00037   float powerlevel;
00038   float weight;
00039 
00040 };
00041 
00042 #endif

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:46 2016 by Doxygen 1.6.3