00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00026 #ifndef JSPACE_CONTROLLER_LIBRARY_HPP
00027 #define JSPACE_CONTROLLER_LIBRARY_HPP
00028
00029 #include <jspace/Controller.hpp>
00030 #include <string>
00031
00032
00033 namespace jspace {
00034
00035
00036 typedef enum {
00037 COMP_NONE = 0x00,
00038 COMP_GRAVITY = 0x01,
00039 COMP_CORIOLIS = 0x02,
00040 COMP_MASS_INERTIA = 0x04
00041 } compensation_flags_t;
00042
00043
00044 class FloatController
00045 : public Controller
00046 {
00047 public:
00048 virtual Status setGoal(Vector const & goal);
00049 virtual Status getGoal(Vector & goal) const;
00050 virtual Status getActual(Vector & actual) const;
00051
00052 virtual Status setGains(Vector const & kp, Vector const & kd);
00053 virtual Status getGains(Vector & kp, Vector & kd) const;
00054
00055 virtual Status latch(Model const & model);
00056 virtual Status computeCommand(Model const & model, Vector & tau);
00057 };
00058
00059
00060 class GoalControllerBase
00061 : public Controller
00062 {
00063 public:
00064 GoalControllerBase(int compensation_flags,
00065 Vector const & default_kp,
00066 Vector const & default_kd);
00067
00068 virtual Status init(Model const & model);
00069
00070 virtual Status setGoal(Vector const & goal);
00071 virtual Status getGoal(Vector & goal) const;
00072
00073 virtual Status setGains(Vector const & kp, Vector const & kd);
00074 virtual Status getGains(Vector & kp, Vector & kd) const;
00075
00076 protected:
00077 int compensation_flags_;
00078 Vector default_kp_;
00079 Vector default_kd_;
00080 Vector goal_;
00081 Vector kp_;
00082 Vector kd_;
00083 };
00084
00085
00086 class JointGoalController
00087 : public GoalControllerBase
00088 {
00089 public:
00090 JointGoalController(int compensation_flags,
00091 Vector const & default_kp,
00092 Vector const & default_kd);
00093
00094 virtual Status getActual(Vector & actual) const;
00095 virtual Status latch(Model const & model);
00096 virtual Status computeCommand(Model const & model, Vector & tau);
00097
00098 protected:
00099 Vector actual_;
00100 };
00101
00102 }
00103
00104 #endif // JSPACE_CONTROLLER_LIBRARY_HPP