diff --git a/src/math/op-point-modifier.cpp b/src/math/op-point-modifier.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8c4fbdf1e3b9d81b9c5af4e79dc0d7efa195d766 --- /dev/null +++ b/src/math/op-point-modifier.cpp @@ -0,0 +1,114 @@ +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * Copyright Projet JRL-Japan, 2007 + *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * + * File: sotOpPointModifior.cp + * Project: SOT + * Author: Nicolas Mansard + * + * Version control + * =============== + * + * $Id$ + * + * Description + * ============ + * + * + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ + +#include <dynamic-graph/all-signals.h> + +#include <sot-core/op-point-modifier.h> +#include <sot-core/matrix-twist.h> + +#include <dynamic-graph/pool.h> +#include <sot-core/factory.h> + +using namespace std; +using namespace sot; + +namespace sot { +SOT_FACTORY_ENTITY_PLUGIN(sotOpPointModifior,"OpPointModifior"); +} + + +/* --------------------------------------------------------------------- */ +/* --------------------------------------------------------------------- */ +/* --------------------------------------------------------------------- */ + +sotOpPointModifior:: +sotOpPointModifior( const std::string& name ) + :Entity( name ) + ,transformation() + ,jacobianSIN(NULL,"OpPointModifior("+name+")::input(matrix)::jacobianIN") + ,positionSIN(NULL,"OpPointModifior("+name+")::input(matrixhomo)::positionIN") + ,jacobianSOUT( boost::bind(&sotOpPointModifior::computeJacobian,this,_1,_2), + jacobianSIN, + "OpPointModifior("+name+")::output(matrix)::jacobian" ) + ,positionSOUT( boost::bind(&sotOpPointModifior::computePosition,this,_1,_2), + jacobianSIN, + "OpPointModifior("+name+")::output(matrixhomo)::position" ) + + +{ + signalRegistration( jacobianSIN<<positionSIN<<jacobianSOUT<<positionSOUT ); + sotDEBUGINOUT(15); +} + +ml::Matrix& +sotOpPointModifior::computeJacobian( ml::Matrix& res,const int& time ) +{ + const ml::Matrix& jacobian = jacobianSIN( time ); + sotMatrixTwist V( transformation ); + res = V*jacobian; + return res; +} + +sotMatrixHomogeneous& +sotOpPointModifior::computePosition( sotMatrixHomogeneous& res,const int& time ) +{ + sotDEBUGIN(15); + sotDEBUGIN(15) << time << " " << positionSIN.getTime() << positionSOUT.getTime() << endl; + const sotMatrixHomogeneous& position = positionSIN( time ); + position.multiply(transformation,res); + sotDEBUGOUT(15); + return res; +} + +void +sotOpPointModifior::setTransformation( const sotMatrixHomogeneous& tr ) +{ transformation = tr; } + + +void sotOpPointModifior:: +commandLine( const std::string& cmdLine, + std::istringstream& cmdArgs, + std::ostream& os ) +{ + if( cmdLine == "transfo" ) + { + sotMatrixHomogeneous tr; + cmdArgs >> tr; + setTransformation(tr); + } + else if( cmdLine == "transfoSignal" ) + { + Signal< sotMatrixHomogeneous,int > &sig + = dynamic_cast< Signal< sotMatrixHomogeneous,int >& > + (pool.getSignal( cmdArgs )); + setTransformation(sig.accessCopy()); + } + else if( cmdLine == "getTransfo" ) + { + os << "Transformation: " << endl << transformation <<endl; + } + else if( cmdLine == "help" ) + { + os << "sotOpPointModifior"<<endl + << " - transfo MatrixHomo"<<endl + << " - transfoSignal ent.signal<matrixhomo>"<<endl + << " - getTransfo"<<endl; + } + else Entity::commandLine(cmdLine,cmdArgs,os); +} diff --git a/src/sot/sot-h.cpp b/src/sot/sot-h.cpp index 500e194159c6a627dcd47882525dc8970fce39e2..23a8180aa10a594f2dde9050f1fe5f43e7d72280 100644 --- a/src/sot/sot-h.cpp +++ b/src/sot/sot-h.cpp @@ -31,14 +31,14 @@ using namespace std; using namespace sot; -#ifdef VP_DEBUG +//#ifdef VP_DEBUG class sotSOTH__INIT { public:sotSOTH__INIT( void ) { sot::DebugTrace::openFile(); } }; sotSOTH__INIT sotSOTH_initiator; -#endif +//#endif /* --------------------------------------------------------------------- */ /* --- CLASS ----------------------------------------------------------- */