GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/tools/robot-utils-py.cpp Lines: 0 40 0.0 %
Date: 2023-03-13 12:09:37 Branches: 0 70 0.0 %

Line Branch Exec Source
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 <pinocchio/fwd.hpp>
9
// keep pinocchio before boost
10
11
#include <boost/property_tree/ptree.hpp>
12
#include <boost/python.hpp>
13
#include <boost/python/suite/indexing/map_indexing_suite.hpp>
14
#include <sot/core/robot-utils.hh>
15
16
using namespace boost::python;
17
using namespace dynamicgraph::sot;
18
19
BOOST_PYTHON_MODULE(robot_utils_sot_py) {
20
  class_<JointLimits>("JointLimits", init<double, double>())
21
      .def_readwrite("upper", &JointLimits::upper)
22
      .def_readwrite("lower", &JointLimits::lower);
23
24
  class_<ForceLimits>("ForceLimits",
25
                      init<const Eigen::VectorXd &, const Eigen::VectorXd &>())
26
      .def("display", &ForceLimits::display)
27
      .def_readwrite("upper", &ForceLimits::upper)
28
      .def_readwrite("lower", &ForceLimits::lower);
29
30
  class_<ForceUtil>("ForceUtil")
31
      .def("set_name_to_force_id", &ForceUtil::set_name_to_force_id)
32
      .def("set_force_id_to_limits", &ForceUtil::set_force_id_to_limits)
33
      .def("create_force_id_to_name_map",
34
           &ForceUtil::create_force_id_to_name_map)
35
      .def("get_id_from_name", &ForceUtil::get_id_from_name)
36
      .def("get_name_from_id", &ForceUtil::cp_get_name_from_id)
37
      .def("get_limits_from_id", &ForceUtil::cp_get_limits_from_id)
38
      .def("get_force_id_left_hand", &ForceUtil::get_force_id_left_hand)
39
      .def("set_force_id_left_hand", &ForceUtil::set_force_id_left_hand)
40
      .def("get_force_id_right_hand", &ForceUtil::get_force_id_right_hand)
41
      .def("set_force_id_right_hand", &ForceUtil::set_force_id_right_hand)
42
      .def("get_force_id_left_foot", &ForceUtil::get_force_id_left_foot)
43
      .def("set_force_id_left_foot", &ForceUtil::set_force_id_left_foot)
44
      .def("get_force_id_right_foot", &ForceUtil::get_force_id_right_foot)
45
      .def("set_force_id_right_foot", &ForceUtil::set_force_id_right_foot)
46
      .def("display", &ForceUtil::display);
47
48
  class_<RobotUtil>("RobotUtil")
49
      .def_readwrite("m_force_util", &RobotUtil::m_force_util)
50
      .def_readwrite("m_foot_util", &RobotUtil::m_foot_util)
51
      .def_readwrite("m_urdf_to_sot", &RobotUtil::m_urdf_to_sot)
52
      .def_readonly("m_nbJoints", &RobotUtil::m_nbJoints)
53
      .def_readwrite("m_name_to_id", &RobotUtil::m_name_to_id)
54
      .def_readwrite("m_id_to_name", &RobotUtil::m_id_to_name)
55
      .def("set_joint_limits_for_id", &RobotUtil::set_joint_limits_for_id)
56
      .def("get_joint_limits_from_id", &RobotUtil::cp_get_joint_limits_from_id)
57
      //.def("set_joint_limits_for_id",&RobotUtil::set_joint_limits_for_id)
58
      //.def("set_name_to_id", &RobotUtil::set_name_to_id)
59
      //.def("create_id_to_name_map",&RobotUtil::create_id_to_name_map)
60
      //.def("get_id_from_name",&RobotUtil::get_id_from_name)
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
}