Ignition Physics

API Reference

2.3.0
Shape.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef IGNITION_PHYSICS_SHAPE_HH_
19 #define IGNITION_PHYSICS_SHAPE_HH_
20 
25 
26 namespace ignition
27 {
28  namespace physics
29  {
33  class IGNITION_PHYSICS_VISIBLE GetShapeKinematicProperties
34  : public virtual Feature
35  {
36  public: template <typename PolicyT, typename FeaturesT>
37  class Shape : public virtual Feature::Shape<PolicyT, FeaturesT>
38  {
39  public: using PoseType =
40  typename FromPolicy<PolicyT>::template Use<Pose>;
41 
47  public: PoseType GetRelativeTransform() const;
48  };
49 
50  public: template <typename PolicyT>
51  class Implementation : public virtual Feature::Implementation<PolicyT>
52  {
53  public: using PoseType =
54  typename FromPolicy<PolicyT>::template Use<Pose>;
55 
56  public: virtual PoseType GetShapeRelativeTransform(
57  const Identity &_shapeID) const = 0;
58  };
59  };
60 
62  class IGNITION_PHYSICS_VISIBLE SetShapeKinematicProperties
63  : public virtual Feature
64  {
65  public: template <typename PolicyT, typename FeaturesT>
66  class Shape : public virtual Feature::Shape<PolicyT, FeaturesT>
67  {
68  public: using PoseType =
69  typename FromPolicy<PolicyT>::template Use<Pose>;
70 
77  public: void SetRelativeTransform(const PoseType &_pose);
78  };
79 
80  public: template <typename PolicyT>
81  class Implementation : public virtual Feature::Implementation<PolicyT>
82  {
83  public: using PoseType =
84  typename FromPolicy<PolicyT>::template Use<Pose>;
85 
86  public: virtual void SetShapeRelativeTransform(
87  const Identity &_shapeID, const PoseType &_pose) = 0;
88  };
89  };
90 
94  class IGNITION_PHYSICS_VISIBLE GetShapeCollisionProperties
95  : public virtual Feature
96  {
97  public: template <typename PolicyT, typename FeaturesT>
98  class Shape : public virtual Feature::Shape<PolicyT, FeaturesT>
99  {
100  public: using Scalar = typename PolicyT::Scalar;
101 
108  public: Scalar GetFrictionCoefficient(
109  const BaseShapePtr<PolicyT> &_other) const;
110 
118  public: Scalar GetRestitutionCoefficient(
119  const BaseShapePtr<PolicyT> &_other) const;
120  };
121 
122  public: template <typename PolicyT>
123  class Implementation : public virtual Feature::Implementation<PolicyT>
124  {
125  public: using Scalar = typename PolicyT::Scalar;
126 
127  public: virtual Scalar GetFrictionCoefficient(
128  const Identity &_shape0, const Identity &_shape1) const = 0;
129 
130  public: virtual Scalar GetRestitutionCoefficient(
131  const Identity &_shape0, const Identity &_shape1) const = 0;
132  };
133  };
134 
138  class IGNITION_PHYSICS_VISIBLE GetShapeBoundingBox
139  : public virtual FeatureWithRequirements<ShapeFrameSemantics>
140  {
141  public: template <typename PolicyT, typename FeaturesT>
142  class Shape
143  : public virtual ShapeFrameSemantics::Shape<PolicyT, FeaturesT>
144  {
145  public: using AlignedBoxType =
146  typename FromPolicy<PolicyT>::template Use<AlignedBox>;
147 
157  public: AlignedBoxType GetAxisAlignedBoundingBox(
158  const FrameID &_referenceFrame = FrameID::World()) const;
159  };
160 
161  public: template <typename PolicyT>
162  class Implementation : public virtual Feature::Implementation<PolicyT>
163  {
164  public: using AlignedBoxType =
165  typename FromPolicy<PolicyT>::template Use<AlignedBox>;
166 
170  public: virtual AlignedBoxType GetShapeAxisAlignedBoundingBox(
171  const Identity &_shape) const = 0;
172  };
173  };
174 
178  class IGNITION_PHYSICS_VISIBLE SetShapeCollisionProperties
179  : public virtual Feature
180  {
181  public: template <typename PolicyT, typename FeaturesT>
182  class Shape : public virtual Feature::Shape<PolicyT, FeaturesT>
183  {
184  public: using Scalar = typename PolicyT::Scalar;
185 
193  public: void SetFrictionCoefficient(
194  const BaseShapePtr<PolicyT> &_other, Scalar _value);
195 
203  public: void SetRestitutionCoefficient(
204  const BaseShapePtr<PolicyT> &_other, Scalar _value);
205  };
206 
207  public: template <typename PolicyT>
208  class Implementation : public virtual Feature::Implementation<PolicyT>
209  {
210  public: using Scalar = typename PolicyT::Scalar;
211 
212  public: virtual void SetShapeFrictionCoefficient(
213  const Identity &_shape0,
214  const Identity &_shape1,
215  Scalar _value) = 0;
216 
217  public: virtual void SetShapeRestitutionCoefficient(
218  const Identity &_shape0,
219  const Identity &_shape1,
220  Scalar _value) = 0;
221  };
222  };
223 
225  class IGNITION_PHYSICS_VISIBLE CollisionFilterMaskFeature
226  : public virtual Feature
227  {
228  public: template <typename PolicyT, typename FeaturesT>
229  class Shape : public virtual Feature::Shape<PolicyT, FeaturesT>
230  {
235  public: void SetCollisionFilterMask(const uint16_t _mask);
236 
239  public: uint16_t GetCollisionFilterMask() const;
240 
242  public: void RemoveCollisionFilterMask();
243  };
244 
245  public: template <typename PolicyT>
246  class Implementation : public virtual Feature::Implementation<PolicyT>
247  {
248  public: virtual void SetCollisionFilterMask(
249  const Identity &_shapeID, const uint16_t _mask) = 0;
250 
251  public: virtual uint16_t GetCollisionFilterMask(
252  const Identity &_shapeID) const = 0;
253 
254  public: virtual void RemoveCollisionFilterMask(
255  const Identity &_shapeID) = 0;
256  };
257  };
258 
262  class IGNITION_PHYSICS_VISIBLE GetShapeFrictionPyramidSlipCompliance
263  : public virtual Feature
264  {
265  public: template <typename PolicyT, typename FeaturesT>
266  class Shape : public virtual Feature::Shape<PolicyT, FeaturesT>
267  {
268  public: using Scalar = typename PolicyT::Scalar;
269 
274  public: Scalar GetPrimarySlipCompliance() const;
275 
280  public: Scalar GetSecondarySlipCompliance() const;
281  };
282 
283  public: template <typename PolicyT>
284  class Implementation : public virtual Feature::Implementation<PolicyT>
285  {
286  public: using Scalar = typename PolicyT::Scalar;
287 
288  public: virtual Scalar GetShapeFrictionPyramidPrimarySlipCompliance(
289  const Identity &_shapeID) const = 0;
290 
291  public: virtual Scalar GetShapeFrictionPyramidSecondarySlipCompliance(
292  const Identity &_shapeID) const = 0;
293  };
294  };
295 
299  class IGNITION_PHYSICS_VISIBLE SetShapeFrictionPyramidSlipCompliance
300  : public virtual Feature
301  {
302  public: template <typename PolicyT, typename FeaturesT>
303  class Shape : public virtual Feature::Shape<PolicyT, FeaturesT>
304  {
305  public: using Scalar = typename PolicyT::Scalar;
306 
313  public: bool SetPrimarySlipCompliance(Scalar _value);
314 
321  public: bool SetSecondarySlipCompliance(Scalar _value);
322  };
323 
324  public: template <typename PolicyT>
325  class Implementation : public virtual Feature::Implementation<PolicyT>
326  {
327  public: using Scalar = typename PolicyT::Scalar;
328 
329  public: virtual bool SetShapeFrictionPyramidPrimarySlipCompliance(
330  const Identity &_shapeID, Scalar _value) = 0;
331 
332  public: virtual bool SetShapeFrictionPyramidSecondarySlipCompliance(
333  const Identity &_shapeID, Scalar _value) = 0;
334  };
335  };
336  }
337 }
338 
339 #include <ignition/physics/detail/Shape.hh>
340 
341 #endif
typename FromPolicy< PolicyT >::template Use< Pose > PoseType
Definition: Shape.hh:84
Placeholder class in case a Feature does not define its own Shape API.
Definition: Feature.hh:85
If your feature is known to require any other features, then you should have your feature class inher...
Definition: FeatureList.hh:108
typename PolicyT::Scalar Scalar
Definition: Shape.hh:268
This class defines the concept of a Feature. It should be inherited by classes that define some plugi...
Definition: Feature.hh:35
typename FromPolicy< PolicyT >::template Use< Pose > PoseType
Definition: Shape.hh:54
static const FrameID & World()
Get a reference to the world Frame.
This struct is used to conveniently convert from a policy to a geometric type. Example usage: ...
Definition: Geometry.hh:69
typename FromPolicy< PolicyT >::template Use< Pose > PoseType
Definition: Shape.hh:40
Base class for the API of a Frame. This will be inherited by any objects that are able to express Fra...
Definition: FrameSemantics.hh:41
typename PolicyT::Scalar Scalar
Definition: Shape.hh:210
typename PolicyT::Scalar Scalar
Definition: Shape.hh:184
typename FromPolicy< PolicyT >::template Use< Pose > PoseType
Definition: Shape.hh:69
This feature retrieves the shape collision properties such as the shape surface friction coefficient ...
Definition: Shape.hh:94
This feature sets the Shape collision properties such as the Shape surface friction coefficient and r...
Definition: Shape.hh:178
This feature sets the Shape&#39;s slip compliance of the first and second friction direction in the frict...
Definition: Shape.hh:299
typename PolicyT::Scalar Scalar
Definition: Shape.hh:286
This feature retrieves the shape kinematic properties such as the the relative transform from the the...
Definition: Shape.hh:33
typename FromPolicy< PolicyT >::template Use< AlignedBox > AlignedBoxType
Definition: Shape.hh:165
typename PolicyT::Scalar Scalar
Definition: Shape.hh:327
typename FromPolicy< PolicyT >::template Use< AlignedBox > AlignedBoxType
Definition: Shape.hh:146
typename PolicyT::Scalar Scalar
Definition: Shape.hh:125
This feature retrieves the shape&#39;s slip compliance of the first and second friction direction in the ...
Definition: Shape.hh:262
typename PolicyT::Scalar Scalar
Definition: Shape.hh:305
typename PolicyT::Scalar Scalar
Definition: Shape.hh:100
This feature retrieves the shape&#39;s axis aligned bounding box in the requested frame. The default frame is the world frame.
Definition: Shape.hh:138
Container for specifying Frame IDs. We do not want to use a generic integer type for this...
Definition: FrameID.hh:46