Klamp't  0.8.1
OperationalSpaceController.h
1 #ifndef OPERATIONAL_SPACE_CONTROLLER_H
2 #define OPERATIONAL_SPACE_CONTROLLER_H
3 
4 #include "Controller.h"
5 #include <Klampt/Sensing/StateEstimator.h>
6 #include <KrisLibrary/robotics/IK.h>
7 #include <KrisLibrary/robotics/Contact.h>
8 #include <KrisLibrary/utils/SmartPointer.h>
9 
10 //task is q''[indices] = ddqdes
12 {
13  vector<int> indices;
14  Vector ddqdes;
15  Real weight;
16 };
17 
18 //task is x''[indices] = ddxdes
19 //position terms go first like in IKFunctions
21 {
22  IKGoal workspace;
23  Vector ddxdes;
24  Real weight;
25 };
26 
27 //task is (R*cm'')[1:numAxes] = ddxdes
29 {
30  Matrix3 R;
31  int numAxes;
32  Vector ddxdes;
33  Real weight;
34 };
35 
36 //task is T[indices] = Tdes
37 struct TorqueTask
38 {
39  vector<int> indices;
40  Vector Tdes;
41  Real weight;
42 };
43 
44 //Task is Af = fdes
45 //contacts point into the robot and are given the LOCAL frame
47 {
48  vector<int> links;
49  vector<ContactPoint> contacts;
50  Matrix A;
51  Vector fdes;
52  Real weight,penetrationWeight;
53 };
54 
91 {
93 
94  virtual const char* Type() const { return "OperationalSpaceController"; }
95  virtual void Update(Real dt);
96  virtual void Reset();
97  /*
98  virtual bool ReadState(File& f) {
99  if(!ReadFile(f,time)) return false;
100  return true;
101  }
102  virtual bool WriteState(File& f) const {
103  if(!WriteFile(f,time)) return false;
104  return true;
105  }
106  */
107 
108  //the bulk of the work is done here
109  void TasksToTorques(Vector& t);
110  bool IsValid() const;
111 
112  SmartPointer<IntegratedStateEstimator> stateEstimator;
113  Vector3 gravity;
114  vector<JointAccelTask> jointTasks;
115  vector<WorkspaceAccelTask> workspaceTasks;
116  vector<COMAccelTask> comTasks;
117  vector<TorqueTask> torqueTasks;
118  vector<ContactForceTask> contactForceTasks;
119 };
120 
121 #endif
The main robot type used in RobotSim.
Definition: Robot.h:79
Definition: OperationalSpaceController.h:28
Definition: OperationalSpaceController.h:11
Definition: OperationalSpaceController.h:37
Definition: OperationalSpaceController.h:20
A combination of multiple "tasks" that define a weighted optimization objective for the joint torques...
Definition: OperationalSpaceController.h:90
A base class for a robot controller. The base class does nothing.
Definition: Controller.h:27
Definition: OperationalSpaceController.h:46