Commit 703347b2 authored by Rohan Budhiraja's avatar Rohan Budhiraja
Browse files

[cmake] update sot-tools version

parent 10a09197
......@@ -23,8 +23,8 @@ INCLUDE(cmake/cpack.cmake)
SET(PROJECT_NAME sot-dynamic)
SET(PROJECT_DESCRIPTION "jrl-dynamics bindings for dynamic-graph.")
SET(PROJECT_URL "http://github.com/stack-of-tasks/sot-dynamic")
SET(PROJECT_DESCRIPTION "pinocchio bindings for dynamic-graph.")
SET(PROJECT_URL "https://github.com/proyan/sot-dynamic/tree/topic/sot-pinocchio")
SET(CUSTOM_HEADER_DIR "${PROJECT_NAME}")
......@@ -38,13 +38,11 @@ SET(PKG_CONFIG_ADDITIONAL_VARIABLES
)
SETUP_PROJECT()
# Search for dependencies.
ADD_REQUIRED_DEPENDENCY("jrl-dynamics >= 1.19.0")
ADD_REQUIRED_DEPENDENCY("pinocchio")
ADD_REQUIRED_DEPENDENCY("dynamic-graph >= 3.0.0")
ADD_REQUIRED_DEPENDENCY("sot-core >= 3.0.0")
ADD_REQUIRED_DEPENDENCY("sot-tools")
ADD_REQUIRED_DEPENDENCY("sot-tools >= 2.0.0")
# List plug-ins that will be compiled.
SET(plugins
......@@ -70,7 +68,7 @@ PKG_CONFIG_APPEND_LIBS(${LIBRARY_NAME})
# Search for dependencies.
# Boost
SET(BOOST_COMPONENTS filesystem system)
SET(BOOST_COMPONENTS filesystem system unit_test_framework)
SEARCH_FOR_BOOST()
SEARCH_FOR_EIGEN()
......
This diff is collapsed.
......@@ -29,7 +29,6 @@ ENDIF(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
SET(integrator-force-rk4_plugins_dependencies integrator-force)
SET(integrator-force-exact_plugins_dependencies integrator-force)
FOREACH(lib ${plugins})
ADD_LIBRARY(${lib} SHARED ${lib}.cpp)
......@@ -44,7 +43,7 @@ FOREACH(lib ${plugins})
TARGET_LINK_LIBRARIES(${lib} ${Boost_LIBRARIES})
PKG_CONFIG_USE_DEPENDENCY(${lib} jrl-dynamics)
PKG_CONFIG_USE_DEPENDENCY(${lib} pinocchio)
PKG_CONFIG_USE_DEPENDENCY(${lib} sot-core)
PKG_CONFIG_USE_DEPENDENCY(${lib} dynamic-graph)
......@@ -61,13 +60,13 @@ ENDFOREACH(lib)
# Main Library
ADD_LIBRARY(${LIBRARY_NAME} SHARED sot-dynamic.cpp)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} jrl-dynamics)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} pinocchio)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} sot-core)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} dynamic-graph)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} jrl-dynamics)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} pinocchio)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} sot-core)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${Boost_LIBRARIES})
INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
TARGET_LINK_LIBRARIES(dynamic ${LIBRARY_NAME})
......
......@@ -33,123 +33,57 @@ namespace dynamicgraph { namespace sot {
using ::dynamicgraph::command::Value;
// Command SetFiles
class SetFiles : public Command
class SetFile : public Command
{
public:
virtual ~SetFiles() {}
virtual ~SetFile() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
SetFiles(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING)
(Value::STRING)(Value::STRING)(Value::STRING), docstring)
SetFile(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING), docstring)
{
}
virtual Value doExecute()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
std::vector<Value> values = getParameterValues();
std::string vrmlDirectory = values[0].value();
std::string vrmlMainFile = values[1].value();
std::string xmlSpecificityFiles = values[2].value();
std::string xmlRankFile = values[3].value();
robot.setVrmlDirectory(vrmlDirectory);
robot.setVrmlMainFile(vrmlMainFile);
robot.setXmlSpecificityFile(xmlSpecificityFiles);
robot.setXmlRankFile(xmlRankFile);
// return void
std::string urdfFile = values[0].value();
robot.setUrdfFile(urdfFile);
return Value();
}
}; // class SetFiles
// Command Parse
class Parse : public Command
{
public:
virtual ~Parse() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
Parse(Dynamic& entity, const std::string& docstring) :
Command(entity, std::vector<Value::Type>(), docstring)
{
}
virtual Value doExecute()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
if(! robot.init ) robot.parseConfigFiles();
else std::cout << " !! Already parsed." << std::endl;
// return void
return Value();
}
}; // class Parse
// Command SetProperty
class SetProperty : public Command
// Command CreateRobot
class CreateRobot : public Command
{
public:
virtual ~SetProperty() {}
virtual ~CreateRobot() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
SetProperty(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING)(Value::STRING),
CreateRobot(Dynamic& entity, const std::string& docstring) :
Command(entity, std::vector<Value::Type>(),
docstring)
{
}
virtual Value doExecute()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
std::vector<Value> values = getParameterValues();
std::string property = values[0].value();
std::string value = values[1].value();
robot.m_HDR->setProperty(property, value);
robot.createRobot();
return Value();
}
}; // class SetProperty
// Command GetProperty
class GetProperty : public Command
{
public:
virtual ~GetProperty() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
GetProperty(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING),
docstring)
{
}
virtual Value doExecute()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
std::vector<Value> values = getParameterValues();
std::string property = values[0].value();
std::string value;
if(! robot.m_HDR->getProperty(property, value) )
{
if( property == "vrmlDirectory" ) value = robot.vrmlDirectory;
else if( property == "xmlSpecificityFile" ) value = robot.xmlSpecificityFile;
else if( property == "xmlRankFile" ) value = robot.xmlRankFile;
else if( property == "vrmlMainFile" ) value = robot.vrmlMainFile;
}
return Value(value);
}
}; // class GetProperty
}; // class CreateRobot
// Command CreateRobot
class CreateRobot : public Command
// Command DisplayModel
class DisplayModel : public Command
{
public:
virtual ~CreateRobot() {}
virtual ~DisplayModel() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
CreateRobot(Dynamic& entity, const std::string& docstring) :
DisplayModel(Dynamic& entity, const std::string& docstring) :
Command(entity, std::vector<Value::Type>(),
docstring)
{
......@@ -157,10 +91,10 @@ namespace dynamicgraph { namespace sot {
virtual Value doExecute()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
robot.createRobot();
robot.displayModel();
return Value();
}
}; // class CreateRobot
}; // class DisplayModel
// Command CreateJoint
class CreateJoint : public Command
......@@ -187,38 +121,16 @@ namespace dynamicgraph { namespace sot {
}
}; // class CreateJoint
// Command SetRootJoint
class SetRootJoint : public Command
{
public:
virtual ~SetRootJoint() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
SetRootJoint(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING), docstring)
{
}
virtual Value doExecute()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
std::vector<Value> values = getParameterValues();
std::string jointName = values[0].value();
robot.setRootJoint(jointName);
return Value();
}
}; // class SetRootJoint
// Command AddJoint
class AddJoint : public Command
// Command AddBody
class AddBody : public Command
{
public:
virtual ~AddJoint() {}
virtual ~AddBody() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
AddJoint(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING)(Value::STRING),
AddBody(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING)(Value::STRING)(Value::STRING),
docstring)
{
}
......@@ -227,37 +139,12 @@ namespace dynamicgraph { namespace sot {
Dynamic& robot = static_cast<Dynamic&>(owner());
std::vector<Value> values = getParameterValues();
std::string parentName = values[0].value();
std::string childName = values[1].value();
robot.addJoint(parentName, childName);
std::string jointName = values[1].value();
std::string childName = values[2].value();
robot.addBody(parentName,jointName,childName);
return Value();
}
}; // class AddJoint
// Command SetDofBounds
class SetDofBounds : public Command
{
public:
virtual ~SetDofBounds() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
SetDofBounds(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING)(Value::UNSIGNED)
(Value::DOUBLE)(Value::DOUBLE), docstring)
{
}
virtual Value doExecute()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
std::vector<Value> values = getParameterValues();
std::string jointName = values[0].value();
unsigned int dofId = values[1].value();
double minValue = values[2].value();
double maxValue = values[3].value();
robot.setDofBounds(jointName, dofId, minValue, maxValue);
return Value();
}
}; // class SetDofBounds
}; // class AddBody
// Command SetMass
class SetMass : public Command
......@@ -331,17 +218,18 @@ namespace dynamicgraph { namespace sot {
}
}; // class SetInertiaMatrix
// Command SetSpecificJoint
class SetSpecificJoint : public Command
// Command SetInertiaProperties
class SetInertiaProperties : public Command
{
public:
virtual ~SetSpecificJoint() {}
virtual ~SetInertiaProperties() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
SetSpecificJoint(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING)(Value::STRING),
docstring)
SetInertiaProperties(Dynamic& entity, const std::string& docstring) :
Command(entity,
boost::assign::list_of(Value::STRING)
(Value::DOUBLE)(Value::VECTOR)(Value::MATRIX),docstring)
{
}
virtual Value doExecute()
......@@ -349,75 +237,49 @@ namespace dynamicgraph { namespace sot {
Dynamic& robot = static_cast<Dynamic&>(owner());
std::vector<Value> values = getParameterValues();
std::string jointName = values[0].value();
std::string jointType = values[1].value();
robot.setSpecificJoint(jointName, jointType);
double mass = values[1].value();
dynamicgraph::Vector com = values[2].value();
dynamicgraph::Matrix inertiaMatrix = values[3].value();
robot.setInertiaProperties(jointName, mass,com,inertiaMatrix);
return Value();
}
}; // class SetSpecificJoint
}; // class SetInertiaMatrix
// Command SetHandParameters
class SetHandParameters : public Command
{
public:
virtual ~SetHandParameters() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
SetHandParameters(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::BOOL)(Value::VECTOR)
(Value::VECTOR)(Value::VECTOR)(Value::VECTOR), docstring)
{
}
virtual Value doExecute()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
std::vector<Value> values = getParameterValues();
bool right = values[0].value();
dynamicgraph::Vector center = values[1].value();
dynamicgraph::Vector thumbAxis = values[2].value();
dynamicgraph::Vector forefingerAxis = values[3].value();
dynamicgraph::Vector palmNormalAxis = values[4].value();
robot.setHandParameters(right, center, thumbAxis, forefingerAxis,
palmNormalAxis);
return Value();
}
}; // class SetHandParameters
// Command SetFootParameters
class SetFootParameters : public Command
// Command SetLowerPositionLimit
class SetLowerPositionLimit : public Command
{
public:
virtual ~SetFootParameters() {}
virtual ~SetLowerPositionLimit() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
SetFootParameters(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::BOOL)(Value::DOUBLE)
(Value::DOUBLE)(Value::VECTOR), docstring)
SetLowerPositionLimit(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING)(Value::VECTOR),
docstring)
{
}
virtual Value doExecute()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
std::vector<Value> values = getParameterValues();
bool right = values[0].value();
double soleLength = values[1].value();
double soleWidth = values[2].value();
dynamicgraph::Vector anklePosition = values[3].value();
robot.setFootParameters(right, soleLength, soleWidth, anklePosition);
std::string jointName = values[0].value();
dg::Vector in_vector = values[1].value();
robot.setLowerPositionLimit(jointName,in_vector);
return Value();
}
}; // class Setfootparameters
}; // class SetLowerPositionLimit
// Command SetGazeParameters
class SetGazeParameters : public Command
// Command SetUpperPositionLimit
class SetUpperPositionLimit : public Command
{
public:
virtual ~SetGazeParameters() {}
virtual ~SetUpperPositionLimit() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
SetGazeParameters(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::VECTOR)(Value::VECTOR),
SetUpperPositionLimit(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING)(Value::VECTOR),
docstring)
{
}
......@@ -425,114 +287,64 @@ namespace dynamicgraph { namespace sot {
{
Dynamic& robot = static_cast<Dynamic&>(owner());
std::vector<Value> values = getParameterValues();
dynamicgraph::Vector gazeOrigin = values[0].value();
dynamicgraph::Vector gazeDirection = values[1].value();
robot.setGazeParameters(gazeOrigin, gazeDirection);
std::string jointName = values[0].value();
dg::Vector in_vector = values[1].value();
robot.setUpperPositionLimit(jointName,in_vector);
return Value();
}
}; // class SetGazeParameters
}; // class SetUpperPositionLimit
// Command InitializeRobot
class InitializeRobot : public Command
// Command SetMaxVelocityLimit
class SetMaxVelocityLimit : public Command
{
public:
virtual ~InitializeRobot() {}
virtual ~SetMaxVelocityLimit() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
InitializeRobot(Dynamic& entity, const std::string& docstring) :
Command(entity, std::vector<Value::Type>(),
SetMaxVelocityLimit(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING)(Value::VECTOR),
docstring)
{
}
virtual Value doExecute()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
robot.m_HDR->initialize();
std::vector<Value> values = getParameterValues();
std::string jointName = values[0].value();
dg::Vector in_vector = values[1].value();
robot.setMaxVelocityLimit(jointName,in_vector);
return Value();
}
}; // class InitializeRobot
}; // class SetMaxVelocityLimit
// Command GetDimension
class GetDimension : public Command
{
public:
virtual ~GetDimension() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
GetDimension(Dynamic& entity, const std::string& docstring) :
Command(entity, std::vector<Value::Type>(),
docstring)
{
}
virtual Value doExecute()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
unsigned int dimension = robot.m_HDR->numberDof();
return Value(dimension);
}
}; // class GetDimension
// Command Write
class Write : public Command
// Command SetMaxEffortLimit
class SetMaxEffortLimit : public Command
{
public:
virtual ~Write() {}
virtual ~SetMaxEffortLimit() {}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
Write(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING),
docstring)
SetMaxEffortLimit(Dynamic& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::STRING)(Value::VECTOR),
docstring)
{
}
virtual Value doExecute()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
std::vector<Value> values = getParameterValues();
std::string filename = values[0].value();
std::ofstream file(filename.c_str(), std::ios_base::out);
file << *(robot.m_HDR);
file.close();
std::string jointName = values[0].value();
dg::Vector in_vector = values[1].value();
robot.setMaxEffortLimit(jointName,in_vector);
return Value();
}
}; // class Write
}; // class SetMaxEffortLimit
class GetHandParameter : public Command
{
public:
virtual ~GetHandParameter () {}
GetHandParameter (Dynamic& entity, const std::string& docstring) :
Command (entity, boost::assign::list_of(Value::BOOL), docstring)
{
}
virtual Value doExecute ()
{
Dynamic& robot = static_cast<Dynamic&>(owner());
std::vector<Value> values = getParameterValues();
bool right = values [0].value ();
dynamicgraph::Matrix handParameter (4,4);
handParameter.setIdentity ();
CjrlHand* hand;
if (right) hand = robot.m_HDR->rightHand ();
else hand = robot.m_HDR->leftHand ();
jrlMathTools::Vector3D<double> axis;
hand->getThumbAxis (axis);
for (unsigned int i=0; i<3; i++)
handParameter (i,0) = axis (i);
hand->getForeFingerAxis (axis);
for (unsigned int i=0; i<3; i++)
handParameter (i,1) = axis (i);
hand->getPalmNormal (axis);
for (unsigned int i=0; i<3; i++)
handParameter (i,2) = axis (i);
hand->getCenter (axis);
for (unsigned int i=0; i<3; i++)
handParameter (i,3) = axis (i);
return Value (handParameter);
}
}; // class GetHandParameter
} // namespace command
} /* namespace sot */} /* namespace dynamicgraph */
......
from dynamic import Dynamic
from angle_estimator import AngleEstimator
from zmp_from_forces import ZmpFromForces
DynamicOld = Dynamic
#class Dynamic (DynamicOld):
# def __init__(self):
# def getPinocchioModel():
......@@ -23,8 +23,8 @@
#include <map>
#include <sot-dynamic/matrix-inertia.h>
#include <jrl/dynamics/Joint.h>
#include <jrl/dynamics/HumanoidDynamicMultiBody.h>
//#include <jrl/dynamics/Joint.h>
//#include <jrl/dynamics/HumanoidDynamicMultiBody.h>
#include <abstract-robot-dynamics/robot-dynamics-object-constructor.hh>
#include <sot/core/debug.hh>
......
This diff is collapsed.
......@@ -16,23 +16,29 @@
ADD_DEFINITIONS(-DDEBUG=2)
SET(tests
dummy
test_djj
test_dyn
test_results)
dev_test_all_compute
# dummy
# test_djj
# test_dyn
# test_results