Gazebo Physics

API Reference

7.4.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 GZ_PHYSICS_WORLD_HH_
19 #define GZ_PHYSICS_WORLD_HH_
20 
21 #include <string>
22 
25 
26 namespace gz
27 {
28  namespace physics
29  {
31  class GZ_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 GZ_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 
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 
129  const Identity &_id) const = 0;
130  };
131  };
132 
134  class GZ_PHYSICS_VISIBLE CollisionPairMaxContacts:
135  public virtual Feature
136  {
139  public: template <typename PolicyT, typename FeaturesT>
140  class World : public virtual Feature::World<PolicyT, FeaturesT>
141  {
145  public: void SetCollisionPairMaxContacts(std::size_t _maxContacts);
146 
151  };
152 
154  public: template <typename PolicyT>
155  class Implementation : public virtual Feature::Implementation<PolicyT>
156  {
161  public: virtual void SetWorldCollisionPairMaxContacts(
162  const Identity &_id, std::size_t _maxContacts) = 0;
163 
169  const Identity &_id) const = 0;
170  };
171  };
172 
174  class GZ_PHYSICS_VISIBLE Solver : public virtual Feature
175  {
177  public: template <typename PolicyT, typename FeaturesT>
178  class World : public virtual Feature::World<PolicyT, FeaturesT>
179  {
182  public: void SetSolver(const std::string &_solver);
183 
186  public: const std::string &GetSolver() const;
187  };
188 
190  public: template <typename PolicyT>
191  class Implementation : public virtual Feature::Implementation<PolicyT>
192  {
196  public: virtual void SetWorldSolver(
197  const Identity &_id, const std::string &_solver) = 0;
198 
202  public: virtual const std::string &GetWorldSolver(
203  const Identity &_id) const = 0;
204  };
205  };
206  }
207 }
208 
209 #include <gz/physics/detail/World.hh>
210 
211 #endif