hpp-python: src/pyhpp/manipulation/device.hh Source File

hpp-python 9.0.2 python bindings for HPP, based on boost python |

Loading...
Searching...
No Matches
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>
34#include <hpp/constraints/implicit.hh>
35#include <hpp/manipulation/device.hh>
36#include <hpp/manipulation/handle.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>
44#include <pyhpp/manipulation/fwd.hh>
45
46namespace pyhpp {
47namespace manipulation {
48
49 typedef hpp::pinocchio::Model Model;
50 typedef hpp::pinocchio::Data Data;
51 typedef hpp::pinocchio::ModelPtr_t ModelPtr_t;
52 typedef hpp::pinocchio::GeomData GeomData;
53 typedef hpp::pinocchio::LiegroupSpacePtr_t LiegroupSpacePtr_t;
54 typedef hpp::pinocchio::GeomModel GeomModel;
55 typedef hpp::pinocchio::Configuration_t Configuration_t;
56 typedef hpp::pinocchio::ConfigurationIn_t ConfigurationIn_t;
57 typedef hpp::pinocchio::vector_t vector_t;
58 typedef hpp::pinocchio::vector3_t vector3_t;
59 typedef hpp::pinocchio::size_type size_type;
60 typedef hpp::pinocchio::value_type value_type;
61 typedef hpp::pinocchio::Transform3s Transform3s;
62 typedef hpp::pinocchio::GripperPtr_t GripperPtr_t;
63 typedef hpp::pinocchio::Gripper Gripper;
64 typedef hpp::pinocchio::Computation_t Computation_t;
65 typedef hpp::manipulation::HandlePtr_t HandlePtr_t;
66 typedef hpp::manipulation::Handle Handle;
67 typedef hpp::manipulation::DevicePtr_t DevicePtr_t;
68 typedef hpp::pinocchio::DevicePtr_t PinDevicePtr_t;
69 typedef hpp::pinocchio::Frame Frame;
70 typedef hpp::pinocchio::FrameIndex FrameIndex;
71 typedef hpp::pinocchio::Joint Joint;
72 typedef hpp::pinocchio::JointIndex JointIndex;
73 typedef hpp::pinocchio::JointPtr_t JointPtr_t;
74
75 struct modelsInfo {
76 std::string urdfPath;
77 std::string srdfPath;
78 std::string prefix;
79 hpp::pinocchio::SE3 pose;
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.
92 struct Device : public pyhpp::pinocchio::Device {
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
hpp::manipulation::Handle
hpp::pinocchio::Device
hpp::pinocchio::Device::addGripper
void addGripper(const GripperPtr_t &gripper)
hpp::pinocchio::Device::name
const std::string & name() const
hpp::pinocchio::Frame
hpp::pinocchio::Gripper
hpp::pinocchio::Joint
frame.hh
gripper.hh
handle.hh
implicit.hh
joint.hh
fwd.hh
hpp::core::value_type
pinocchio::value_type value_type
hpp::core::vector3_t
pinocchio::vector3_t vector3_t
hpp::core::Transform3s
pinocchio::Transform3s Transform3s
hpp::core::vector_t
pinocchio::vector_t vector_t
hpp::core::JointPtr_t
pinocchio::JointPtr_t JointPtr_t
hpp::core::LiegroupSpacePtr_t
constraints::LiegroupSpacePtr_t LiegroupSpacePtr_t
hpp::core::ConfigurationIn_t
pinocchio::ConfigurationIn_t ConfigurationIn_t
hpp::core::size_type
pinocchio::size_type size_type
hpp::core::Configuration_t
pinocchio::Configuration_t Configuration_t
hpp::core::Joint
pinocchio::Joint Joint
hpp::core::DevicePtr_t
pinocchio::DevicePtr_t DevicePtr_t
hpp::manipulation::GripperPtr_t
pinocchio::GripperPtr_t GripperPtr_t
hpp::manipulation::FrameIndex
pinocchio::FrameIndex FrameIndex
hpp::manipulation::JointIndex
pinocchio::JointIndex JointIndex
hpp::manipulation::DevicePtr_t
shared_ptr< Device > DevicePtr_t
hpp::manipulation::HandlePtr_t
shared_ptr< Handle > HandlePtr_t
hpp::pinocchio::DevicePtr_t
shared_ptr< Device > DevicePtr_t
hpp::pinocchio::Data
::pinocchio::DataTpl< value_type, 0, ::pinocchio::JointCollectionDefaultTpl > Data
hpp::pinocchio::Computation_t
Computation_t
hpp::pinocchio::JointPtr_t
shared_ptr< Joint > JointPtr_t
hpp::pinocchio::GeomData
::pinocchio::GeometryData GeomData
hpp::pinocchio::vector_t
Eigen::Matrix< value_type, Eigen::Dynamic, 1 > vector_t
hpp::pinocchio::FrameIndex
::pinocchio::FrameIndex FrameIndex
hpp::pinocchio::vector3_t
Eigen::Matrix< value_type, 3, 1 > vector3_t
hpp::pinocchio::LiegroupSpacePtr_t
shared_ptr< LiegroupSpace > LiegroupSpacePtr_t
hpp::pinocchio::size_type
matrix_t::Index size_type
hpp::pinocchio::Transform3s
::pinocchio::SE3 Transform3s
hpp::pinocchio::value_type
double value_type
hpp::pinocchio::Configuration_t
vector_t Configuration_t
hpp::pinocchio::JointIndex
::pinocchio::JointIndex JointIndex
hpp::pinocchio::GeomModel
::pinocchio::GeometryModel GeomModel
hpp::pinocchio::Model
::pinocchio::ModelTpl< value_type, 0, ::pinocchio::JointCollectionDefaultTpl > Model
hpp::pinocchio::GripperPtr_t
shared_ptr< Gripper > GripperPtr_t
hpp::pinocchio::ModelPtr_t
shared_ptr< Model > ModelPtr_t
hpp::pinocchio::SE3
::pinocchio::SE3 SE3
hpp::pinocchio::ConfigurationIn_t
Eigen::Ref< const Configuration_t > ConfigurationIn_t
pyhpp::manipulation
Definition fwd.hh:36
pyhpp::manipulation::GeomModel
hpp::pinocchio::GeomModel GeomModel
Definition device.hh:54
pyhpp::manipulation::PinDevicePtr_t
hpp::pinocchio::DevicePtr_t PinDevicePtr_t
Definition device.hh:68
pyhpp::manipulation::GeomData
hpp::pinocchio::GeomData GeomData
Definition device.hh:52
pyhpp::manipulation::ModelPtr_t
hpp::pinocchio::ModelPtr_t ModelPtr_t
Definition device.hh:51
pyhpp::manipulation::Computation_t
hpp::pinocchio::Computation_t Computation_t
Definition device.hh:64
pyhpp::manipulation::Model
hpp::pinocchio::Model Model
Definition device.hh:49
pyhpp::manipulation::Gripper
hpp::pinocchio::Gripper Gripper
Definition device.hh:63
pyhpp::manipulation::Data
hpp::pinocchio::Data Data
Definition device.hh:50
pyhpp::manipulation::Frame
hpp::pinocchio::Frame Frame
Definition device.hh:69
pyhpp
Definition fwd.hh:35
device.hh
pyhpp::manipulation::Device::models_info_
std::vector< modelsInfo > models_info_
Definition device.hh:100
pyhpp::manipulation::Device::handles
std::map< std::string, HandlePtr_t > handles()
pyhpp::manipulation::Device::getModelsInfo
std::vector< modelsInfo > & getModelsInfo()
Definition device.hh:101
pyhpp::manipulation::Device::grippers
std::map< std::string, GripperPtr_t > grippers()
pyhpp::manipulation::Device::Device
Device(const std::string &name)
pyhpp::manipulation::Device::setRobotRootPosition
void setRobotRootPosition(const std::string &robotName, const Transform3s &positionWRTParentJoint)
pyhpp::manipulation::modelsInfo
Definition device.hh:75
pyhpp::manipulation::modelsInfo::operator==
bool operator==(const modelsInfo &other) const
Definition device.hh:81
pyhpp::manipulation::modelsInfo::srdfPath
std::string srdfPath
Definition device.hh:77
pyhpp::manipulation::modelsInfo::urdfPath
std::string urdfPath
Definition device.hh:76
pyhpp::manipulation::modelsInfo::prefix
std::string prefix
Definition device.hh:78
pyhpp::manipulation::modelsInfo::pose
hpp::pinocchio::SE3 pose
Definition device.hh:79