Ignition Physics

API Reference

2.3.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  {
33  class IGNITION_PHYSICS_VISIBLE GetBasicJointState : public virtual Feature
34  {
36  public: template <typename PolicyT, typename FeaturesT>
37  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
38  {
39  public: using Scalar = typename PolicyT::Scalar;
40  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
41 
48  public: Scalar GetPosition(const std::size_t _dof) const;
49 
56  public: Scalar GetVelocity(const std::size_t _dof) const;
57 
64  public: Scalar GetAcceleration(const std::size_t _dof) const;
65 
72  public: Scalar GetForce(const std::size_t _dof) const;
73 
78  public: Pose GetTransform() const;
79  };
80 
82  public: template <typename PolicyT>
83  class Implementation : public virtual Feature::Implementation<PolicyT>
84  {
85  public: using Scalar = typename PolicyT::Scalar;
86  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
87 
88  // see Joint::GetPosition above
89  public: virtual Scalar GetJointPosition(
90  const Identity &_id, std::size_t _dof) const = 0;
91 
92  // see Joint::GetVelocity above
93  public: virtual Scalar GetJointVelocity(
94  const Identity &_id, std::size_t _dof) const = 0;
95 
96  // see Joint::GetAcceleration above
97  public: virtual Scalar GetJointAcceleration(
98  const Identity &_id, std::size_t _dof) const = 0;
99 
100  // see Joint::GetForce above
101  public: virtual Scalar GetJointForce(
102  const Identity &_id, std::size_t _dof) const = 0;
103 
104  // see Joint::GetTransform above
105  public: virtual Pose GetJointTransform(const Identity &_id) const = 0;
106  };
107  };
108 
113  class IGNITION_PHYSICS_VISIBLE SetBasicJointState : public virtual Feature
114  {
116  public: template <typename PolicyT, typename FeaturesT>
117  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
118  {
119  public: using Scalar = typename PolicyT::Scalar;
120 
129  public: void SetPosition(const std::size_t _dof, const Scalar _value);
130 
139  public: void SetVelocity(const std::size_t _dof, const Scalar _value);
140 
149  public: void SetAcceleration(
150  const std::size_t _dof, const Scalar _value);
151 
160  public: void SetForce(const std::size_t _dof, const Scalar _value);
161  };
162 
164  public: template <typename PolicyT>
165  class Implementation : public virtual Feature::Implementation<PolicyT>
166  {
167  public: using Scalar = typename PolicyT::Scalar;
168 
169  // see Joint::SetPosition above
170  public: virtual void SetJointPosition(
171  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
172 
173  // See Joint::SetVelocity above
174  public: virtual void SetJointVelocity(
175  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
176 
177  // See Joint::SetAcceleration above
178  public: virtual void SetJointAcceleration(
179  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
180 
181  // See Joint::SetForce above
182  public: virtual void SetJointForce(
183  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
184  };
185  };
186 
192  class IGNITION_PHYSICS_VISIBLE GetBasicJointProperties
193  : public virtual Feature
194  {
196  public: template <typename PolicyT, typename FeaturesT>
197  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
198  {
199  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
200 
204  public: std::size_t GetDegreesOfFreedom() const;
205 
218  public: Pose GetTransformFromParent() const;
219 
232  public: Pose GetTransformToChild() const;
233  };
234 
236  public: template <typename PolicyT>
237  class Implementation : public virtual Feature::Implementation<PolicyT>
238  {
239  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
240 
241  public: virtual std::size_t GetJointDegreesOfFreedom(
242  const Identity &_id) const = 0;
243 
244  public: virtual Pose GetJointTransformFromParent(
245  const Identity &_id) const = 0;
246 
247  public: virtual Pose GetJointTransformToChild(
248  const Identity &_id) const = 0;
249  };
250  };
251 
253  class IGNITION_PHYSICS_VISIBLE SetJointTransformFromParentFeature
254  : public virtual Feature
255  {
257  public: template <typename PolicyT, typename FeaturesT>
258  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
259  {
260  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
261 
275  public: void SetTransformFromParent(const Pose &_pose);
276  };
277 
280  public: template <typename PolicyT>
281  class Implementation : public virtual Feature::Implementation<PolicyT>
282  {
283  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
284 
285  // see Joint::SetTransformFromParent above
286  public: virtual void SetJointTransformFromParent(
287  const Identity &_id, const Pose &_pose) = 0;
288  };
289  };
290 
292  class IGNITION_PHYSICS_VISIBLE SetJointTransformToChildFeature
293  : public virtual Feature
294  {
296  public: template <typename PolicyT, typename FeaturesT>
297  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
298  {
299  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
300 
314  public: void SetTransformToChild(const Pose &_pose);
315  };
316 
318  public: template <typename PolicyT>
319  class Implementation : public virtual Feature::Implementation<PolicyT>
320  {
321  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
322 
323  // see Joint::SetTransformToChild above
324  public: virtual void SetJointTransformToChild(
325  const Identity &_id, const Pose &_pose) = 0;
326  };
327  };
328 
332  class IGNITION_PHYSICS_VISIBLE SetJointVelocityCommandFeature
333  : public virtual Feature
334  {
340  public: template <typename PolicyT, typename FeaturesT>
341  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
342  {
343  public: using Scalar = typename PolicyT::Scalar;
344 
353  public: void SetVelocityCommand(
354  const std::size_t _dof, const Scalar _value);
355  };
356 
358  public: template <typename PolicyT>
359  class Implementation : public virtual Feature::Implementation<PolicyT>
360  {
361  public: using Scalar = typename PolicyT::Scalar;
362 
363  // See Joint::SetVelocityCommand above
364  public: virtual void SetJointVelocityCommand(
365  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
366  };
367  };
368 
369  class IGNITION_PHYSICS_VISIBLE DetachJointFeature
370  : public virtual Feature
371  {
372  public: template <typename PolicyT, typename FeaturesT>
373  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
374  {
376  public: void Detach();
377  };
378 
379  public: template <typename PolicyT>
380  class Implementation : public virtual Feature::Implementation<PolicyT>
381  {
382  public: virtual void DetachJoint(const Identity &_jointID) = 0;
383  };
384  };
385  }
386 }
387 
388 #include <ignition/physics/detail/Joint.hh>
389 
390 #endif
typename PolicyT::Scalar Scalar
Definition: Joint.hh:361
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:86
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:40
This feature retrieves the generalized joint states such as position, velocity, acceleration of the j...
Definition: Joint.hh:33
The Joint API for getting basic joint state.
Definition: Joint.hh:37
The Joint API for setting basic joint state.
Definition: Joint.hh:117
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:258
typename PolicyT::Scalar Scalar
Definition: Joint.hh:85
This struct is used to conveniently convert from a policy to a geometric type. Example usage: ...
Definition: Geometry.hh:69
This feature sets the commanded value of generalized velocity of this Joint.
Definition: Joint.hh:332
The Joint API for setting velocity commands (target velocity). This is different from SetVelocity in ...
Definition: Joint.hh:341
typename PolicyT::Scalar Scalar
Definition: Joint.hh:167
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:199
This feature retrieves the generalized joint properties such as Degrees Of Freedom (DoF)...
Definition: Joint.hh:192
This feature sets the generalized joint states such as position, velocity, acceleration of the joint ...
Definition: Joint.hh:113
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:283
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:299
The implementation API for getting basic joint state.
Definition: Joint.hh:83
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:165
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:321
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:260
typename PolicyT::Scalar Scalar
Definition: Joint.hh:119
The implementation API for setting joint velocity commands.
Definition: Joint.hh:359
The implementation API for getting basic joint properties.
Definition: Joint.hh:237
typename PolicyT::Scalar Scalar
Definition: Joint.hh:39
The Joint API for setting the transform to the joint&#39;s child.
Definition: Joint.hh:297
The Joint API for getting basic joint properties.
Definition: Joint.hh:197
typename PolicyT::Scalar Scalar
Definition: Joint.hh:343
The implementation API for setting the transform to the child.
Definition: Joint.hh:319
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:239