Commit 861942e5 authored by Noëlie Ramuzat's avatar Noëlie Ramuzat Committed by Olivier Stasse
Browse files

[tools] Moved common-py.cpp to robot-utils-py.cpp

Added robot-utils-py.cpp in sot-core from common-py.cpp of sot-torque-control

Complete the moving of "common" to "robot_utils" by moving the python wrapper
Changing the CMakeLists accordingly.
parent 27537022
......@@ -100,15 +100,12 @@ SET(${LIBRARY_NAME}_HEADERS
include/sot/torque_control/control-manager.hh
include/sot/torque_control/current-controller.hh
include/sot/torque_control/commands-helper.hh
include/sot/torque_control/signal-helper.hh
include/sot/torque_control/common.hh
include/sot/torque_control/madgwickahrs.hh
include/sot/torque_control/device-torque-ctrl.hh
include/sot/torque_control/trace-player.hh
include/sot/torque_control/torque-offset-estimator.hh
include/sot/torque_control/imu_offset_compensation.hh
include/sot/torque_control/admittance-controller.hh
include/sot/torque_control/utils/logger.hh
include/sot/torque_control/utils/trajectory-generators.hh
include/sot/torque_control/utils/lin-estimator.hh
include/sot/torque_control/utils/poly-estimator.hh
......@@ -124,7 +121,6 @@ SET(${LIBRARY_NAME}_HEADERS
# PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)
SET(${LIBRARY_NAME}_SOURCES ${${LIBRARY_NAME}_HEADERS}
src/logger.cpp
src/trajectory-generators.cpp
src/lin-estimator.cpp
src/poly-estimator.cpp
......@@ -132,7 +128,6 @@ SET(${LIBRARY_NAME}_SOURCES ${${LIBRARY_NAME}_HEADERS}
src/causal-filter.cpp
src/stop-watch.cpp
src/motor-model.cpp
src/common.cpp
)
......@@ -194,13 +189,9 @@ ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(unitTesting)
# *****************************
# Common-sot-py PYTHON module *
# PYTHON interface *
# *****************************
IF(BUILD_PYTHON_INTERFACE)
PYTHON_ADD_MODULE(common_sot_py src/common-py.cpp)
TARGET_LINK_LIBRARIES(common_sot_py ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${LIBRARY_NAME})
TARGET_LINK_BOOST_PYTHON(common_sot_py)
INSTALL(TARGETS common_sot_py DESTINATION ${PYTHON_INSTALL_DIR})
IF(TALOS_DATA_FOUND)
FOREACH(py_filename test_torque_offset_estimator)
......
/*
* Copyright 2017, A. Del Prete, T. Flayols, O. Stasse, LAAS-CNRS
*
* This file is part of sot-torque-control.
* sot-torque-control is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
* sot-torque-control is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. You should
* have received a copy of the GNU Lesser General Public License along
* with sot-torque-control. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sot/torque_control/common.hh>
#include <boost/python.hpp>
#include <boost/python/suite/indexing/map_indexing_suite.hpp>
using namespace boost::python;
using namespace dynamicgraph::sot::torque_control;
BOOST_PYTHON_MODULE(common_sot_py)
{
class_<JointLimits>
("JointLimits",init<double,double>())
.def_readwrite("upper",&JointLimits::upper)
.def_readwrite("lower",&JointLimits::lower)
;
class_<ForceLimits>("ForceLimits",init<const Eigen::VectorXd &,const Eigen::VectorXd &>())
.def("display",&ForceLimits::display)
.def_readwrite("upper",&ForceLimits::upper)
.def_readwrite("lower",&ForceLimits::lower)
;
class_<ForceUtil>("ForceUtil")
.def("set_name_to_force_id", &ForceUtil::set_name_to_force_id)
.def("set_force_id_to_limits", &ForceUtil::set_force_id_to_limits)
.def("create_force_id_to_name_map",&ForceUtil::create_force_id_to_name_map)
.def("get_id_from_name", &ForceUtil::get_id_from_name)
.def("get_name_from_id", &ForceUtil::cp_get_name_from_id)
.def("get_limits_from_id", &ForceUtil::cp_get_limits_from_id)
.def("get_force_id_left_hand", &ForceUtil::get_force_id_left_hand)
.def("set_force_id_left_hand", &ForceUtil::set_force_id_left_hand)
.def("get_force_id_right_hand", &ForceUtil::get_force_id_right_hand)
.def("set_force_id_right_hand", &ForceUtil::set_force_id_right_hand)
.def("get_force_id_left_foot", &ForceUtil::get_force_id_left_foot)
.def("set_force_id_left_foot", &ForceUtil::set_force_id_left_foot)
.def("get_force_id_right_foot", &ForceUtil::get_force_id_right_foot)
.def("set_force_id_right_foot", &ForceUtil::set_force_id_right_foot)
.def("display", &ForceUtil::display)
;
class_<RobotUtil>("RobotUtil")
.def_readwrite("m_force_util",&RobotUtil::m_force_util)
.def_readwrite("m_foot_util",&RobotUtil::m_foot_util)
.def_readwrite("m_urdf_to_sot",&RobotUtil::m_urdf_to_sot)
.def_readonly("m_nbJoints",&RobotUtil::m_nbJoints)
.def_readwrite("m_name_to_id",&RobotUtil::m_name_to_id)
.def_readwrite("m_id_to_name",&RobotUtil::m_id_to_name)
.def("set_joint_limits_for_id",&RobotUtil::set_joint_limits_for_id)
.def("get_joint_limits_from_id",&RobotUtil::cp_get_joint_limits_from_id)
//.def("set_joint_limits_for_id",&RobotUtil::set_joint_limits_for_id)
//.def("set_name_to_id", &RobotUtil::set_name_to_id)
//.def("create_id_to_name_map",&RobotUtil::create_id_to_name_map)
//.def("get_id_from_name",&RobotUtil::get_id_from_name)
;
class_<std::map<Index,ForceLimits> >("IndexForceLimits")
.def(map_indexing_suite<std::map<Index,ForceLimits> > ());
class_<std::map<std::string,Index> >("stringIndex")
.def(map_indexing_suite<std::map<std::string,Index> > ());
class_<std::map<Index,std::string> >("Indexstring")
.def(map_indexing_suite<std::map<Index,std::string> > ());
}
Supports Markdown
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