forked from krishauser/Klampt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeedforwardController.h
More file actions
executable file
·57 lines (49 loc) · 1.91 KB
/
FeedforwardController.h
File metadata and controls
executable file
·57 lines (49 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef FEEDFORWARD_CONTROLLER_H
#define FEEDFORWARD_CONTROLLER_H
#include "Controller.h"
#include "StateEstimator.h"
#include <KrisLibrary/robotics/Wrench.h>
#include <KrisLibrary/utils/SmartPointer.h>
/** @ingroup Control
* @brief A class that adds a feedforward torque to the basic
* control. The necessary feedforward torque is estimated assuming the
* robot is fixed-base.
*
* Settings:
* - enableGravityCompensation (boolean, default true): true if gravity
* compensation should be turned on.
* - enableFeedforwardAcceleration (boolean, default true): true if feedforward
* estimation of the inertial and coriolis terms, based on the finite
* differencing of the sensed velocity, should be turned on.
* - gravity (Vector3, default (0,0,-9.8)) the gravity vector estimate for
* gravity compensation.
*/
class FeedforwardController : public RobotController
{
public:
FeedforwardController(Robot& robot,SmartPointer<RobotController> base=NULL);
virtual ~FeedforwardController() {}
virtual const char* Type() const { return "FeedforwardController"; }
virtual void Update(Real dt);
virtual void Reset();
virtual bool ReadState(File& f);
virtual bool WriteState(File& f) const;
//getters/setters
virtual map<string,string> Settings() const;
virtual bool GetSetting(const string& name,string& str) const;
virtual bool SetSetting(const string& name,const string& str);
//commands
void ZeroForces();
void AddForce(int link,const Vector3& f,const Vector3& worldpt);
virtual vector<string> Commands() const;
virtual bool SendCommand(const string& name,const string& str);
//helpers
void SolveTorques(Vector& torques,Real dt);
SmartPointer<RobotController> base;
SmartPointer<RobotStateEstimator> stateEstimator;
bool enableGravityCompensation,enableFeedforwardAcceleration;
Vector3 gravity;
//external forces and moments about the link origin
vector<Wrench> wrenches;
};
#endif