Skip to content
Snippets Groups Projects
Commit b4221ea8 authored by Florent Lamiraux's avatar Florent Lamiraux
Browse files

bind classes WaistPoseFromSensorAndContact and WaistAttitudeFromSensor.

     * include/sot-dynamic/waist-attitude-from-sensor.h,
     * src/waist-attitude-from-sensor.cpp.
parent 2cb44bbb
No related branches found
No related tags found
1 merge request!1[major][cpp] starting point to integrate pinocchio
......@@ -98,7 +98,14 @@ class SOTWAISTATTITUDEFROMSENSOR_EXPORT WaistPoseFromSensorAndContact
static const std::string CLASS_NAME;
protected:
bool fromSensor;
void fromSensor(const bool& inFromSensor) {
fromSensor_ = inFromSensor;
}
bool fromSensor() const {
return fromSensor_;
}
private:
bool fromSensor_;
public: /* --- CONSTRUCTION --- */
......
......@@ -22,6 +22,10 @@
#include <sot-core/debug.h>
#include <dynamic-graph/factory.h>
#include <dynamic-graph/command.h>
#include <dynamic-graph/command-setter.h>
#include <dynamic-graph/command-getter.h>
using namespace sot;
using namespace dynamicgraph;
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(WaistAttitudeFromSensor,"WaistAttitudeFromSensor");
......@@ -105,7 +109,7 @@ DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(WaistPoseFromSensorAndContact,
WaistPoseFromSensorAndContact::
WaistPoseFromSensorAndContact( const std::string & name )
:WaistAttitudeFromSensor(name)
,fromSensor(false)
,fromSensor_(false)
,positionContactSIN(NULL,"sotWaistPoseFromSensorAndContact("+name+")::input(matrixHomo)::contact")
,positionWaistSOUT( boost::bind(&WaistPoseFromSensorAndContact::computePositionWaist,this,_1,_2),
attitudeWaistSOUT<<positionContactSIN,
......@@ -115,6 +119,29 @@ WaistPoseFromSensorAndContact( const std::string & name )
signalRegistration( positionContactSIN<<positionWaistSOUT );
// Commands
std::string docstring;
docstring = " \n"
" Set flag specifying whether angles are measured from sensors or simulated.\n"
" \n"
" Input:\n"
" - a boolean value.\n"
" \n";
addCommand("setFromSensor",
new ::dynamicgraph::command::Setter
<WaistPoseFromSensorAndContact, bool>
(*this, &WaistPoseFromSensorAndContact::fromSensor, docstring));
" Get flag specifying whether angles are measured from sensors or simulated.\n"
" \n"
" No input,\n"
" return a boolean value.\n"
" \n";
addCommand("getFromSensor",
new ::dynamicgraph::command::Getter
<WaistPoseFromSensorAndContact, bool>
(*this, &WaistPoseFromSensorAndContact::fromSensor, docstring));
sotDEBUGOUT(5);
}
......@@ -144,7 +171,7 @@ computePositionWaist( ml::Vector& res,
for( unsigned int i=0;i<3;++i )
{ res(i)=contactMwaist(i,3); }
if(fromSensor)
if(fromSensor_)
{
const VectorRollPitchYaw & worldrwaist = attitudeWaistSOUT( time );
for( unsigned int i=0;i<3;++i )
......@@ -191,9 +218,9 @@ commandLine( const std::string& cmdLine,
std::string val; cmdArgs>>val;
if( ("true"==val)||("false"==val) )
{
fromSensor = ( val=="true" );
fromSensor_ = ( val=="true" );
} else {
os << "fromSensor = " << (fromSensor?"true":"false") << std::endl;
os << "fromSensor = " << (fromSensor_?"true":"false") << std::endl;
}
}
else { WaistAttitudeFromSensor::commandLine( cmdLine,cmdArgs,os); }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment