hpp-core  4.9.0
Implement basic classes for canonical path planning for kinematic chains.
solid-solid-collision.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2014,2015,2016,2018 CNRS
3 // Authors: Florent Lamiraux, Joseph Mirabel, Diane Bury
4 //
5 // This file is part of hpp-core
6 // hpp-core is free software: you can redistribute it
7 // and/or modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation, either version
9 // 3 of the License, or (at your option) any later version.
10 //
11 // hpp-core is distributed in the hope that it will be
12 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Lesser Public License for more details. You should have
15 // received a copy of the GNU Lesser General Public License along with
16 // hpp-core If not, see
17 // <http://www.gnu.org/licenses/>.
18 
19 #ifndef HPP_CORE_CONTINUOUS_VALIDATION_SOLID_SOLID_COLLISION_HH
20 # define HPP_CORE_CONTINUOUS_VALIDATION_SOLID_SOLID_COLLISION_HH
21 
23 
24 namespace hpp {
25  namespace core {
26  namespace continuousValidation {
28  {
30  {
31  }
35  }; // struct CoefficientVelocity
36  typedef std::vector <CoefficientVelocity> CoefficientVelocities_t;
37 
47  class HPP_CORE_DLLAPI SolidSolidCollision : public BodyPairCollision
48  {
49  public:
56  static SolidSolidCollisionPtr_t create (const JointPtr_t& joint_a,
57  const ConstObjectStdVector_t& objects_b,
58  value_type tolerance);
59 
64  static SolidSolidCollisionPtr_t create (const JointPtr_t& joint_a,
65  const JointPtr_t& joint_b,
66  value_type tolerance);
67 
69  static SolidSolidCollisionPtr_t createCopy
70  (const SolidSolidCollisionPtr_t& other);
71 
72  value_type computeMaximalVelocity(vector_t& Vb) const;
73 
74  bool removeObjectTo_b (const CollisionObjectConstPtr_t& object);
75 
76  std::string name () const;
77 
78  std::ostream& print (std::ostream& os) const;
79 
83  void addCollisionPair (const CollisionObjectConstPtr_t& left,
84  const CollisionObjectConstPtr_t &right);
85 
86  // Get coefficients and joints
87  const CoefficientVelocities_t& coefficients () const
88  {
89  return m_->coefficients;
90  }
91 
93  const JointPtr_t& joint_a () const
94  {
95  return m_->joint_a;
96  }
98  const JointPtr_t& joint_b () const
99  {
100  return m_->joint_b;
101  }
102 
105  {
106  return (m_->joint_a ? m_->joint_a->index() : 0);
107  }
110  {
111  return (m_->joint_b ? m_->joint_b->index() : 0);
112  }
113 
114  IntervalValidationPtr_t copy () const;
115 
116  protected:
122  SolidSolidCollision (const JointPtr_t& joint_a,
123  const JointPtr_t& joint_b,
124  value_type tolerance);
125 
132  SolidSolidCollision (const JointPtr_t& joint_a,
133  const ConstObjectStdVector_t& objects_b,
134  value_type tolerance);
135 
138  : BodyPairCollision (other), m_ (other.m_)
139  {}
140 
141  void init(const SolidSolidCollisionWkPtr_t& weak);
142  private:
143  typedef pinocchio::JointIndex JointIndex;
144  typedef std::vector<JointIndex> JointIndices_t;
145 
146  struct Model {
147  JointPtr_t joint_a;
148  JointPtr_t joint_b;
149  CoefficientVelocities_t coefficients;
150  JointIndices_t computeSequenceOfJoints () const;
151  void computeCoefficients (const JointIndices_t& joints);
152  };
153  boost::shared_ptr<Model> m_;
154  SolidSolidCollisionWkPtr_t weak_;
155  }; // class SolidSolidCollision
156  } // namespace continuousValidation
157  } // namespace core
158 } // namespace hpp
159 #endif // HPP_CORE_CONTINUOUS_VALIDATION_SOLID_SOLID_COLLISION_HH
JointPtr_t joint_
Joint the degrees of freedom of which the bounds correspond to.
Definition: solid-solid-collision.hh:33
boost::shared_ptr< IntervalValidation > IntervalValidationPtr_t
Definition: fwd.hh:242
std::vector< CollisionObjectConstPtr_t > ConstObjectStdVector_t
Definition: fwd.hh:168
ObjectFactory * create(ObjectFactory *parent=NULL, const XMLElement *element=NULL)
::pinocchio::ModelTpl< value_type, 0, JointCollectionTpl > Model
pinocchio::size_type size_type
Definition: fwd.hh:156
pinocchio::JointPtr_t JointPtr_t
Definition: fwd.hh:133
boost::shared_ptr< SolidSolidCollision > SolidSolidCollisionPtr_t
Definition: fwd.hh:245
Definition: solid-solid-collision.hh:27
size_type indexJointA() const
Returns joint A index or -1 if no such joint exists.
Definition: solid-solid-collision.hh:104
const CoefficientVelocities_t & coefficients() const
Definition: solid-solid-collision.hh:87
const JointPtr_t & joint_b() const
Get joint b.
Definition: solid-solid-collision.hh:98
value_type value_
Definition: solid-solid-collision.hh:34
pinocchio::vector_t vector_t
Definition: fwd.hh:201
pinocchio::value_type value_type
Definition: fwd.hh:157
std::vector< CoefficientVelocity > CoefficientVelocities_t
Definition: solid-solid-collision.hh:36
SolidSolidCollision(const SolidSolidCollision &other)
Copy constructor.
Definition: solid-solid-collision.hh:137
const JointPtr_t & joint_a() const
Get joint a.
Definition: solid-solid-collision.hh:93
Definition: body-pair-collision.hh:51
size_type indexJointB() const
Returns joint B index or -1 if no such joint exists.
Definition: solid-solid-collision.hh:109
CoefficientVelocity()
Definition: solid-solid-collision.hh:29
Definition: solid-solid-collision.hh:47
::pinocchio::JointIndex JointIndex
pinocchio::CollisionObjectConstPtr_t CollisionObjectConstPtr_t
Definition: fwd.hh:90