Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sot-dynamic-pinocchio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
sot-dynamic-pinocchio
Commits
184bea08
Commit
184bea08
authored
14 years ago
by
Nicolas Mansard
Browse files
Options
Downloads
Patches
Plain Diff
Remove warnings.
parent
c66faf4d
No related branches found
No related tags found
1 merge request
!1
[major][cpp] starting point to integrate pinocchio
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/force-compensation.cpp
+66
-67
66 additions, 67 deletions
src/force-compensation.cpp
with
66 additions
and
67 deletions
src/force-compensation.cpp
+
66
−
67
View file @
184bea08
...
@@ -37,22 +37,22 @@ ForceCompensation(void)
...
@@ -37,22 +37,22 @@ ForceCompensation(void)
ForceCompensationPlugin
::
ForceCompensationPlugin
::
ForceCompensationPlugin
(
const
std
::
string
&
name
)
ForceCompensationPlugin
(
const
std
::
string
&
name
)
:
Entity
(
name
)
:
Entity
(
name
)
,
calibrationStarted
(
false
)
,
calibrationStarted
(
false
)
,
torsorSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::torsorIN"
)
,
torsorSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::torsorIN"
)
,
worldRhandSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(MatrixRotation)::worldRhand"
)
,
worldRhandSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(MatrixRotation)::worldRhand"
)
,
handRsensorSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(MatrixRotation)::handRsensor"
)
,
handRsensorSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(MatrixRotation)::handRsensor"
)
,
translationSensorComSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector3)::sensorCom"
)
,
translationSensorComSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector3)::sensorCom"
)
,
gravitySIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::gravity"
)
,
gravitySIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::gravity"
)
,
precompensationSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::precompensation"
)
,
precompensationSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::precompensation"
)
,
gainSensorSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(matrix6)::gain"
)
,
gainSensorSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(matrix6)::gain"
)
,
deadZoneLimitSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::deadZoneLimit"
)
,
deadZoneLimitSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::deadZoneLimit"
)
,
transSensorJointSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::sensorJoint"
)
,
inertiaJointSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(matrix6)::inertiaJoint"
)
,
transSensorJointSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::sensorJoint"
)
,
inertiaJointSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(matrix6)::inertiaJoint"
)
,
velocitySIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::velocity"
)
,
velocitySIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::velocity"
)
,
accelerationSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::acceleration"
)
,
accelerationSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::acceleration"
)
,
handXworldSOUT
(
SOT_INIT_SIGNAL_2
(
ForceCompensation
::
computeHandXworld
,
,
handXworldSOUT
(
SOT_INIT_SIGNAL_2
(
ForceCompensation
::
computeHandXworld
,
worldRhandSIN
,
MatrixRotation
,
worldRhandSIN
,
MatrixRotation
,
...
@@ -62,7 +62,7 @@ ForceCompensationPlugin( const std::string & name )
...
@@ -62,7 +62,7 @@ ForceCompensationPlugin( const std::string & name )
handRsensorSIN
,
MatrixRotation
),
handRsensorSIN
,
MatrixRotation
),
"sotForceCompensation("
+
name
+
")::output(MatrixForce)::handVsensor"
)
"sotForceCompensation("
+
name
+
")::output(MatrixForce)::handVsensor"
)
,
torsorDeadZoneSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::torsorNullifiedIN"
)
,
torsorDeadZoneSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::torsorNullifiedIN"
)
,
sensorXhandSOUT
(
SOT_INIT_SIGNAL_2
(
ForceCompensation
::
computeSensorXhand
,
,
sensorXhandSOUT
(
SOT_INIT_SIGNAL_2
(
ForceCompensation
::
computeSensorXhand
,
handRsensorSIN
,
MatrixRotation
,
handRsensorSIN
,
MatrixRotation
,
transSensorJointSIN
,
ml
::
Vector
),
transSensorJointSIN
,
ml
::
Vector
),
...
@@ -76,9 +76,9 @@ ForceCompensationPlugin( const std::string & name )
...
@@ -76,9 +76,9 @@ ForceCompensationPlugin( const std::string & name )
accelerationSIN
,
ml
::
Vector
,
accelerationSIN
,
ml
::
Vector
,
sensorXhandSOUT
,
MatrixForce
,
sensorXhandSOUT
,
MatrixForce
,
inertiaJointSIN
,
ml
::
Matrix
),
inertiaJointSIN
,
ml
::
Matrix
),
"sotForceCompensation("
+
name
+
")::output(Vector6)::momentum"
)
"sotForceCompensation("
+
name
+
")::output(Vector6)::momentum"
)
,
momentumSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::momentumIN"
)
,
momentumSIN
(
NULL
,
"sotForceCompensation("
+
name
+
")::input(vector6)::momentumIN"
)
,
torsorCompensatedSOUT
(
SOT_INIT_SIGNAL_7
(
ForceCompensation
::
computeTorsorCompensated
,
,
torsorCompensatedSOUT
(
SOT_INIT_SIGNAL_7
(
ForceCompensation
::
computeTorsorCompensated
,
torsorSIN
,
ml
::
Vector
,
torsorSIN
,
ml
::
Vector
,
precompensationSIN
,
ml
::
Vector
,
precompensationSIN
,
ml
::
Vector
,
...
@@ -87,32 +87,32 @@ ForceCompensationPlugin( const std::string & name )
...
@@ -87,32 +87,32 @@ ForceCompensationPlugin( const std::string & name )
handVsensorSOUT
,
MatrixForce
,
handVsensorSOUT
,
MatrixForce
,
gainSensorSIN
,
ml
::
Matrix
,
gainSensorSIN
,
ml
::
Matrix
,
momentumSIN
,
ml
::
Vector
),
momentumSIN
,
ml
::
Vector
),
"sotForceCompensation("
+
name
+
")::output(Vector6)::torsor"
)
"sotForceCompensation("
+
name
+
")::output(Vector6)::torsor"
)
,
torsorDeadZoneSOUT
(
SOT_INIT_SIGNAL_2
(
ForceCompensation
::
computeDeadZone
,
,
torsorDeadZoneSOUT
(
SOT_INIT_SIGNAL_2
(
ForceCompensation
::
computeDeadZone
,
torsorDeadZoneSIN
,
ml
::
Vector
,
torsorDeadZoneSIN
,
ml
::
Vector
,
deadZoneLimitSIN
,
ml
::
Vector
),
deadZoneLimitSIN
,
ml
::
Vector
),
"sotForceCompensation("
+
name
+
")::output(Vector6)::torsorNullified"
)
"sotForceCompensation("
+
name
+
")::output(Vector6)::torsorNullified"
)
,
calibrationTrigerSOUT
(
boost
::
bind
(
&
ForceCompensationPlugin
::
calibrationTriger
,
,
calibrationTrigerSOUT
(
boost
::
bind
(
&
ForceCompensationPlugin
::
calibrationTriger
,
this
,
_1
,
_2
),
this
,
_1
,
_2
),
torsorSIN
<<
worldRhandSIN
,
torsorSIN
<<
worldRhandSIN
,
"sotForceCompensation("
+
name
+
")::output(Dummy)::calibrationTriger"
)
"sotForceCompensation("
+
name
+
")::output(Dummy)::calibrationTriger"
)
{
{
sotDEBUGIN
(
5
);
sotDEBUGIN
(
5
);
signalRegistration
(
torsorSIN
<<
worldRhandSIN
signalRegistration
(
torsorSIN
<<
worldRhandSIN
<<
handRsensorSIN
<<
translationSensorComSIN
<<
handRsensorSIN
<<
translationSensorComSIN
<<
gravitySIN
<<
precompensationSIN
<<
gainSensorSIN
<<
gravitySIN
<<
precompensationSIN
<<
gainSensorSIN
<<
deadZoneLimitSIN
<<
deadZoneLimitSIN
<<
transSensorJointSIN
<<
inertiaJointSIN
<<
transSensorJointSIN
<<
inertiaJointSIN
<<
velocitySIN
<<
accelerationSIN
<<
velocitySIN
<<
accelerationSIN
<<
handXworldSOUT
<<
handVsensorSOUT
<<
torsorDeadZoneSIN
<<
handXworldSOUT
<<
handVsensorSOUT
<<
torsorDeadZoneSIN
<<
sensorXhandSOUT
//<< inertiaSensorSOUT
<<
sensorXhandSOUT
//<< inertiaSensorSOUT
<<
momentumSOUT
<<
momentumSIN
<<
momentumSOUT
<<
momentumSIN
<<
torsorCompensatedSOUT
<<
torsorDeadZoneSOUT
<<
torsorCompensatedSOUT
<<
torsorDeadZoneSOUT
<<
calibrationTrigerSOUT
);
<<
calibrationTrigerSOUT
);
torsorDeadZoneSIN
.
plug
(
&
torsorCompensatedSOUT
);
torsorDeadZoneSIN
.
plug
(
&
torsorCompensatedSOUT
);
// By default, I choose: momentum is not compensated.
// By default, I choose: momentum is not compensated.
// momentumSIN.plug( &momentumSOUT );
// momentumSIN.plug( &momentumSOUT );
ml
::
Vector
v
(
6
);
v
.
fill
(
0
);
momentumSIN
=
v
;
ml
::
Vector
v
(
6
);
v
.
fill
(
0
);
momentumSIN
=
v
;
...
@@ -142,8 +142,8 @@ clearCalibration( void )
...
@@ -142,8 +142,8 @@ clearCalibration( void )
void
ForceCompensation
::
void
ForceCompensation
::
addCalibrationValue
(
const
ml
::
Vector
&
torsor
,
addCalibrationValue
(
const
ml
::
Vector
&
/*
torsor
*/
,
const
MatrixRotation
&
worldRhand
)
const
MatrixRotation
&
/*
worldRhand
*/
)
{
{
sotDEBUGIN
(
45
);
sotDEBUGIN
(
45
);
...
@@ -155,10 +155,10 @@ addCalibrationValue( const ml::Vector& torsor,
...
@@ -155,10 +155,10 @@ addCalibrationValue( const ml::Vector& torsor,
sotDEBUGOUT
(
45
);
sotDEBUGOUT
(
45
);
}
}
ml
::
Vector
ForceCompensation
::
ml
::
Vector
ForceCompensation
::
calibrateTransSensorCom
(
const
ml
::
Vector
&
gravity
,
calibrateTransSensorCom
(
const
ml
::
Vector
&
gravity
,
const
MatrixRotation
&
handRsensor
)
const
MatrixRotation
&
/*
handRsensor
*/
)
{
{
// sotDEBUGIN(25);
// sotDEBUGIN(25);
...
@@ -167,18 +167,18 @@ calibrateTransSensorCom( const ml::Vector& gravity,
...
@@ -167,18 +167,18 @@ calibrateTransSensorCom( const ml::Vector& gravity,
// for( unsigned int j=0;j<3;++j ) { grav3(j)=gravity(j); }
// for( unsigned int j=0;j<3;++j ) { grav3(j)=gravity(j); }
// std::list< ml::Vector >::iterator iterTorsor = torsorList.begin();
// std::list< ml::Vector >::iterator iterTorsor = torsorList.begin();
// std::list< MatrixRotation >::const_iterator iterRotation
// std::list< MatrixRotation >::const_iterator iterRotation
// = rotationList.begin();
// = rotationList.begin();
// const unsigned int NVAL = torsorList.size();
// const unsigned int NVAL = torsorList.size();
// if( 0==NVAL )
// if( 0==NVAL )
// {
// {
// ml::Vector zero(3); zero.fill(0);
// ml::Vector zero(3); zero.fill(0);
// return zero;
// return zero;
// }
// }
// if(NVAL!=rotationList.size() )
// if(NVAL!=rotationList.size() )
// {
// {
// // TODO: ERROR THROW
// // TODO: ERROR THROW
// }
// }
...
@@ -222,12 +222,12 @@ calibrateTransSensorCom( const ml::Vector& gravity,
...
@@ -222,12 +222,12 @@ calibrateTransSensorCom( const ml::Vector& gravity,
// ml::Matrix Skew(3,3);
// ml::Matrix Skew(3,3);
// torsors.multiply( gravsInv,Skew );
// torsors.multiply( gravsInv,Skew );
// sotDEBUG(25) << "Skew = " << Skew << std::endl;
// sotDEBUG(25) << "Skew = " << Skew << std::endl;
// ml::Vector sc(3);
// ml::Vector sc(3);
// sc(0)=(Skew(2,1)-Skew(1,2))*.5 ;
// sc(0)=(Skew(2,1)-Skew(1,2))*.5 ;
// sc(1)=(Skew(0,2)-Skew(2,0))*.5 ;
// sc(1)=(Skew(0,2)-Skew(2,0))*.5 ;
// sc(2)=(Skew(1,0)-Skew(0,1))*.5 ;
// sc(2)=(Skew(1,0)-Skew(0,1))*.5 ;
// sotDEBUG(15) << "SC = " << sc << std::endl;
// sotDEBUG(15) << "SC = " << sc << std::endl;
// /* TAKE the antisym constraint into account inside the minimization pbm. */
// /* TAKE the antisym constraint into account inside the minimization pbm. */
// sotDEBUGOUT(25);
// sotDEBUGOUT(25);
...
@@ -236,9 +236,9 @@ calibrateTransSensorCom( const ml::Vector& gravity,
...
@@ -236,9 +236,9 @@ calibrateTransSensorCom( const ml::Vector& gravity,
}
}
ml
::
Vector
ForceCompensation
::
ml
::
Vector
ForceCompensation
::
calibrateGravity
(
const
MatrixRotation
&
handRsensor
,
calibrateGravity
(
const
MatrixRotation
&
/*
handRsensor
*/
,
bool
precompensationCalibration
,
bool
/*
precompensationCalibration
*/
,
const
MatrixRotation
&
hand0RsensorArg
)
const
MatrixRotation
&
/*
hand0RsensorArg
*/
)
{
{
sotDEBUGIN
(
25
);
sotDEBUGIN
(
25
);
...
@@ -247,20 +247,20 @@ calibrateGravity( const MatrixRotation& handRsensor,
...
@@ -247,20 +247,20 @@ calibrateGravity( const MatrixRotation& handRsensor,
// else hand0Rsensor=hand0RsensorArg;
// else hand0Rsensor=hand0RsensorArg;
// std::list< ml::Vector >::const_iterator iterTorsor = torsorList.begin();
// std::list< ml::Vector >::const_iterator iterTorsor = torsorList.begin();
// std::list< MatrixRotation >::const_iterator iterRotation
// std::list< MatrixRotation >::const_iterator iterRotation
// = rotationList.begin();
// = rotationList.begin();
// const unsigned int NVAL = torsorList.size();
// const unsigned int NVAL = torsorList.size();
// if(NVAL!=rotationList.size() )
// if(NVAL!=rotationList.size() )
// {
// {
// // TODO: ERROR THROW
// // TODO: ERROR THROW
// }
// }
// if( 0==NVAL )
// if( 0==NVAL )
// {
// {
// ml::Vector zero(6); zero.fill(0);
// ml::Vector zero(6); zero.fill(0);
// return zero;
// return zero;
// }
// }
// ml::Vector force(3),forceHand(3),forceWorld(3);
// ml::Vector force(3),forceHand(3),forceWorld(3);
// ml::Vector sumForce(3); sumForce.fill(0);
// ml::Vector sumForce(3); sumForce.fill(0);
...
@@ -284,9 +284,9 @@ calibrateGravity( const MatrixRotation& handRsensor,
...
@@ -284,9 +284,9 @@ calibrateGravity( const MatrixRotation& handRsensor,
// R_I -= hand0Rsensor;
// R_I -= hand0Rsensor;
// R_I.pseudoInverse(.01).multiply( forceHand,forceWorld );
// R_I.pseudoInverse(.01).multiply( forceHand,forceWorld );
// }
// }
// else
// else
// { R.multiply( forceHand,forceWorld ); }
// { R.multiply( forceHand,forceWorld ); }
// sotDEBUG(35) << "R(" << i << "*3+1:" << i << "*3+3,:) = " << R << "';";
// sotDEBUG(35) << "R(" << i << "*3+1:" << i << "*3+3,:) = " << R << "';";
// sotDEBUG(35) << "rhFs(" << i << "*3+1:" << i << "*3+3) = " << forceHand;
// sotDEBUG(35) << "rhFs(" << i << "*3+1:" << i << "*3+3) = " << forceHand;
// sotDEBUG(45) << "fworld(" << i << "*3+1:" << i << "*3+3) = " << forceWorld;
// sotDEBUG(45) << "fworld(" << i << "*3+1:" << i << "*3+3) = " << forceWorld;
...
@@ -325,10 +325,10 @@ computeHandXworld( const MatrixRotation & worldRhand,
...
@@ -325,10 +325,10 @@ computeHandXworld( const MatrixRotation & worldRhand,
MatrixRotation
R
;
worldRhand
.
transpose
(
R
);
MatrixRotation
R
;
worldRhand
.
transpose
(
R
);
MatrixHomogeneous
scRw
;
scRw
.
buildFrom
(
R
,
transSensorCom
);
MatrixHomogeneous
scRw
;
scRw
.
buildFrom
(
R
,
transSensorCom
);
sotDEBUG
(
25
)
<<
"scMw = "
<<
scRw
<<
std
::
endl
;
sotDEBUG
(
25
)
<<
"scMw = "
<<
scRw
<<
std
::
endl
;
res
.
buildFrom
(
scRw
);
res
.
buildFrom
(
scRw
);
sotDEBUG
(
15
)
<<
"scXw = "
<<
res
<<
std
::
endl
;
sotDEBUG
(
15
)
<<
"scXw = "
<<
res
<<
std
::
endl
;
sotDEBUGOUT
(
35
);
sotDEBUGOUT
(
35
);
return
res
;
return
res
;
}
}
...
@@ -355,12 +355,12 @@ computeHandVsensor( const MatrixRotation & handRsensor,
...
@@ -355,12 +355,12 @@ computeHandVsensor( const MatrixRotation & handRsensor,
}
}
MatrixForce
&
ForceCompensation
::
MatrixForce
&
ForceCompensation
::
computeSensorXhand
(
const
MatrixRotation
&
handRsensor
,
computeSensorXhand
(
const
MatrixRotation
&
/*
handRsensor
*/
,
const
ml
::
Vector
&
transJointSensor
,
const
ml
::
Vector
&
transJointSensor
,
MatrixForce
&
res
)
MatrixForce
&
res
)
{
{
sotDEBUGIN
(
35
);
sotDEBUGIN
(
35
);
/* Force Matrix to pass from the joint frame (ie frame located
/* Force Matrix to pass from the joint frame (ie frame located
* at the position of the motor, in which the acc is computed by Spong)
* at the position of the motor, in which the acc is computed by Spong)
* to the frame SensorHand where all the forces are expressed (ie
* to the frame SensorHand where all the forces are expressed (ie
...
@@ -384,7 +384,7 @@ computeSensorXhand( const MatrixRotation & handRsensor,
...
@@ -384,7 +384,7 @@ computeSensorXhand( const MatrixRotation & handRsensor,
// ml::Matrix& res )
// ml::Matrix& res )
// {
// {
// sotDEBUGIN(35);
// sotDEBUGIN(35);
// /* Inertia felt at the sensor position, expressed in the orientation
// /* Inertia felt at the sensor position, expressed in the orientation
// * of the hand. */
// * of the hand. */
...
@@ -428,14 +428,14 @@ computeTorsorCompensated( const ml::Vector& torqueInput,
...
@@ -428,14 +428,14 @@ computeTorsorCompensated( const ml::Vector& torqueInput,
handXworld
.
multiply
(
gravity
,
grh
);
handXworld
.
multiply
(
gravity
,
grh
);
grh
*=
-
1
;
grh
*=
-
1
;
sotDEBUG
(
25
)
<<
"g_rh = "
<<
grh
;
sotDEBUG
(
25
)
<<
"g_rh = "
<<
grh
;
res
+=
grh
;
res
+=
grh
;
sotDEBUG
(
25
)
<<
"fcomp = "
<<
res
;
sotDEBUG
(
25
)
<<
"fcomp = "
<<
res
;
res
+=
momentum
;
res
+=
momentum
;
sotDEBUG
(
25
)
<<
"facc = "
<<
res
;
sotDEBUG
(
25
)
<<
"facc = "
<<
res
;
/* TODO res += m xddot */
/* TODO res += m xddot */
sotDEBUGOUT
(
35
);
sotDEBUGOUT
(
35
);
...
@@ -459,7 +459,7 @@ crossProduct_V_F( const ml::Vector& velocity,
...
@@ -459,7 +459,7 @@ crossProduct_V_F( const ml::Vector& velocity,
v
.
crossProduct
(
f
,
res2a
);
v
.
crossProduct
(
f
,
res2a
);
w
.
crossProduct
(
tau
,
res2b
);
w
.
crossProduct
(
tau
,
res2b
);
res2a
+=
res2b
;
res2a
+=
res2b
;
res
.
resize
(
6
);
res
.
resize
(
6
);
for
(
unsigned
int
i
=
0
;
i
<
3
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
3
;
++
i
)
{
{
...
@@ -467,7 +467,7 @@ crossProduct_V_F( const ml::Vector& velocity,
...
@@ -467,7 +467,7 @@ crossProduct_V_F( const ml::Vector& velocity,
}
}
return
res
;
return
res
;
}
}
ml
::
Vector
&
ForceCompensation
::
ml
::
Vector
&
ForceCompensation
::
computeMomentum
(
const
ml
::
Vector
&
velocity
,
computeMomentum
(
const
ml
::
Vector
&
velocity
,
...
@@ -481,7 +481,7 @@ computeMomentum( const ml::Vector& velocity,
...
@@ -481,7 +481,7 @@ computeMomentum( const ml::Vector& velocity,
/* Fs + Fext = I acc + V x Iv */
/* Fs + Fext = I acc + V x Iv */
ml
::
Vector
Iacc
(
6
);
inertiaJoint
.
multiply
(
acceleration
,
Iacc
);
ml
::
Vector
Iacc
(
6
);
inertiaJoint
.
multiply
(
acceleration
,
Iacc
);
res
.
resize
(
6
);
sensorXhand
.
multiply
(
Iacc
,
res
);
res
.
resize
(
6
);
sensorXhand
.
multiply
(
Iacc
,
res
);
ml
::
Vector
Iv
(
6
);
inertiaJoint
.
multiply
(
velocity
,
Iv
);
ml
::
Vector
Iv
(
6
);
inertiaJoint
.
multiply
(
velocity
,
Iv
);
ml
::
Vector
vIv
(
6
);
crossProduct_V_F
(
velocity
,
Iv
,
vIv
);
ml
::
Vector
vIv
(
6
);
crossProduct_V_F
(
velocity
,
Iv
,
vIv
);
ml
::
Vector
XvIv
(
6
);
sensorXhand
.
multiply
(
vIv
,
XvIv
);
ml
::
Vector
XvIv
(
6
);
sensorXhand
.
multiply
(
vIv
,
XvIv
);
...
@@ -495,15 +495,14 @@ ml::Vector& ForceCompensation::
...
@@ -495,15 +495,14 @@ ml::Vector& ForceCompensation::
computeDeadZone
(
const
ml
::
Vector
&
torqueInput
,
computeDeadZone
(
const
ml
::
Vector
&
torqueInput
,
const
ml
::
Vector
&
deadZone
,
const
ml
::
Vector
&
deadZone
,
ml
::
Vector
&
res
)
ml
::
Vector
&
res
)
{
{
sotDEBUGIN
(
35
);
sotDEBUGIN
(
35
);
if
(
torqueInput
.
size
()
>
deadZone
.
size
()
)
return
res
;
if
(
torqueInput
.
size
()
>
deadZone
.
size
()
)
return
res
;
res
.
resize
(
torqueInput
.
size
());
res
.
resize
(
torqueInput
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
torqueInput
.
size
();
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
torqueInput
.
size
();
++
i
)
{
{
const
double
th
=
fabs
f
(
deadZone
(
i
));
const
double
th
=
fabs
(
deadZone
(
i
));
if
(
(
torqueInput
(
i
)
<
th
)
&&
(
torqueInput
(
i
)
>-
th
)
)
if
(
(
torqueInput
(
i
)
<
th
)
&&
(
torqueInput
(
i
)
>-
th
)
)
{
res
(
i
)
=
0
;
}
{
res
(
i
)
=
0
;
}
else
if
(
torqueInput
(
i
)
<
0
)
res
(
i
)
=
torqueInput
(
i
)
+
th
;
else
if
(
torqueInput
(
i
)
<
0
)
res
(
i
)
=
torqueInput
(
i
)
+
th
;
...
@@ -516,11 +515,11 @@ computeDeadZone( const ml::Vector& torqueInput,
...
@@ -516,11 +515,11 @@ computeDeadZone( const ml::Vector& torqueInput,
ForceCompensationPlugin
::
sotDummyType
&
ForceCompensationPlugin
::
ForceCompensationPlugin
::
sotDummyType
&
ForceCompensationPlugin
::
calibrationTriger
(
ForceCompensationPlugin
::
sotDummyType
&
dummy
,
int
time
)
calibrationTriger
(
ForceCompensationPlugin
::
sotDummyType
&
dummy
,
int
/*
time
*/
)
{
{
// sotDEBUGIN(45);
// sotDEBUGIN(45);
// if(! calibrationStarted ) { sotDEBUGOUT(45); return dummy=0; }
// if(! calibrationStarted ) { sotDEBUGOUT(45); return dummy=0; }
// addCalibrationValue( torsorSIN(time),worldRhandSIN(time) );
// addCalibrationValue( torsorSIN(time),worldRhandSIN(time) );
// sotDEBUGOUT(45);
// sotDEBUGOUT(45);
return
dummy
=
1
;
return
dummy
=
1
;
...
@@ -572,14 +571,14 @@ commandLine( const std::string& cmdLine,
...
@@ -572,14 +571,14 @@ commandLine( const std::string& cmdLine,
// }
// }
// else if( "calibrateGravity" == cmdLine )
// else if( "calibrateGravity" == cmdLine )
// {
// {
// if( calibrationStarted )
// if( calibrationStarted )
// {
// {
// os<< "Calibration phase is on, stop it first."<<std::endl;
// os<< "Calibration phase is on, stop it first."<<std::endl;
// return;
// return;
// }
// }
// ml::Vector grav = calibrateGravity( handRsensorSIN.accessCopy(),
// ml::Vector grav = calibrateGravity( handRsensorSIN.accessCopy(),
// usingPrecompensation );
// usingPrecompensation );
// cmdArgs >> std::ws;
// cmdArgs >> std::ws;
// if( cmdArgs.good() )
// if( cmdArgs.good() )
// {
// {
...
@@ -603,33 +602,33 @@ commandLine( const std::string& cmdLine,
...
@@ -603,33 +602,33 @@ commandLine( const std::string& cmdLine,
// os<< "Calibration phase is on, stop it first."<<std::endl;
// os<< "Calibration phase is on, stop it first."<<std::endl;
// }
// }
// ml::Vector position(3);
// ml::Vector position(3);
// position = calibrateTransSensorCom( gravitySIN.accessCopy(),
// position = calibrateTransSensorCom( gravitySIN.accessCopy(),
// handRsensorSIN.accessCopy() );
// handRsensorSIN.accessCopy() );
// transSensorComSIN = position;
// transSensorComSIN = position;
// }
// }
else
if
(
"precomp"
==
cmdLine
)
else
if
(
"precomp"
==
cmdLine
)
{
{
cmdArgs
>>
std
::
ws
;
cmdArgs
>>
std
::
ws
;
if
(
cmdArgs
.
good
()
)
if
(
cmdArgs
.
good
()
)
{
cmdArgs
>>
usingPrecompensation
;
}
{
cmdArgs
>>
usingPrecompensation
;
}
else
{
os
<<
"precompensation = "
<<
usingPrecompensation
<<
std
::
endl
;
}
else
{
os
<<
"precompensation = "
<<
usingPrecompensation
<<
std
::
endl
;
}
}
}
else
if
(
"compensateMomentum"
==
cmdLine
)
else
if
(
"compensateMomentum"
==
cmdLine
)
{
{
cmdArgs
>>
std
::
ws
;
cmdArgs
>>
std
::
ws
;
if
(
cmdArgs
.
good
()
)
if
(
cmdArgs
.
good
()
)
{
{
bool
use
;
cmdArgs
>>
use
;
bool
use
;
cmdArgs
>>
use
;
if
(
use
)
momentumSIN
.
plug
(
&
momentumSOUT
);
if
(
use
)
momentumSIN
.
plug
(
&
momentumSOUT
);
else
else
{
{
ml
::
Vector
m
(
6
);
m
.
resize
(
0
);
momentumSIN
=
m
;
ml
::
Vector
m
(
6
);
m
.
resize
(
0
);
momentumSIN
=
m
;
}
}
}
}
else
else
{
{
os
<<
"compensateMomentum = "
<<
(
momentumSIN
.
getPtr
()
!=&
momentumSIN
)
os
<<
"compensateMomentum = "
<<
(
momentumSIN
.
getPtr
()
!=&
momentumSIN
)
<<
std
::
endl
;
<<
std
::
endl
;
}
}
}
}
else
{
Entity
::
commandLine
(
cmdLine
,
cmdArgs
,
os
);
}
else
{
Entity
::
commandLine
(
cmdLine
,
cmdArgs
,
os
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment