Go to the documentation of this file.
10 #include <dynamic-graph/factory.h>
28 calibrationStarted(false)
32 "sotForceCompensation(" +
name +
")::input(vector6)::torsorIN"),
33 worldRhandSIN(NULL,
"sotForceCompensation(" +
name +
34 ")::input(MatrixRotation)::worldRhand")
37 handRsensorSIN(NULL,
"sotForceCompensation(" +
name +
38 ")::input(MatrixRotation)::handRsensor"),
39 translationSensorComSIN(NULL,
"sotForceCompensation(" +
name +
40 ")::input(vector3)::sensorCom"),
42 "sotForceCompensation(" +
name +
")::input(vector6)::gravity"),
43 precompensationSIN(NULL,
"sotForceCompensation(" +
name +
44 ")::input(vector6)::precompensation"),
46 "sotForceCompensation(" +
name +
")::input(matrix6)::gain"),
47 deadZoneLimitSIN(NULL,
"sotForceCompensation(" +
name +
48 ")::input(vector6)::deadZoneLimit"),
49 transSensorJointSIN(NULL,
"sotForceCompensation(" +
name +
50 ")::input(vector6)::sensorJoint"),
51 inertiaJointSIN(NULL,
"sotForceCompensation(" +
name +
52 ")::input(matrix6)::inertiaJoint"),
54 NULL,
"sotForceCompensation(" +
name +
")::input(vector6)::velocity"),
55 accelerationSIN(NULL,
"sotForceCompensation(" +
name +
56 ")::input(vector6)::acceleration")
63 "sotForceCompensation(" +
name +
64 ")::output(MatrixForce)::handXworld"),
67 "sotForceCompensation(" +
name +
68 ")::output(MatrixForce)::handVsensor"),
69 torsorDeadZoneSIN(NULL,
"sotForceCompensation(" +
name +
70 ")::input(vector6)::torsorNullifiedIN")
77 "sotForceCompensation(" +
name +
78 ")::output(MatrixForce)::sensorXhand")
91 "sotForceCompensation(" +
name +
")::output(Vector6)::momentum"),
92 momentumSIN(NULL,
"sotForceCompensation(" +
name +
93 ")::input(vector6)::momentumIN")
96 torsorCompensatedSOUT(
103 "sotForceCompensation(" +
name +
")::output(Vector6)::torsor"),
108 "sotForceCompensation(" +
name +
109 ")::output(Vector6)::torsorNullified"),
110 calibrationTrigerSOUT(
113 torsorSIN << worldRhandSIN,
114 "sotForceCompensation(" +
name +
115 ")::output(Dummy)::calibrationTriger") {
342 sotDEBUG(25) <<
"wRrh = " << worldRhand << std::endl;
343 sotDEBUG(25) <<
"SC = " << transSensorCom << std::endl;
346 scRw.linear() = worldRhand.transpose();
347 scRw.translation() = transSensorCom;
348 sotDEBUG(25) <<
"scMw = " << scRw << std::endl;
352 Eigen::Vector3d _t = scRw.translation();
355 Tx << 0, -_t(2), _t(1), _t(2), 0, -_t(0), -_t(1), _t(0), 0;
359 res.block<3, 3>(0, 0) =
R;
361 res.block<3, 3>(3, 0) = sk;
362 res.block<3, 3>(3, 3) =
R;
375 for (
unsigned int i = 0;
i < 3; ++
i)
376 for (
unsigned int j = 0; j < 3; ++j) {
377 res(
i, j) = handRsensor(
i, j);
378 res(
i + 3, j + 3) = handRsensor(
i, j);
400 Tx << 0, -transJointSensor(2), transJointSensor(1), transJointSensor(2), 0,
401 -transJointSensor(0), -transJointSensor(1), transJointSensor(0), 0;
403 res.block<3, 3>(0, 0).setIdentity();
405 res.block<3, 3>(3, 0) = Tx;
406 res.block<3, 3>(3, 3).setIdentity();
444 sotDEBUG(25) <<
"t_nc = " << torqueInput;
447 torquePrecompensated = torqueInput + torquePrecompensation;
449 sotDEBUG(25) <<
"t_pre = " << torquePrecompensated;
452 torqueS = gainSensor * torquePrecompensated;
453 res = handVsensor * torqueS;
477 Eigen::Vector3d
v,
w,
f,
tau;
478 for (
unsigned int i = 0;
i < 3; ++
i) {
480 w(
i) = velocity(
i + 3);
482 tau(
i) = force(
i + 3);
484 Eigen::Vector3d res1(3), res2a(3), res2b(3);
487 res2b =
w.cross(
tau);
491 for (
unsigned int i = 0;
i < 3; ++
i) {
493 res(
i + 3) = res2a(
i);
506 Iacc = inertiaJoint * acceleration;
508 res = sensorXhand * Iacc;
511 Iv = inertiaJoint * velocity;
515 XvIv = sensorXhand * vIv;
527 if (torqueInput.size() > deadZone.size())
return res;
528 res.resize(torqueInput.size());
529 for (
int i = 0;
i < torqueInput.size(); ++
i) {
530 const double th = fabs(deadZone(
i));
531 if ((torqueInput(
i) < th) && (torqueInput(
i) > -th)) {
533 }
else if (torqueInput(
i) < 0)
534 res(
i) = torqueInput(
i) + th;
536 res(
i) = torqueInput(
i) - th;
dg::SignalTimeDependent< MatrixForce, sigtime_t > sensorXhandSOUT
dynamicgraph::Vector calibrateGravity(const MatrixRotation &handRsensor, bool precompensationCalibration=false, const MatrixRotation &hand0Rsensor=I3)
Eigen::Transform< double, 3, Eigen::Affine > SOT_CORE_EXPORT MatrixHomogeneous
static MatrixForce & computeHandVsensor(const MatrixRotation &sensorRhand, MatrixForce &res)
dg::SignalPtr< MatrixRotation, sigtime_t > worldRhandSIN
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > velocitySIN
virtual void plug(SignalBase< Time > *ref)
std::list< dynamicgraph::Vector > torsorList
std::list< MatrixRotation > rotationList
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > accelerationSIN
#define SOT_INIT_SIGNAL_2(sotFunction, sotArg1, sotArg1Type, sotArg2, sotArg2Type)
static dynamicgraph::Vector & computeMomentum(const dynamicgraph::Vector &velocity, const dynamicgraph::Vector &acceleration, const MatrixForce &sensorXhand, const dynamicgraph::Matrix &inertiaJoint, dynamicgraph::Vector &res)
static MatrixForce & computeHandXworld(const MatrixRotation &worldRhand, const dynamicgraph::Vector &transSensorCom, MatrixForce &res)
#define sotDEBUGOUT(level)
#define SOT_INIT_SIGNAL_4(sotFunction, sotArg1, sotArg1Type, sotArg2, sotArg2Type, sotArg3, sotArg3Type, sotArg4, sotArg4Type)
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > gravitySIN
#define sotDEBUGIN(level)
static MatrixForce & computeSensorXhand(const MatrixRotation &sensorRhand, const dynamicgraph::Vector &transSensorCom, MatrixForce &res)
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > deadZoneLimitSIN
dg::SignalTimeDependent< dynamicgraph::Vector, sigtime_t > torsorCompensatedSOUT
dg::SignalTimeDependent< MatrixForce, sigtime_t > handVsensorSOUT
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > momentumSIN
static dynamicgraph::Vector & computeTorsorCompensated(const dynamicgraph::Vector &torqueInput, const dynamicgraph::Vector &torquePrecompensation, const dynamicgraph::Vector &gravity, const MatrixForce &handXworld, const MatrixForce &handVsensor, const dynamicgraph::Matrix &gainSensor, const dynamicgraph::Vector &momentum, dynamicgraph::Vector &res)
void setZero(std::vector< MatType, Eigen::aligned_allocator< MatType > > &Ms)
#define SOT_INIT_SIGNAL_1(sotFunction, sotArg1, sotArg1Type)
static dynamicgraph::Vector & crossProduct_V_F(const dynamicgraph::Vector &velocity, const dynamicgraph::Vector &force, dynamicgraph::Vector &res)
dg::SignalTimeDependent< MatrixForce, sigtime_t > handXworldSOUT
void clearCalibration(void)
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > precompensationSIN
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > torsorDeadZoneSIN
sotDummyType & calibrationTriger(sotDummyType &dummy, sigtime_t time)
dg::SignalTimeDependent< dynamicgraph::Vector, sigtime_t > torsorDeadZoneSOUT
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > transSensorJointSIN
dg::SignalPtr< MatrixRotation, sigtime_t > handRsensorSIN
dg::SignalPtr< dynamicgraph::Matrix, sigtime_t > inertiaJointSIN
void signalRegistration(const SignalArray< int > &signals)
Eigen::Matrix< double, 3, 3 > SOT_CORE_EXPORT MatrixRotation
Eigen::Matrix< double, 6, 6 > SOT_CORE_EXPORT MatrixForce
virtual ~ForceCompensationPlugin(void)
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > translationSensorComSIN
void addCalibrationValue(const dynamicgraph::Vector &torsor, const MatrixRotation &worldRhand)
#define SOT_INIT_SIGNAL_7(sotFunction, sotArg1, sotArg1Type, sotArg2, sotArg2Type, sotArg3, sotArg3Type, sotArg4, sotArg4Type, sotArg5, sotArg5Type, sotArg6, sotArg6Type, sotArg7, sotArg7Type)
dg::SignalTimeDependent< sotDummyType, sigtime_t > calibrationTrigerSOUT
dg::SignalPtr< dynamicgraph::Matrix, sigtime_t > gainSensorSIN
ForceCompensationPlugin(const std::string &name)
dg::SignalTimeDependent< dynamicgraph::Vector, sigtime_t > momentumSOUT
static dynamicgraph::Vector & computeDeadZone(const dynamicgraph::Vector &torqueInput, const dynamicgraph::Vector &deadZoneLimit, dynamicgraph::Vector &res)
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > torsorSIN
dynamicgraph::Vector calibrateTransSensorCom(const dynamicgraph::Vector &gravity, const MatrixRotation &handRsensor)
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(DoubleConstant, "DoubleConstant")