Ignition Physics

API Reference

2.0.0
Joint.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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_JOINT_HH_
19 #define IGNITION_PHYSICS_JOINT_HH_
20 
23 
24 namespace ignition
25 {
26  namespace physics
27  {
29  class IGNITION_PHYSICS_VISIBLE GetBasicJointState : public virtual Feature
30  {
32  public: template <typename PolicyT, typename FeaturesT>
33  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
34  {
35  public: using Scalar = typename PolicyT::Scalar;
36  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
37 
44  public: Scalar GetPosition(const std::size_t _dof) const;
45 
52  public: Scalar GetVelocity(const std::size_t _dof) const;
53 
60  public: Scalar GetAcceleration(const std::size_t _dof) const;
61 
68  public: Scalar GetForce(const std::size_t _dof) const;
69 
74  public: Pose GetTransform() const;
75  };
76 
78  public: template <typename PolicyT>
79  class Implementation : public virtual Feature::Implementation<PolicyT>
80  {
81  public: using Scalar = typename PolicyT::Scalar;
82  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
83 
84  // see Joint::GetPosition above
85  public: virtual Scalar GetJointPosition(
86  const Identity &_id, std::size_t _dof) const = 0;
87 
88  // see Joint::GetVelocity above
89  public: virtual Scalar GetJointVelocity(
90  const Identity &_id, std::size_t _dof) const = 0;
91 
92  // see Joint::GetAcceleration above
93  public: virtual Scalar GetJointAcceleration(
94  const Identity &_id, std::size_t _dof) const = 0;
95 
96  // see Joint::GetForce above
97  public: virtual Scalar GetJointForce(
98  const Identity &_id, std::size_t _dof) const = 0;
99 
100  // see Joint::GetTransform above
101  public: virtual Pose GetJointTransform(const Identity &_id) const = 0;
102  };
103  };
104 
106  class IGNITION_PHYSICS_VISIBLE SetBasicJointState : public virtual Feature
107  {
109  public: template <typename PolicyT, typename FeaturesT>
110  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
111  {
112  public: using Scalar = typename PolicyT::Scalar;
113 
122  public: void SetPosition(const std::size_t _dof, const Scalar _value);
123 
132  public: void SetVelocity(const std::size_t _dof, const Scalar _value);
133 
142  public: void SetAcceleration(
143  const std::size_t _dof, const Scalar _value);
144 
153  public: void SetForce(const std::size_t _dof, const Scalar _value);
154  };
155 
157  public: template <typename PolicyT>
158  class Implementation : public virtual Feature::Implementation<PolicyT>
159  {
160  public: using Scalar = typename PolicyT::Scalar;
161 
162  // see Joint::SetPosition above
163  public: virtual void SetJointPosition(
164  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
165 
166  // See Joint::SetVelocity above
167  public: virtual void SetJointVelocity(
168  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
169 
170  // See Joint::SetAcceleration above
171  public: virtual void SetJointAcceleration(
172  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
173 
174  // See Joint::SetForce above
175  public: virtual void SetJointForce(
176  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
177  };
178  };
179 
181  class IGNITION_PHYSICS_VISIBLE GetBasicJointProperties
182  : public virtual Feature
183  {
185  public: template <typename PolicyT, typename FeaturesT>
186  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
187  {
188  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
189 
193  public: std::size_t GetDegreesOfFreedom() const;
194 
207  public: Pose GetTransformFromParent() const;
208 
221  public: Pose GetTransformToChild() const;
222  };
223 
225  public: template <typename PolicyT>
226  class Implementation : public virtual Feature::Implementation<PolicyT>
227  {
228  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
229 
230  public: virtual std::size_t GetJointDegreesOfFreedom(
231  const Identity &_id) const = 0;
232 
233  public: virtual Pose GetJointTransformFromParent(
234  const Identity &_id) const = 0;
235 
236  public: virtual Pose GetJointTransformToChild(
237  const Identity &_id) const = 0;
238  };
239  };
240 
242  class IGNITION_PHYSICS_VISIBLE SetJointTransformFromParentFeature
243  : public virtual Feature
244  {
246  public: template <typename PolicyT, typename FeaturesT>
247  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
248  {
249  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
250 
264  public: void SetTransformFromParent(const Pose &_pose);
265  };
266 
269  public: template <typename PolicyT>
270  class Implementation : public virtual Feature::Implementation<PolicyT>
271  {
272  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
273 
274  // see Joint::SetTransformFromParent above
275  public: virtual void SetJointTransformFromParent(
276  const Identity &_id, const Pose &_pose) = 0;
277  };
278  };
279 
281  class IGNITION_PHYSICS_VISIBLE SetJointTransformToChildFeature
282  : public virtual Feature
283  {
285  public: template <typename PolicyT, typename FeaturesT>
286  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
287  {
288  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
289 
303  public: void SetTransformToChild(const Pose &_pose);
304  };
305 
307  public: template <typename PolicyT>
308  class Implementation : public virtual Feature::Implementation<PolicyT>
309  {
310  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
311 
312  // see Joint::SetTransformToChild above
313  public: virtual void SetJointTransformToChild(
314  const Identity &_id, const Pose &_pose) = 0;
315  };
316  };
317 
319  class IGNITION_PHYSICS_VISIBLE SetJointVelocityCommandFeature
320  : public virtual Feature
321  {
327  public: template <typename PolicyT, typename FeaturesT>
328  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
329  {
330  public: using Scalar = typename PolicyT::Scalar;
331 
340  public: void SetVelocityCommand(
341  const std::size_t _dof, const Scalar _value);
342  };
343 
345  public: template <typename PolicyT>
346  class Implementation : public virtual Feature::Implementation<PolicyT>
347  {
348  public: using Scalar = typename PolicyT::Scalar;
349 
350  // See Joint::SetVelocityCommand above
351  public: virtual void SetJointVelocityCommand(
352  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
353  };
354  };
355 
356  class IGNITION_PHYSICS_VISIBLE DetachJointFeature
357  : public virtual Feature
358  {
359  public: template <typename PolicyT, typename FeaturesT>
360  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
361  {
363  public: void Detach();
364  };
365 
366  public: template <typename PolicyT>
367  class Implementation : public virtual Feature::Implementation<PolicyT>
368  {
369  public: virtual void DetachJoint(const Identity &_jointID) = 0;
370  };
371  };
372  }
373 }
374 
375 #include <ignition/physics/detail/Joint.hh>
376 
377 #endif
typename PolicyT::Scalar Scalar
Definition: Joint.hh:348
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:82
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:36
The Joint API for getting basic joint state.
Definition: Joint.hh:33
The Joint API for setting basic joint state.
Definition: Joint.hh:110
This class defines the concept of a Feature. It should be inherited by classes that define some plugi...
Definition: Feature.hh:35
The Joint API for setting the transform from the joint&#39;s parent.
Definition: Joint.hh:247
typename PolicyT::Scalar Scalar
Definition: Joint.hh:81
This struct is used to conveniently convert from a policy to a geometric type. Example usage: ...
Definition: Geometry.hh:69
The Joint API for setting velocity commands (target velocity). This is different from SetVelocity in ...
Definition: Joint.hh:328
typename PolicyT::Scalar Scalar
Definition: Joint.hh:160
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:188
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:272
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:288
The implementation API for getting basic joint state.
Definition: Joint.hh:79
Placeholder class in case a Feature does not define its own Joint API.
Definition: Feature.hh:76
The implementation API for setting basic joint state.
Definition: Joint.hh:158
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:310
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:249
typename PolicyT::Scalar Scalar
Definition: Joint.hh:112
The implementation API for setting joint velocity commands.
Definition: Joint.hh:346
The implementation API for getting basic joint properties.
Definition: Joint.hh:226
typename PolicyT::Scalar Scalar
Definition: Joint.hh:35
The Joint API for setting the transform to the joint&#39;s child.
Definition: Joint.hh:286
The Joint API for getting basic joint properties.
Definition: Joint.hh:186
typename PolicyT::Scalar Scalar
Definition: Joint.hh:330
The implementation API for setting the transform to the child.
Definition: Joint.hh:308
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:228