Klamp't  0.9.0
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 
8 namespace Klampt {
9  using namespace std;
10  using namespace Math;
11 
18 {
19  enum { OFF, TORQUE, PID, LOCKED_VELOCITY };
20 
22  void SetOff();
23  void SetPID(Real qdes,Real dqdes=Zero,Real iterm=Zero);
24  void SetTorque(Real t);
25  void SetLockedVelocity(Real vel,Real torqueMax);
26  Real GetPIDTorque(Real q,Real dq) const;
27  void IntegratePID(Real q,Real dt);
28 
29  //setup
30  int mode;
31  bool revolute,measureAngleAbsolute;
32  Real qmin,qmax;
33  Real kP,kI,kD;
34  //desired position and velocity
35  Real qdes,dqdes;
36  //internal state: integral term
37  Real iterm;
38  Real torque; //torque command, feedforward PID torque, or torque limit
39  Real desiredVelocity; //for locked velocity mode
40 };
41 
46 {
47  void SetTorque(const Vector& torques);
48  Real GetTorque(int i,double q,double dq);
49  void Clear();
50  void ResetPIDIntegrals();
51  bool Read(File& f);
52  bool Write(File& f) const;
53 
54  vector<ActuatorCommand> actuators;
55 };
56 
57 } // namespace Klampt
58 
59 #endif
A collection of basic motor types.
Definition: Command.h:45
A basic motor type. Handles PID, torque, and locked velocity modes.
Definition: Command.h:17
Definition: ContactDistance.h:6