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
00008
00009 extern const char defPIDNodeName[];
00010
00011
00012
00013 extern const char defPIDNodeDesc[];
00014
00015
00016 class PIDNode : public MCNode<PIDMC,defPIDNodeName,defPIDNodeDesc,true> {
00017 public:
00018
00019 PIDNode(const std::string& nm) : MCNode<PIDMC,defPIDNodeName,defPIDNodeDesc,true>(nm),
00020 low(0), high(0), powerlevel(0), weight(0) {}
00021
00022
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