hpp-python 9.0.2
python bindings for HPP, based on boost python
 
Loading...
Searching...
No Matches
problem.hh
Go to the documentation of this file.
1// problem.hh
2//
3// Copyright (c) 2025, CNRS
4// Authors: Paul Sardin
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions
8// are met:
9
10// 1. Redistributions of source code must retain the above copyright
11// notice, this list of conditions and the following disclaimer.
12
13// 2. Redistributions in binary form must reproduce the above
14// copyright notice, this list of conditions and the following
15// disclaimer in the documentation and/or other materials provided
16// with the distribution.
17
18// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29// OF THE POSSIBILITY OF SUCH DAMAGE.
30
31#ifndef PYHPP_CORE_PROBLEM_HH
32#define PYHPP_CORE_PROBLEM_HH
33
34#include <hpp/manipulation/problem.hh>
35#include <hpp/pinocchio/device.hh>
36#include <hpp/util/pointer.hh>
37#include <pyhpp/core/fwd.hh>
38
39namespace pyhpp {
40namespace core {
41
42struct SteeringMethod;
43typedef std::shared_ptr<SteeringMethod> PyWSteeringMethodPtr_t;
44
60
61// Wrapper class for hpp::core::Problem
62struct Problem {
65 Problem(hpp::core::ProblemPtr_t problemPtr) : obj(problemPtr) {}
66
67 // wrapped methods
68 const DevicePtr_t& robot() const;
69 void setParameter(const std::string& name, const Parameter& value);
70 void setParameterFloat(const std::string& name, value_type value);
71 void setParameterInt(const std::string& name, size_type value);
72 const Parameter& getParameter(const std::string& name) const;
78 const ProblemTargetPtr_t& target() const;
85 void distance(const DistancePtr_t& d);
86 void target(const ProblemTargetPtr_t& t);
91 void addConfigValidation(const std::string& type);
93
96 if (!manipProb) {
97 throw std::runtime_error("Not a manipulation problem");
98 }
99 return manipProb;
100 }
101
105
106 // Constraints utility functions
107
108 void addPartialCom(const std::string& name, boost::python::list pyjointNames);
109 hpp::pinocchio::vector3_t getPartialCom(const std::string& name);
110 std::map<std::string, hpp::pinocchio::CenterOfMassComputationPtr_t>
113 const char* constraintName, const char* comName, const char* jointName,
114 hpp::pinocchio::vector3_t point, boost::python::list mask);
115
117 const char* constraintName, const char* joint1Name,
118 const char* joint2Name, const hpp::pinocchio::Transform3s& M,
119 boost::python::list mask);
120
122 const char* constraintName, const char* joint1Name,
123 const char* joint2Name, const hpp::pinocchio::Transform3s& M1,
124 const hpp::pinocchio::Transform3s& M2, const boost::python::list mask);
125
127 bool constant);
128
129 boost::python::tuple applyConstraints(ConfigurationIn_t config);
130 boost::python::tuple isConfigValid(ConfigurationIn_t dofArray);
134
136 const char* configProjName, boost::python::list constraints,
137 boost::python::list priorities);
139 const char* configProjName, boost::python::list constraints);
141 const char* constraintName, const char* comName, const char* jointLName,
142 const char* jointRName, const hpp::pinocchio::vector3_t& pointL,
143 const hpp::pinocchio::vector3_t& pointR, const char* jointRefName,
144 const hpp::pinocchio::vector3_t& pointRef, boost::python::list mask);
145
146 boost::python::tuple directPath(ConfigurationIn_t start,
147 ConfigurationIn_t end, bool validate);
151};
152
153} // namespace core
154} // namespace pyhpp
155
156#endif // PYHPP_CORE_PROBLEM_HH
void configValidation(const ConfigValidationsPtr_t &configValidations)
Definition problem.cc:190
SteeringMethodPtr_t steeringMethod() const
Definition problem.cc:161
void addConfigValidation(const ConfigValidationPtr_t &configValidation)
PathPtr_t directPath(ConfigurationIn_t q1, ConfigurationIn_t q2, bool validate, bool &success, std::string &status)
shared_ptr< Implicit > ImplicitPtr_t
pinocchio::value_type value_type
shared_ptr< PathValidation > PathValidationPtr_t
shared_ptr< Distance > DistancePtr_t
shared_ptr< ConfigurationShooter > ConfigurationShooterPtr_t
shared_ptr< PathProjector > PathProjectorPtr_t
shared_ptr< ProblemTarget > ProblemTargetPtr_t
shared_ptr< ConfigValidations > ConfigValidationsPtr_t
shared_ptr< Problem > ProblemPtr_t
shared_ptr< SteeringMethod > SteeringMethodPtr_t
pinocchio::ConfigurationIn_t ConfigurationIn_t
pinocchio::size_type size_type
shared_ptr< const Problem > ProblemConstPtr_t
pinocchio::Configuration_t Configuration_t
pinocchio::DevicePtr_t DevicePtr_t
shared_ptr< ConstraintSet > ConstraintSetPtr_t
shared_ptr< Problem > ProblemPtr_t
Eigen::Matrix< value_type, 3, 1 > vector3_t
::pinocchio::SE3 Transform3s
Definition fwd.hh:36
Definition fwd.hh:36
std::shared_ptr< SteeringMethod > PyWSteeringMethodPtr_t
Definition problem.hh:43
Definition fwd.hh:35
#define HPP_DYNAMIC_PTR_CAST(t, x)
void pathProjector(const PathProjectorPtr_t &pp)
void setConstraints(hpp::core::ConstraintSetPtr_t constraints)
Definition problem.cc:415
void setParameter(const std::string &name, const Parameter &value)
boost::python::tuple applyConstraints(ConfigurationIn_t config)
Definition problem.cc:378
hpp::constraints::ImplicitPtr_t createRelativeComConstraint(const char *constraintName, const char *comName, const char *jointName, hpp::pinocchio::vector3_t point, boost::python::list mask)
Definition problem.cc:256
const ProblemTargetPtr_t & target() const
void setParameterFloat(const std::string &name, value_type value)
Definition problem.cc:132
hpp::core::ConstraintSetPtr_t getConstraints()
Definition problem.cc:426
void target(const ProblemTargetPtr_t &t)
hpp::manipulation::ProblemPtr_t asManipulationProblem() const
Definition problem.hh:94
bool isManipulationProblem() const
Definition problem.hh:102
size_type maxIterProjection_
Definition problem.hh:150
boost::python::tuple isConfigValid(ConfigurationIn_t dofArray)
Definition problem.cc:394
PathProjectorPtr_t pathProjector() const
hpp::core::ConstraintSetPtr_t constraints_
Definition problem.hh:148
hpp::constraints::ImplicitPtr_t createTransformationConstraint(const char *constraintName, const char *joint1Name, const char *joint2Name, const hpp::pinocchio::Transform3s &M, boost::python::list mask)
Definition problem.cc:285
void distance(const DistancePtr_t &d)
ConfigurationShooterPtr_t configurationShooter() const
value_type errorThreshold_
Definition problem.hh:149
Problem(hpp::core::ProblemPtr_t problemPtr)
Definition problem.hh:65
const DevicePtr_t & robot() const
PyWSteeringMethodPtr_t steeringMethod() const
void setRightHandSideFromConfig(ConfigurationIn_t configIn)
Definition problem.cc:434
void setConstantRightHandSide(hpp::constraints::ImplicitPtr_t constraint, bool constant)
Definition problem.cc:359
hpp::constraints::ImplicitPtr_t createComBetweenFeet(const char *constraintName, const char *comName, const char *jointLName, const char *jointRName, const hpp::pinocchio::vector3_t &pointL, const hpp::pinocchio::vector3_t &pointR, const char *jointRefName, const hpp::pinocchio::vector3_t &pointRef, boost::python::list mask)
Definition problem.cc:490
void configurationShooter(const ConfigurationShooterPtr_t &configurationShooter)
hpp::core::ProblemPtr_t obj
Definition problem.hh:63
void addNumericalConstraintsToConfigProjector1(const char *configProjName, boost::python::list constraints, boost::python::list priorities)
Definition problem.cc:448
std::map< std::string, hpp::pinocchio::CenterOfMassComputationPtr_t > centerOfMassComputations
Definition problem.hh:111
void setParameterInt(const std::string &name, size_type value)
Definition problem.cc:137
const Parameter & getParameter(const std::string &name) const
PathValidationPtr_t pathValidation() const
Problem(const DevicePtr_t &robot)
Definition problem.cc:118
hpp::constraints::ImplicitPtr_t createTransformationConstraint2(const char *constraintName, const char *joint1Name, const char *joint2Name, const hpp::pinocchio::Transform3s &M1, const hpp::pinocchio::Transform3s &M2, const boost::python::list mask)
Definition problem.cc:321
void configValidation(const ConfigValidationsPtr_t &cv)
DistancePtr_t distance() const
void pathValidation(const PathValidationPtr_t &pv)
void addGoalConfig(ConfigurationIn_t config)
void initConfig(ConfigurationIn_t inConfig)
void addNumericalConstraintsToConfigProjector2(const char *configProjName, boost::python::list constraints)
Definition problem.cc:470