Ignition Physics

API Reference

5.1.0
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 IGNITION_PHYSICS_FRAMESEMANTICS_HH_
19 #define IGNITION_PHYSICS_FRAMESEMANTICS_HH_
20 
21 #include <memory>
22 
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 <ignition/physics/detail/FrameSemantics.hh>
213 
214 #endif
Definition: FrameSemantics.hh:181
This is the base class of all "proxy objects". The "proxy objects" are essentially interfaces into th...
Definition: Entity.hh:216
This class defines the concept of a Feature. It should be inherited by classes that define some plugi...
Definition: Feature.hh:35
static const FrameID & World()
Get a reference to the world Frame.
FrameSemantics is an Interface that can be provided by ignition-physics engines to provide users with...
Definition: FrameSemantics.hh:38
This feature will apply frame semantics to all objects.
Definition: FrameSemantics.hh:199
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
FrameData< typename PolicyT::Scalar, PolicyT::Dim > FrameData
Definition: FrameSemantics.hh:103
FrameData< typename PolicyT::Scalar, PolicyT::Dim > FrameData
Definition: FrameSemantics.hh:50
This feature will apply frame semantics to Model objects.
Definition: FrameSemantics.hh:190
The FrameData struct fully describes the kinematic state of a Frame with "Dim" dimensions and "Scalar...
Definition: FrameData.hh:42
Placeholder class for the Engine API. Every Engine feature MUST inherit this class.
Definition: Feature.hh:40
FrameData< typename PolicyT::Scalar, PolicyT::Dim > FrameData
Definition: FrameSemantics.hh:137
This class is inherited by physics plugin classes that want to provide this feature.
Definition: FrameSemantics.hh:134
This class defines the engine interface that provides the FrameSemantics feature. ...
Definition: FrameSemantics.hh:46
This feature will apply frame semantics to Joint objects.
Definition: FrameSemantics.hh:173
Container for specifying Frame IDs. We do not want to use a generic integer type for this...
Definition: FrameID.hh:46
This feature will apply frame semantics to Link objects.
Definition: FrameSemantics.hh:164