Commit 377002ae authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

Update for dynamic-graph-python v4

parent a6639c46
......@@ -48,21 +48,21 @@ ENDIF(INITIALIZE_WITH_NAN)
ADD_PROJECT_DEPENDENCY(sot-core REQUIRED PKG_CONFIG_REQUIRES sot-core)
ADD_PROJECT_DEPENDENCY(tsid REQUIRED PKG_CONFIG_REQUIRES tsid)
ADD_PROJECT_DEPENDENCY(ddp-actuator-solver REQUIRED PKG_CONFIG_REQUIRES ddp-actuator-solver)
ADD_REQUIRED_DEPENDENCY("parametric-curves")
ADD_PROJECT_DEPENDENCY(parametric-curves REQUIRED)
ADD_REQUIRED_DEPENDENCY("simple_humanoid_description")
SET(BOOST_COMPONENTS filesystem system thread program_options
unit_test_framework regex)
IF(BUILD_TESTING)
FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)
ENDIF(BUILD_TESTING)
IF(BUILD_PYTHON_INTERFACE)
FINDPYTHON()
SEARCH_FOR_BOOST_PYTHON(REQUIRED)
STRING(REGEX REPLACE "-" "_" PYTHON_DIR ${CUSTOM_HEADER_DIR})
ADD_PROJECT_DEPENDENCY(dynamic-graph-python REQUIRED
PKG_CONFIG_REQUIRES dynamic-graph-python)
SET(BOOST_COMPONENTS ${BOOST_COMPONENTS} python)
ENDIF(BUILD_PYTHON_INTERFACE)
SEARCH_FOR_BOOST()
# Main Library
SET(${PROJECT_NAME}_HEADERS
include/${CUSTOM_HEADER_DIR}/joint-torque-controller.hh
......@@ -102,7 +102,7 @@ SET(${PROJECT_NAME}_SOURCES
ADD_LIBRARY(${PROJECT_NAME} SHARED
${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES}
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC
tsid::tsid sot-core::sot-core ddp-actuator-solver::ddp-actuator-solver)
IF(SUFFIX_SO_VERSION)
......
Subproject commit fb4c22c319ec5320f9a85527eb1a4130954846f5
Subproject commit 9dcde03a880cccc86531019a6845708f5c54c35d
......@@ -33,7 +33,7 @@ FOREACH(file ${${PROJECT_NAME}_PYTHON_IDENTIFICATION})
ENDFOREACH(file ${${PROJECT_NAME}_PYTHON_IDENTIFICATION})
FOREACH(file ${${PROJECT_NAME}_PYTHON_UTILS})
PYTHON_INSTALL_ON_SITE("dynamic_graph/${PYTHON_DIR}/utils"${file})
PYTHON_INSTALL_ON_SITE("dynamic_graph/${PYTHON_DIR}/utils" ${file})
ENDFOREACH(file ${${PROJECT_NAME}_PYTHON_UTILS})
FOREACH(file ${${PROJECT_NAME}_PYTHON_TESTS})
......
import numpy
import numpy as np
class initRobotData:
......@@ -76,7 +76,7 @@ class initRobotData:
28: [-1.6057, 1.6057],
}
fMax = numpy.array([100.0, 100.0, 300.0, 80.0, 80.0, 30.0])
fMax = np.array([100.0, 100.0, 300.0, 80.0, 80.0, 30.0])
fMin = -fMax
mapForceIdToForceLimits = {0: [fMin, fMax], 1: [fMin, fMax], 2: [fMin, fMax], 3: [fMin, fMax]}
......@@ -102,18 +102,18 @@ class initRobotData:
# Set the force limits for each id
for key in self.mapForceIdToForceLimits:
cm.setForceLimitsFromId(key, tuple(self.mapForceIdToForceLimits[key][0]),
tuple(self.mapForceIdToForceLimits[key][1]))
cm.setForceLimitsFromId(key, np.array(self.mapForceIdToForceLimits[key][0]),
np.array(self.mapForceIdToForceLimits[key][1]))
# Set the force sensor id for each sensor name
for key in self.mapNameToForceId:
cm.setForceNameToForceId(key, self.mapNameToForceId[key])
# Set the map from the urdf joint list to the sot joint list
cm.setJointsUrdfToSot(self.urdftosot)
cm.setJointsUrdfToSot(np.array(self.urdftosot))
# Set the foot frame name
for key in self.FootFrameNames:
cm.setFootFrameName(key, self.FootFrameNames[key])
cm.setRightFootSoleXYZ(self.RightFootSensorXYZ)
cm.setRightFootSoleXYZ(np.array(self.RightFootSensorXYZ))
import numpy
import numpy as np
class initRobotData:
......@@ -76,7 +76,7 @@ class initRobotData:
28: [-1.6057, 1.6057],
}
fMax = numpy.array([100.0, 100.0, 300.0, 80.0, 80.0, 30.0])
fMax = np.array([100.0, 100.0, 300.0, 80.0, 80.0, 30.0])
fMin = -fMax
mapForceIdToForceLimits = {0: [fMin, fMax], 1: [fMin, fMax], 2: [fMin, fMax], 3: [fMin, fMax]}
......@@ -102,18 +102,18 @@ class initRobotData:
# Set the force limits for each id
for key in self.mapForceIdToForceLimits:
cm.setForceLimitsFromId(key, tuple(self.mapForceIdToForceLimits[key][0]),
tuple(self.mapForceIdToForceLimits[key][1]))
cm.setForceLimitsFromId(key, np.array(self.mapForceIdToForceLimits[key][0]),
np.array(self.mapForceIdToForceLimits[key][1]))
# Set the force sensor id for each sensor name
for key in self.mapNameToForceId:
cm.setForceNameToForceId(key, self.mapNameToForceId[key])
# Set the map from the urdf joint list to the sot joint list
cm.setJointsUrdfToSot(self.urdftosot)
cm.setJointsUrdfToSot(np.array(self.urdftosot))
# Set the foot frame name
for key in self.FootFrameNames:
cm.setFootFrameName(key, self.FootFrameNames[key])
cm.setRightFootSoleXYZ(self.RightFootSensorXYZ)
cm.setRightFootSoleXYZ(np.array(self.RightFootSensorXYZ))
from dynamic_graph.sot.torque_control.control_manager import ControlManager
from dynamic_graph.sot.torque_control.tests.robot_data_test import initRobotData
from numpy import ones, zeros
from numpy import array, ones, zeros
# Instanciate the free flyer
cm = ControlManager("cm_test")
......@@ -36,6 +36,7 @@ cm.addCtrlMode("pos")
# Add torque mode
cm.addCtrlMode("torque")
cm.ctrl_torque.value = currentDes
cm.ctrl_pos.value = pwmDes
cm.setCtrlMode("all", "pos")
# TODO ctrl_* non working yet
# cm.ctrl_torque.value = array(currentDes)
# cm.ctrl_pos.value = pwmDes
# cm.setCtrlMode("all", "pos")
......@@ -33,7 +33,7 @@ FOREACH(plugin ${plugins})
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
ENDIF(SUFFIX_SO_VERSION)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${PROJECT_NAME} ${${LIBRARY_NAME}_deps})
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} PUBLIC ${PROJECT_NAME} ${${LIBRARY_NAME}_deps})
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
INSTALL(TARGETS ${LIBRARY_NAME} EXPORT ${TARGETS_EXPORT_NAME}
......@@ -43,14 +43,14 @@ FOREACH(plugin ${plugins})
IF(BUILD_PYTHON_INTERFACE)
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${LIBRARY_NAME})
DYNAMIC_GRAPH_PYTHON_MODULE("${PYTHON_DIR}/${PYTHON_LIBRARY_NAME}"
${LIBRARY_NAME} ${PROJECT_NAME}-${PYTHON_LIBRARY_NAME}-wrap)
${LIBRARY_NAME} ${PROJECT_NAME}-${PYTHON_LIBRARY_NAME}-wrap
MODULE_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/${plugin}-python.hh")
ENDIF(BUILD_PYTHON_INTERFACE)
ENDFOREACH(plugin)
IF(BUILD_PYTHON_INTERFACE)
SET(NO_INSTALL_OF_INIT_PY 0)
DYNAMIC_GRAPH_PYTHON_MODULE(${PYTHON_DIR} ${PROJECT_NAME} wrap
${NO_INSTALL_OF_INIT_PY})
#SET(NO_INSTALL_OF_INIT_PY 0)
#DYNAMIC_GRAPH_PYTHON_MODULE(${PYTHON_DIR} ${PROJECT_NAME} wrap ${NO_INSTALL_OF_INIT_PY})
# Install empty __init__.py files in intermediate directories.
INSTALL(FILES
......
#include "sot/torque_control/admittance-controller.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::AdmittanceController > entities_t;
#include "sot/torque_control/base-estimator.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::BaseEstimator > entities_t;
#include "sot/torque_control/control-manager.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::ControlManager > entities_t;
#include "sot/torque_control/current-controller.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::CurrentController > entities_t;
#include "sot/torque_control/device-torque-ctrl.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::DeviceTorqueCtrl > entities_t;
#include "sot/torque_control/free-flyer-locator.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::FreeFlyerLocator > entities_t;
#include "sot/torque_control/imu_offset_compensation.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::ImuOffsetCompensation > entities_t;
#include "sot/torque_control/inverse-dynamics-balance-controller.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::InverseDynamicsBalanceController > entities_t;
#include "sot/torque_control/joint-torque-controller.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::JointTorqueController > entities_t;
#include "sot/torque_control/joint-trajectory-generator.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::JointTrajectoryGenerator > entities_t;
#include "sot/torque_control/numerical-difference.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::NumericalDifference > entities_t;
#include "sot/torque_control/position-controller.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::PositionController > entities_t;
#include "sot/torque_control/se3-trajectory-generator.hh"
typedef boost::mpl::vector< dynamicgraph::sot::torque_control::SE3TrajectoryGenerator > entities_t;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment