Ignition Physics

API Reference

5.1.0
World.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 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_WORLD_HH_
19 #define IGNITION_PHYSICS_WORLD_HH_
20 
21 #include <string>
22 
25 
26 namespace ignition
27 {
28  namespace physics
29  {
31  class IGNITION_PHYSICS_VISIBLE CollisionDetector : public virtual Feature
32  {
34  public: template <typename PolicyT, typename FeaturesT>
35  class World : public virtual Feature::World<PolicyT, FeaturesT>
36  {
39  public: void SetCollisionDetector(
40  const std::string &_collisionDetector);
41 
44  public: const std::string &GetCollisionDetector() const;
45  };
46 
48  public: template <typename PolicyT>
49  class Implementation : public virtual Feature::Implementation<PolicyT>
50  {
54  public: virtual void SetWorldCollisionDetector(
55  const Identity &_id, const std::string &_collisionDetector) = 0;
56 
60  public: virtual const std::string &GetWorldCollisionDetector(
61  const Identity &_id) const = 0;
62  };
63  };
64 
67 
70  class IGNITION_PHYSICS_VISIBLE Gravity
71  : public virtual
72  FeatureWithRequirements<GravityRequiredFeatures>
73  {
75  public: template <typename PolicyT, typename FeaturesT>
76  class World : public virtual Feature::World<PolicyT, FeaturesT>
77  {
78  public: using LinearVectorType =
79  typename FromPolicy<PolicyT>::template Use<LinearVector>;
80 
81  public: using RelativeForceType =
82  typename FromPolicy<PolicyT>::template Use<RelativeForce>;
83 
88  public: void SetGravity(const RelativeForceType &_gravity);
89 
96  public: void SetGravity(
97  const LinearVectorType &_gravity,
98  const FrameID &_forceInCoordinatesOf = FrameID::World());
99 
106  public: LinearVectorType GetGravity(
107  const FrameID &_forceInCoordinatesOf = FrameID::World()) const;
108  };
109 
111  public: template <typename PolicyT>
112  class Implementation : public virtual Feature::Implementation<PolicyT>
113  {
114  public: using LinearVectorType =
115  typename FromPolicy<PolicyT>::template Use<LinearVector>;
116 
121  public: virtual void SetWorldGravity(
122  const Identity &_id, const LinearVectorType &_gravity) = 0;
123 
128  public: virtual LinearVectorType GetWorldGravity(
129  const Identity &_id) const = 0;
130  };
131  };
132 
134  class IGNITION_PHYSICS_VISIBLE Solver : public virtual Feature
135  {
137  public: template <typename PolicyT, typename FeaturesT>
138  class World : public virtual Feature::World<PolicyT, FeaturesT>
139  {
142  public: void SetSolver(const std::string &_solver);
143 
146  public: const std::string &GetSolver() const;
147  };
148 
150  public: template <typename PolicyT>
151  class Implementation : public virtual Feature::Implementation<PolicyT>
152  {
156  public: virtual void SetWorldSolver(
157  const Identity &_id, const std::string &_solver) = 0;
158 
162  public: virtual const std::string &GetWorldSolver(
163  const Identity &_id) const = 0;
164  };
165  };
166  }
167 }
168 
169 #include <ignition/physics/detail/World.hh>
170 
171 #endif
If your feature is known to require any other features, then you should have your feature class inher...
Definition: FeatureList.hh:108
The implementation API for the collision detector.
Definition: World.hh:49
typename FromPolicy< PolicyT >::template Use< LinearVector > LinearVectorType
Definition: World.hh:79
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.
This struct is used to conveniently convert from a policy to a geometric type. Example usage: ...
Definition: Geometry.hh:77
typename FromPolicy< PolicyT >::template Use< RelativeForce > RelativeForceType
Definition: World.hh:82
STL class.
The World API for setting the solver.
Definition: World.hh:138
The World API for getting and setting the gravity vector.
Definition: World.hh:76
typename FromPolicy< PolicyT >::template Use< LinearVector > LinearVectorType
Definition: World.hh:115
Placeholder class in case a Feature does not define its own World API.
Definition: Feature.hh:49
Definition: World.hh:134
The implementation API for the solver.
Definition: World.hh:151
The World API for setting the collision detector.
Definition: World.hh:35
Get and set the World&#39;s gravity vector in a specified frame.
Definition: World.hh:70
The implementation API for the gravity.
Definition: World.hh:112
Use a FeatureList to aggregate a list of Features.
Definition: FeatureList.hh:51
Container for specifying Frame IDs. We do not want to use a generic integer type for this...
Definition: FrameID.hh:46