Gazebo Physics

API Reference

7.4.0
FreeGroup.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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_FREEGROUP_HH_
19 #define GZ_PHYSICS_FREEGROUP_HH_
20 
23 #include <gz/physics/Geometry.hh>
24 
25 namespace gz
26 {
27  namespace physics
28  {
29  DETAIL_GZ_PHYSICS_DEFINE_ENTITY(FreeGroup)
30 
31 
44  class GZ_PHYSICS_VISIBLE FindFreeGroupFeature : public virtual Feature
45  {
46  public: template <typename PolicyT, typename FeaturesT>
47  class Model : public virtual Feature::Model<PolicyT, FeaturesT>
48  {
49  using FreeGroupPtrType = FreeGroupPtr<PolicyT, FeaturesT>;
50  using ConstFreeGroupPtrType = ConstFreeGroupPtr<PolicyT, FeaturesT>;
51 
55  public: FreeGroupPtrType FindFreeGroup();
56 
58  public: ConstFreeGroupPtrType FindFreeGroup() const;
59  };
60 
61  public: template <typename PolicyT, typename FeaturesT>
62  class Link : public virtual Feature::Link<PolicyT, FeaturesT>
63  {
64  using FreeGroupPtrType = FreeGroupPtr<PolicyT, FeaturesT>;
65  using ConstFreeGroupPtrType = ConstFreeGroupPtr<PolicyT, FeaturesT>;
66 
71  public: FreeGroupPtrType FindFreeGroup();
72 
74  public: ConstFreeGroupPtrType FindFreeGroup() const;
75  };
76 
77  public: template <typename PolicyT, typename FeaturesT>
78  class FreeGroup : public virtual Entity<PolicyT, FeaturesT>
79  {
84  public: LinkPtr<PolicyT, FeaturesT> RootLink();
85 
87  public: ConstLinkPtr<PolicyT, FeaturesT> RootLink() const;
88 
94  public: LinkPtr<PolicyT, FeaturesT> GZ_DEPRECATED(4.0) CanonicalLink();
95 
98  public: ConstLinkPtr<PolicyT, FeaturesT> GZ_DEPRECATED(4.0)
99  CanonicalLink() const;
100  };
101 
102  public: template <typename PolicyT>
103  class Implementation : public virtual Feature::Implementation<PolicyT>
104  {
105  public: virtual Identity FindFreeGroupForModel(
106  const Identity &_modelID) const = 0;
107 
108  public: virtual Identity FindFreeGroupForLink(
109  const Identity &_linkID) const = 0;
110 
111  public: virtual Identity GetFreeGroupRootLink(
112  const Identity &_groupID) const = 0;
113  };
114  };
115 
117  class GZ_PHYSICS_VISIBLE FreeGroupFrameSemantics
118  : public virtual FeatureWithRequirements<
119  FindFreeGroupFeature, FrameSemantics>
120  {
121  public: template <typename PolicyT, typename FeaturesT>
123  };
124 
134  class GZ_PHYSICS_VISIBLE SetFreeGroupWorldPose
135  : public virtual FeatureWithRequirements<FindFreeGroupFeature>
136  {
142  public: template <typename PolicyT, typename FeaturesT>
143  class FreeGroup : public virtual Entity<PolicyT, FeaturesT>
144  {
145  public: using PoseType =
146  typename FromPolicy<PolicyT>::template Use<Pose>;
147 
149  public: void SetWorldPose(const PoseType &_pose);
150  };
151 
152  public: template <typename PolicyT>
153  class Implementation : public virtual Feature::Implementation<PolicyT>
154  {
155  public: using PoseType =
156  typename FromPolicy<PolicyT>::template Use<Pose>;
157 
158  public: virtual void SetFreeGroupWorldPose(
159  const Identity &_groupID,
160  const PoseType &_pose) = 0;
161  };
162  };
163 
167  class GZ_PHYSICS_VISIBLE SetFreeGroupWorldVelocity
168  : public virtual FeatureWithRequirements<FindFreeGroupFeature>
169  {
175  public: template <typename PolicyT, typename FeaturesT>
176  class FreeGroup : public virtual Entity<PolicyT, FeaturesT>
177  {
178  public: using LinearVelocity =
179  typename FromPolicy<PolicyT>::template Use<LinearVector>;
180 
181  public: using AngularVelocity =
182  typename FromPolicy<PolicyT>::template Use<AngularVector>;
183 
186  const LinearVelocity &_linearVelocity);
187 
190  const AngularVelocity &_angularVelocity);
191  };
192 
193  public: template <typename PolicyT>
194  class Implementation : public virtual Feature::Implementation<PolicyT>
195  {
196  public: using LinearVelocity =
197  typename FromPolicy<PolicyT>::template Use<LinearVector>;
198 
199  public: using AngularVelocity =
200  typename FromPolicy<PolicyT>::template Use<AngularVector>;
201 
202  public: virtual void SetFreeGroupWorldLinearVelocity(
203  const Identity &_groupID,
204  const LinearVelocity &_linearVelocity) = 0;
205 
206  public: virtual void SetFreeGroupWorldAngularVelocity(
207  const Identity &_groupID,
208  const AngularVelocity &_angularVelocity) = 0;
209  };
210  };
211  }
212 }
213 
214 #include <gz/physics/detail/FreeGroup.hh>
215 
216 #endif