|
| 1 | +/* |
| 2 | + * Copyright 2017, A. Del Prete, T. Flayols, O. Stasse, LAAS-CNRS |
| 3 | + * |
| 4 | + * This file is part of sot-core. |
| 5 | + * See license file. |
| 6 | + */ |
| 7 | + |
| 8 | +#include <sot/core/robot-utils.hh> |
| 9 | +#include <boost/python.hpp> |
| 10 | +#include <boost/python/suite/indexing/map_indexing_suite.hpp> |
| 11 | +using namespace boost::python; |
| 12 | +using namespace dynamicgraph::sot; |
| 13 | + |
| 14 | + |
| 15 | +BOOST_PYTHON_MODULE(robot_utils_sot_py) |
| 16 | +{ |
| 17 | + class_<JointLimits> |
| 18 | + ("JointLimits",init<double,double>()) |
| 19 | + .def_readwrite("upper",&JointLimits::upper) |
| 20 | + .def_readwrite("lower",&JointLimits::lower) |
| 21 | + ; |
| 22 | + |
| 23 | + class_<ForceLimits>("ForceLimits",init<const Eigen::VectorXd &,const Eigen::VectorXd &>()) |
| 24 | + .def("display",&ForceLimits::display) |
| 25 | + .def_readwrite("upper",&ForceLimits::upper) |
| 26 | + .def_readwrite("lower",&ForceLimits::lower) |
| 27 | + ; |
| 28 | + |
| 29 | + class_<ForceUtil>("ForceUtil") |
| 30 | + .def("set_name_to_force_id", &ForceUtil::set_name_to_force_id) |
| 31 | + .def("set_force_id_to_limits", &ForceUtil::set_force_id_to_limits) |
| 32 | + .def("create_force_id_to_name_map",&ForceUtil::create_force_id_to_name_map) |
| 33 | + .def("get_id_from_name", &ForceUtil::get_id_from_name) |
| 34 | + .def("get_name_from_id", &ForceUtil::cp_get_name_from_id) |
| 35 | + .def("get_limits_from_id", &ForceUtil::cp_get_limits_from_id) |
| 36 | + .def("get_force_id_left_hand", &ForceUtil::get_force_id_left_hand) |
| 37 | + .def("set_force_id_left_hand", &ForceUtil::set_force_id_left_hand) |
| 38 | + .def("get_force_id_right_hand", &ForceUtil::get_force_id_right_hand) |
| 39 | + .def("set_force_id_right_hand", &ForceUtil::set_force_id_right_hand) |
| 40 | + .def("get_force_id_left_foot", &ForceUtil::get_force_id_left_foot) |
| 41 | + .def("set_force_id_left_foot", &ForceUtil::set_force_id_left_foot) |
| 42 | + .def("get_force_id_right_foot", &ForceUtil::get_force_id_right_foot) |
| 43 | + .def("set_force_id_right_foot", &ForceUtil::set_force_id_right_foot) |
| 44 | + .def("display", &ForceUtil::display) |
| 45 | + ; |
| 46 | + |
| 47 | + class_<RobotUtil>("RobotUtil") |
| 48 | + .def_readwrite("m_force_util",&RobotUtil::m_force_util) |
| 49 | + .def_readwrite("m_foot_util",&RobotUtil::m_foot_util) |
| 50 | + .def_readwrite("m_urdf_to_sot",&RobotUtil::m_urdf_to_sot) |
| 51 | + .def_readonly("m_nbJoints",&RobotUtil::m_nbJoints) |
| 52 | + .def_readwrite("m_name_to_id",&RobotUtil::m_name_to_id) |
| 53 | + .def_readwrite("m_id_to_name",&RobotUtil::m_id_to_name) |
| 54 | + .def("set_joint_limits_for_id",&RobotUtil::set_joint_limits_for_id) |
| 55 | + .def("get_joint_limits_from_id",&RobotUtil::cp_get_joint_limits_from_id) |
| 56 | + //.def("set_joint_limits_for_id",&RobotUtil::set_joint_limits_for_id) |
| 57 | + //.def("set_name_to_id", &RobotUtil::set_name_to_id) |
| 58 | + //.def("create_id_to_name_map",&RobotUtil::create_id_to_name_map) |
| 59 | + //.def("get_id_from_name",&RobotUtil::get_id_from_name) |
| 60 | + ; |
| 61 | + |
| 62 | + |
| 63 | + class_<std::map<Index,ForceLimits> >("IndexForceLimits") |
| 64 | + .def(map_indexing_suite<std::map<Index,ForceLimits> > ()); |
| 65 | + |
| 66 | + class_<std::map<std::string,Index> >("stringIndex") |
| 67 | + .def(map_indexing_suite<std::map<std::string,Index> > ()); |
| 68 | + |
| 69 | + class_<std::map<Index,std::string> >("Indexstring") |
| 70 | + .def(map_indexing_suite<std::map<Index,std::string> > ()); |
| 71 | + |
| 72 | +} |
0 commit comments