Ignition Physics

API Reference

2.0.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  {
31  class IGNITION_PHYSICS_VISIBLE GetShapeKinematicProperties
32  : public virtual Feature
33  {
34  public: template <typename PolicyT, typename FeaturesT>
35  class Shape : public virtual Feature::Shape<PolicyT, FeaturesT>
36  {
37  public: using PoseType =
38  typename FromPolicy<PolicyT>::template Use<Pose>;
39 
45  public: PoseType GetRelativeTransform() const;
46  };
47 
48  public: template <typename PolicyT>
49  class Implementation : public virtual Feature::Implementation<PolicyT>
50  {
51  public: using PoseType =
52  typename FromPolicy<PolicyT>::template Use<Pose>;
53 
54  public: virtual PoseType GetShapeRelativeTransform(
55  const Identity &_shapeID) const = 0;
56  };
57  };
58 
60  class IGNITION_PHYSICS_VISIBLE SetShapeKinematicProperties
61  : public virtual Feature
62  {
63  public: template <typename PolicyT, typename FeaturesT>
64  class Shape : public virtual Feature::Shape<PolicyT, FeaturesT>
65  {
66  public: using PoseType =
67  typename FromPolicy<PolicyT>::template Use<Pose>;
68 
75  public: void SetRelativeTransform(const PoseType &_pose);
76  };
77 
78  public: template <typename PolicyT>
79  class Implementation : public virtual Feature::Implementation<PolicyT>
80  {
81  public: using PoseType =
82  typename FromPolicy<PolicyT>::template Use<Pose>;
83 
84  public: virtual void SetShapeRelativeTransform(
85  const Identity &_shapeID, const PoseType &_pose) = 0;
86  };
87  };
88 
90  class IGNITION_PHYSICS_VISIBLE GetShapeCollisionProperties
91  : public virtual Feature
92  {
93  public: template <typename PolicyT, typename FeaturesT>
94  class Shape : public virtual Feature::Shape<PolicyT, FeaturesT>
95  {
96  public: using Scalar = typename PolicyT::Scalar;
97 
104  public: Scalar GetFrictionCoefficient(
105  const BaseShapePtr<PolicyT> &_other) const;
106 
114  public: Scalar GetRestitutionCoefficient(
115  const BaseShapePtr<PolicyT> &_other) const;
116  };
117 
118  public: template <typename PolicyT>
119  class Implementation : public virtual Feature::Implementation<PolicyT>
120  {
121  public: using Scalar = typename PolicyT::Scalar;
122 
123  public: virtual Scalar GetFrictionCoefficient(
124  const Identity &_shape0, const Identity &_shape1) const = 0;
125 
126  public: virtual Scalar GetRestitutionCoefficient(
127  const Identity &_shape0, const Identity &_shape1) const = 0;
128  };
129  };
130 
132  class IGNITION_PHYSICS_VISIBLE GetShapeBoundingBox
133  : public virtual FeatureWithRequirements<ShapeFrameSemantics>
134  {
135  public: template <typename PolicyT, typename FeaturesT>
136  class Shape
137  : public virtual ShapeFrameSemantics::Shape<PolicyT, FeaturesT>
138  {
139  public: using AlignedBoxType =
140  typename FromPolicy<PolicyT>::template Use<AlignedBox>;
141 
151  public: AlignedBoxType GetAxisAlignedBoundingBox(
152  const FrameID &_referenceFrame = FrameID::World()) const;
153  };
154 
155  public: template <typename PolicyT>
156  class Implementation : public virtual Feature::Implementation<PolicyT>
157  {
158  public: using AlignedBoxType =
159  typename FromPolicy<PolicyT>::template Use<AlignedBox>;
160 
164  public: virtual AlignedBoxType GetShapeAxisAlignedBoundingBox(
165  const Identity &_shape) const = 0;
166  };
167  };
168 
170  class IGNITION_PHYSICS_VISIBLE SetShapeCollisionProperties
171  : public virtual Feature
172  {
173  public: template <typename PolicyT, typename FeaturesT>
174  class Shape : public virtual Feature::Shape<PolicyT, FeaturesT>
175  {
176  public: using Scalar = typename PolicyT::Scalar;
177 
185  public: void SetFrictionCoefficient(
186  const BaseShapePtr<PolicyT> &_other, Scalar _value);
187 
195  public: void SetRestitutionCoefficient(
196  const BaseShapePtr<PolicyT> &_other, Scalar _value);
197  };
198 
199  public: template <typename PolicyT>
200  class Implementation : public virtual Feature::Implementation<PolicyT>
201  {
202  public: using Scalar = typename PolicyT::Scalar;
203 
204  public: virtual void SetShapeFrictionCoefficient(
205  const Identity &_shape0,
206  const Identity &_shape1,
207  Scalar _value) = 0;
208 
209  public: virtual void SetShapeRestitutionCoefficient(
210  const Identity &_shape0,
211  const Identity &_shape1,
212  Scalar _value) = 0;
213  };
214  };
215 
217  class IGNITION_PHYSICS_VISIBLE CollisionFilterMaskFeature
218  : public virtual Feature
219  {
220  public: template <typename PolicyT, typename FeaturesT>
221  class Shape : public virtual Feature::Shape<PolicyT, FeaturesT>
222  {
227  public: void SetCollisionFilterMask(const uint16_t _mask);
228 
231  public: uint16_t GetCollisionFilterMask() const;
232 
234  public: void RemoveCollisionFilterMask();
235  };
236 
237  public: template <typename PolicyT>
238  class Implementation : public virtual Feature::Implementation<PolicyT>
239  {
240  public: virtual void SetCollisionFilterMask(
241  const Identity &_shapeID, const uint16_t _mask) = 0;
242 
243  public: virtual uint16_t GetCollisionFilterMask(
244  const Identity &_shapeID) const = 0;
245 
246  public: virtual void RemoveCollisionFilterMask(
247  const Identity &_shapeID) = 0;
248  };
249  };
250  }
251 }
252 
253 #include <ignition/physics/detail/Shape.hh>
254 
255 #endif
typename FromPolicy< PolicyT >::template Use< Pose > PoseType
Definition: Shape.hh:82
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
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:52
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:38
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:202
typename PolicyT::Scalar Scalar
Definition: Shape.hh:176
typename FromPolicy< PolicyT >::template Use< Pose > PoseType
Definition: Shape.hh:67
typename FromPolicy< PolicyT >::template Use< AlignedBox > AlignedBoxType
Definition: Shape.hh:159
typename FromPolicy< PolicyT >::template Use< AlignedBox > AlignedBoxType
Definition: Shape.hh:140
typename PolicyT::Scalar Scalar
Definition: Shape.hh:121
typename PolicyT::Scalar Scalar
Definition: Shape.hh:96
Container for specifying Frame IDs. We do not want to use a generic integer type for this...
Definition: FrameID.hh:46