hpp-python  9.0.2
python bindings for HPP, based on boost python
device.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2025, CNRS
3 // Authors: Florent Lamiraux
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions
7 // are met:
8 
9 // 1. Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 
12 // 2. Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following
14 // disclaimer in the documentation and/or other materials provided
15 // with the distribution.
16 
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 // COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28 // OF THE POSSIBILITY OF SUCH DAMAGE.
29 
30 #ifndef PYHPP_MANIPULATION_DEVICE_HH
31 #define PYHPP_MANIPULATION_DEVICE_HH
32 
33 #include <../src/pyhpp/pinocchio/device.hh>
35 #include <hpp/manipulation/device.hh>
37 #include <hpp/pinocchio/device.hh>
38 #include <hpp/pinocchio/frame.hh>
39 #include <hpp/pinocchio/gripper.hh>
40 #include <hpp/pinocchio/joint.hh>
41 #include <pinocchio/multibody/data.hpp>
42 #include <pinocchio/multibody/geometry.hpp>
43 #include <pinocchio/spatial/se3.hpp>
45 
46 namespace pyhpp {
47 namespace manipulation {
48 
74 
75 struct modelsInfo {
76  std::string urdfPath;
77  std::string srdfPath;
78  std::string prefix;
80 
81  bool operator==(const modelsInfo& other) const {
82  return urdfPath == other.urdfPath && srdfPath == other.srdfPath &&
83  prefix == other.prefix && pose == other.pose;
84  }
85 };
86 
87 // Wrapper class to hpp::manipulation::Device
88 //
89 // Boost python does not correctly handle weak pointers. To overcome this
90 // limitation, we create a wrapper class and bind this class with boost python
91 // instead of the original class.
93  Device(const std::string& name);
94 
95  void setRobotRootPosition(const std::string& robotName,
96  const Transform3s& positionWRTParentJoint);
97  std::map<std::string, HandlePtr_t> handles();
98  std::map<std::string, GripperPtr_t> grippers();
99 
100  std::vector<modelsInfo> models_info_;
101  std::vector<modelsInfo>& getModelsInfo() { return models_info_; }
102 
103  boost::python::list getJointConfig(const char* jointName);
104  boost::python::list getJointNames();
105  void setJointBounds(const char* jointName, boost::python::list jointBounds);
106  boost::python::list contactSurfaceNames();
107  boost::python::dict contactSurfaces();
108  void addHandle(const std::string& linkName, const std::string& handleName,
109  const Transform3s& pose, value_type clearance,
110  const std::vector<bool>& mask);
111  void addGripper(const std::string& linkName, const std::string& gripperName,
112  const Transform3s& pose, value_type clearance);
113 }; // struct Device
114 } // namespace manipulation
115 } // namespace pyhpp
116 #endif // PYHPP_MANIPULATION_DEVICE_HH
const std::string & name() const
void addGripper(const GripperPtr_t &gripper)
pinocchio::value_type value_type
pinocchio::Transform3s Transform3s
shared_ptr< Device > DevicePtr_t
shared_ptr< Handle > HandlePtr_t
shared_ptr< Device > DevicePtr_t
::pinocchio::DataTpl< value_type, 0, ::pinocchio::JointCollectionDefaultTpl > Data
shared_ptr< Joint > JointPtr_t
::pinocchio::GeometryData GeomData
Eigen::Matrix< value_type, Eigen::Dynamic, 1 > vector_t
::pinocchio::FrameIndex FrameIndex
Eigen::Matrix< value_type, 3, 1 > vector3_t
shared_ptr< LiegroupSpace > LiegroupSpacePtr_t
matrix_t::Index size_type
::pinocchio::SE3 Transform3s
vector_t Configuration_t
::pinocchio::JointIndex JointIndex
::pinocchio::GeometryModel GeomModel
::pinocchio::ModelTpl< value_type, 0, ::pinocchio::JointCollectionDefaultTpl > Model
shared_ptr< Gripper > GripperPtr_t
shared_ptr< Model > ModelPtr_t
::pinocchio::SE3 SE3
Eigen::Ref< const Configuration_t > ConfigurationIn_t
hpp::pinocchio::GeomModel GeomModel
Definition: device.hh:54
hpp::pinocchio::DevicePtr_t PinDevicePtr_t
Definition: device.hh:68
hpp::pinocchio::GeomData GeomData
Definition: device.hh:52
hpp::pinocchio::Joint Joint
Definition: device.hh:71
hpp::pinocchio::vector_t vector_t
Definition: device.hh:57
hpp::pinocchio::ModelPtr_t ModelPtr_t
Definition: device.hh:51
hpp::manipulation::Handle Handle
Definition: device.hh:66
hpp::manipulation::DevicePtr_t DevicePtr_t
Definition: device.hh:67
hpp::pinocchio::Computation_t Computation_t
Definition: device.hh:64
hpp::pinocchio::LiegroupSpacePtr_t LiegroupSpacePtr_t
Definition: device.hh:53
hpp::pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: device.hh:56
hpp::pinocchio::Model Model
Definition: device.hh:49
hpp::pinocchio::Transform3s Transform3s
Definition: device.hh:61
hpp::pinocchio::JointPtr_t JointPtr_t
Definition: device.hh:73
hpp::pinocchio::Configuration_t Configuration_t
Definition: device.hh:55
hpp::manipulation::HandlePtr_t HandlePtr_t
Definition: device.hh:65
hpp::pinocchio::vector3_t vector3_t
Definition: device.hh:58
hpp::pinocchio::Gripper Gripper
Definition: device.hh:63
hpp::pinocchio::GripperPtr_t GripperPtr_t
Definition: device.hh:62
hpp::pinocchio::FrameIndex FrameIndex
Definition: device.hh:70
hpp::pinocchio::JointIndex JointIndex
Definition: device.hh:72
hpp::pinocchio::value_type value_type
Definition: device.hh:60
hpp::pinocchio::Data Data
Definition: device.hh:50
hpp::pinocchio::Frame Frame
Definition: device.hh:69
hpp::pinocchio::size_type size_type
Definition: device.hh:59
Definition: fwd.hh:35
std::map< std::string, GripperPtr_t > grippers()
std::vector< modelsInfo > models_info_
Definition: device.hh:100
std::map< std::string, HandlePtr_t > handles()
std::vector< modelsInfo > & getModelsInfo()
Definition: device.hh:101
Device(const std::string &name)
void setRobotRootPosition(const std::string &robotName, const Transform3s &positionWRTParentJoint)
Definition: device.hh:75
bool operator==(const modelsInfo &other) const
Definition: device.hh:81
std::string srdfPath
Definition: device.hh:77
std::string urdfPath
Definition: device.hh:76
std::string prefix
Definition: device.hh:78
hpp::pinocchio::SE3 pose
Definition: device.hh:79