Gazebo Physics

API Reference

5.3.2
gz/physics/FrameSemantics.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 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 GZ_PHYSICS_FRAMESEMANTICS_HH_
19 #define GZ_PHYSICS_FRAMESEMANTICS_HH_
20 
21 #include <memory>
22 
23 #include <gz/physics/Feature.hh>
24 #include <gz/physics/Entity.hh>
25 #include <gz/physics/FrameID.hh>
26 #include <gz/physics/FrameData.hh>
28 
29 namespace ignition
30 {
31  namespace physics
32  {
38  class IGNITION_PHYSICS_VISIBLE FrameSemantics : public virtual Feature
39  {
40  // Forward declaration
41  public: template <typename, typename> class Frame;
42 
45  public: template <typename PolicyT, typename FeaturesT>
46  class Engine : public virtual Feature::Engine<PolicyT, FeaturesT>
47  {
48  public: using FrameData =
50  typename PolicyT::Scalar, PolicyT::Dim>;
51 
59  public: template <typename RQ>
60  typename RQ::Quantity Resolve(
61  const RQ &_quantity,
62  const FrameID &_relativeTo,
63  const FrameID &_inCoordinatesOf) const;
64 
81  public: template <typename RQ>
82  typename RQ::Quantity Resolve(
83  const RQ &_quantity,
84  const FrameID &_relativeTo = FrameID::World()) const;
85 
90  public: template <typename RQ>
91  RQ Reframe(const RQ &_quantity,
92  const FrameID &_withRespectTo = FrameID::World()) const;
93 
94  template <typename, typename> friend class FrameSemantics::Frame;
95  };
96 
99  public: template <typename PolicyT, typename FeaturesT>
100  class Frame : public virtual Entity<PolicyT, FeaturesT>
101  {
102  public: using FrameData =
104 
106  public: FrameID GetFrameID() const;
107 
109  public: FrameData FrameDataRelativeToWorld() const;
110 
114  public: FrameData FrameDataRelativeTo(
115  const FrameID &_relativeTo) const;
116 
119  public: FrameData FrameDataRelativeTo(
120  const FrameID &_relativeTo,
121  const FrameID &_inCoordinatesOf) const;
122 
125  public: operator FrameID() const;
126 
128  public: virtual ~Frame() = default;
129  };
130 
133  template <typename PolicyT>
134  class Implementation : public virtual Feature::Implementation<PolicyT>
135  {
136  public: using FrameData =
138 
144  public: virtual FrameData FrameDataRelativeToWorld(
145  const FrameID &_id) const = 0;
146 
157  protected: virtual FrameID GenerateFrameID(
158  const Identity &_identity) const;
159  };
160  };
161 
164  class IGNITION_PHYSICS_VISIBLE LinkFrameSemantics
165  : public virtual FrameSemantics
166  {
167  public: template <typename Policy, typename Features>
169  };
170 
173  class IGNITION_PHYSICS_VISIBLE JointFrameSemantics
174  : public virtual FrameSemantics
175  {
176  public: template <typename Policy, typename Features>
178  };
179 
181  class IGNITION_PHYSICS_VISIBLE ShapeFrameSemantics
182  : public virtual FrameSemantics
183  {
184  public: template <typename Policy, typename Features>
186  };
187 
190  class IGNITION_PHYSICS_VISIBLE ModelFrameSemantics
191  : public virtual FrameSemantics
192  {
193  public: template <typename Policy, typename Features>
195  };
196 
199  class IGNITION_PHYSICS_VISIBLE CompleteFrameSemantics
200  : public virtual LinkFrameSemantics,
201  public virtual JointFrameSemantics,
202  public virtual ModelFrameSemantics
203  {
204  // This alias is needed in order to disambiguate which Engine class to use
205  // from the base classes.
206  public: template <typename Policy, typename Features>
208  };
209  }
210 }
211 
212 #include <gz/physics/detail/FrameSemantics.hh>
213 
214 #endif
This is the base class of all "proxy objects". The "proxy objects" are essentially interfaces into th...
Definition: gz/physics/Entity.hh:216
FrameID GetFrameID() const
Get a FrameID for this object.
FrameData FrameDataRelativeTo(const FrameID &_relativeTo) const
Get the FrameData of this object with respect to another frame. The data will also be expressed in th...
virtual ~Frame()=default
Virtual destructor.
This class defines the engine interface that provides the FrameSemantics feature.
Definition: gz/physics/FrameSemantics.hh:46
This feature will apply frame semantics to all objects.
Definition: gz/physics/FrameSemantics.hh:199
FrameSemantics is an Interface that can be provided by ignition-physics engines to provide users with...
Definition: gz/physics/FrameSemantics.hh:38
This feature will apply frame semantics to Model objects.
Definition: gz/physics/FrameSemantics.hh:190
Container for specifying Frame IDs. We do not want to use a generic integer type for this,...
Definition: gz/physics/FrameID.hh:46
This feature will apply frame semantics to Link objects.
Definition: gz/physics/FrameSemantics.hh:164
RQ::Quantity Resolve(const RQ &_quantity, const FrameID &_relativeTo, const FrameID &_inCoordinatesOf) const
Resolve can take a RelativeQuantity (RQ) and compute its values in terms of other reference frames....
Definition: gz/physics/Feature.hh:92
This class defines the concept of a Feature. It should be inherited by classes that define some plugi...
Definition: gz/physics/Feature.hh:35
RQ Reframe(const RQ &_quantity, const FrameID &_withRespectTo=FrameID::World()) const
Create a new RelativeQuantity which expresses the input quantity in terms of a new parent frame....
FrameData FrameDataRelativeToWorld() const
Get the FrameData of this object with respect to the world.
Definition: gz/physics/FrameSemantics.hh:181
The FrameData struct fully describes the kinematic state of a Frame with "Dim" dimensions and "Scalar...
Definition: gz/physics/FrameData.hh:42
virtual FrameData FrameDataRelativeToWorld(const FrameID &_id) const =0
Get the current 3D transformation of the specified frame with respect to the WorldFrame.
This class is inherited by physics plugin classes that want to provide this feature.
Definition: gz/physics/FrameSemantics.hh:134
virtual FrameID GenerateFrameID(const Identity &_identity) const
Physics engines can use this function to generate a FrameID using an existing Identity.
This feature will apply frame semantics to Joint objects.
Definition: gz/physics/FrameSemantics.hh:173
static const FrameID & World()
Get a reference to the world Frame.
Placeholder class for the Engine API. Every Engine feature MUST inherit this class.
Definition: gz/physics/Feature.hh:40
Base class for the API of a Frame. This will be inherited by any objects that are able to express Fra...
Definition: gz/physics/FrameSemantics.hh:41