hpp-constraints  4.9.1
Definition of basic geometric constraints for motion planning
convex-shape-contact.hh
Go to the documentation of this file.
1 // Copyright (c) 2014, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of hpp-constraints.
5 // hpp-constraints is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // hpp-constraints is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // hpp-constraints. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HPP_CONSTRAINTS_CONVEX_SHAPE_CONTACT_HH
18 # define HPP_CONSTRAINTS_CONVEX_SHAPE_CONTACT_HH
19 
20 # include <vector>
21 
22 # include <hpp/constraints/fwd.hh>
23 # include <hpp/constraints/config.hh>
24 # include <hpp/constraints/deprecated.hh>
28 
29 namespace hpp {
30  namespace constraints {
31 
34 
75  class HPP_CONSTRAINTS_DLLAPI ConvexShapeContact :
76  public DifferentiableFunction {
77  public:
79 
81  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
83 
85  enum ContactType {
91  PLANE_ON_PLANE
92  };
93 
97  struct ForceData {
100  std::vector<vector3_t> points;
102  };
103 
107  ConvexShapeContact (const std::string& name,
108  const DevicePtr_t& robot);
109 
111  const std::string& name,
112  const DevicePtr_t& robot);
113 
115  const DevicePtr_t& robot);
116 
121  void addObjectTriangle (const fcl::TriangleP& t,
122  const JointPtr_t& joint)
124 
130  void addFloorTriangle (const fcl::TriangleP& t,
131  const JointPtr_t& joint)
133 
135  void addObject (const ConvexShape& t);
136 
141  void addFloor (const ConvexShape& t);
142 
146  void setNormalMargin (const value_type& margin);
147 
149  std::vector <ForceData> computeContactPoints (ConfigurationIn_t q,
150  const value_type& normalMargin) const;
151 
153  std::ostream& print (std::ostream& o) const;
154 
155  private:
156  void impl_compute (LiegroupElementRef result, ConfigurationIn_t argument)
157  const;
158  void computeInternalValue (const ConfigurationIn_t& argument,
159  bool& isInside, ContactType& type, vector6_t& value) const;
160 
161  void impl_jacobian (matrixOut_t jacobian, ConfigurationIn_t argument) const;
162  void computeInternalJacobian (const ConfigurationIn_t& argument,
163  bool& isInside, ContactType& type, matrix_t& jacobian) const;
164 
165  typedef std::vector <ConvexShape> ConvexShapes_t;
167  bool selectConvexShapes (const pinocchio::DeviceData& data,
168  ConvexShapes_t::const_iterator& object,
169  ConvexShapes_t::const_iterator& floor) const;
170  ContactType contactType (const ConvexShape& object,
171  const ConvexShape& floor) const;
172 
173  DevicePtr_t robot_;
174  mutable GenericTransformationModel<true> relativeTransformationModel_;
175 
176  ConvexShapes_t objectConvexShapes_;
177  ConvexShapes_t floorConvexShapes_;
178 
179  value_type normalMargin_;
180  };
181 
194  class HPP_CONSTRAINTS_DLLAPI ConvexShapeContactComplement :
196  {
197  public:
205  static std::pair <ConvexShapeContactPtr_t,
207  createPair (const std::string& name, const std::string& complementName,
208  const DevicePtr_t& robot);
209 
210  protected:
215  ConvexShapeContactComplement (const std::string& name,
216  const std::string& complementName,
217  const DevicePtr_t& robot);
218 
219 
220  private:
221  void impl_compute (LiegroupElementRef result, ConfigurationIn_t argument) const;
222 
223  void impl_jacobian (matrixOut_t jacobian, ConfigurationIn_t argument)
224  const;
225 
226  ConvexShapeContactPtr_t sibling_;
227  }; // class ConvexShapeContactComplement
229  } // namespace constraints
230 } // namespace hpp
231 
232 #endif // HPP_CONSTRAINTS_CONVEX_SHAPE_CONTACT_HH
Definition: convex-shape-contact.hh:194
boost::shared_ptr< ConvexShapeContactComplement > ConvexShapeContactComplementPtr_t
Definition: fwd.hh:111
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:91
ObjectFactory * create(ObjectFactory *parent=NULL, const XMLElement *element=NULL)
ContactType
The type of contact between each pair (object shape, floor shape).
Definition: convex-shape-contact.hh:85
pinocchio::matrix_t matrix_t
Definition: fwd.hh:42
JointPtr_t joint
Definition: convex-shape-contact.hh:98
pinocchio::vector3_t vector3_t
Definition: fwd.hh:39
The object shape degenerates to a line,.
Definition: convex-shape-contact.hh:89
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:88
The object shape is a single point,.
Definition: convex-shape-contact.hh:87
pinocchio::JointPtr_t JointPtr_t
Definition: fwd.hh:37
Definition: differentiable-function.hh:50
Definition: convex-shape-contact.hh:75
Eigen::Matrix< value_type, 6, 1 > vector6_t
Definition: fwd.hh:61
boost::shared_ptr< ConvexShapeContact > ConvexShapeContactPtr_t
Definition: fwd.hh:109
Eigen::Ref< matrix_t > matrixOut_t
Definition: fwd.hh:44
std::vector< vector3_t > points
Definition: convex-shape-contact.hh:100
Transform3f t
Definition: convex-shape.hh:64
pinocchio::value_type value_type
Definition: fwd.hh:36
JointPtr_t supportJoint
Definition: convex-shape-contact.hh:99
vector3_t normal
Definition: convex-shape-contact.hh:101
Definition: convex-shape-contact.hh:97
DifferentiableFunctionSet DifferentiableFunctionStack HPP_CONSTRAINTS_DEPRECATED
Definition: fwd.hh:99
Vec3f o