Klamp't  0.8.1
Command.h
1 #ifndef CONTROL_MOTOR_COMMAND_H
2 #define CONTROL_MOTOR_COMMAND_H
3 
4 #include <vector>
5 #include <KrisLibrary/math/vector.h>
6 #include <KrisLibrary/math/math.h>
7 using namespace std;
8 using namespace Math;
9 
16 {
17  enum { OFF, TORQUE, PID, LOCKED_VELOCITY };
18 
20  void SetOff();
21  void SetPID(Real qdes,Real dqdes=Zero,Real iterm=Zero);
22  void SetTorque(Real t);
23  void SetLockedVelocity(Real vel,Real torqueMax);
24  Real GetPIDTorque(Real q,Real dq) const;
25  void IntegratePID(Real q,Real dt);
26 
27  //setup
28  int mode;
29  bool measureAngleAbsolute;
30  Real qmin,qmax;
31  Real kP,kI,kD;
32  //desired position and velocity
33  Real qdes,dqdes;
34  //internal state: integral term
35  Real iterm;
36  Real torque; //torque command, feedforward PID torque, or torque limit
37  Real desiredVelocity; //for locked velocity mode
38 };
39 
44 {
45  void SetTorque(const Vector& torques);
46  Real GetTorque(int i,double q,double dq);
47  void Clear();
48  void ResetPIDIntegrals();
49  bool Read(File& f);
50  bool Write(File& f) const;
51 
52  vector<ActuatorCommand> actuators;
53 };
54 
55 #endif
A collection of basic motor types.
Definition: Command.h:43
A basic motor type. Handles PID, torque, and locked velocity modes.
Definition: Command.h:15