Ignition Physics

API Reference

5.1.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 
24 
25 namespace ignition
26 {
27  namespace physics
28  {
34  class IGNITION_PHYSICS_VISIBLE GetBasicJointState : public virtual Feature
35  {
37  public: template <typename PolicyT, typename FeaturesT>
38  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
39  {
40  public: using Scalar = typename PolicyT::Scalar;
41  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
42 
49  public: Scalar GetPosition(const std::size_t _dof) const;
50 
57  public: Scalar GetVelocity(const std::size_t _dof) const;
58 
65  public: Scalar GetAcceleration(const std::size_t _dof) const;
66 
73  public: Scalar GetForce(const std::size_t _dof) const;
74 
79  public: Pose GetTransform() const;
80  };
81 
83  public: template <typename PolicyT>
84  class Implementation : public virtual Feature::Implementation<PolicyT>
85  {
86  public: using Scalar = typename PolicyT::Scalar;
87  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
88 
89  // see Joint::GetPosition above
90  public: virtual Scalar GetJointPosition(
91  const Identity &_id, std::size_t _dof) const = 0;
92 
93  // see Joint::GetVelocity above
94  public: virtual Scalar GetJointVelocity(
95  const Identity &_id, std::size_t _dof) const = 0;
96 
97  // see Joint::GetAcceleration above
98  public: virtual Scalar GetJointAcceleration(
99  const Identity &_id, std::size_t _dof) const = 0;
100 
101  // see Joint::GetForce above
102  public: virtual Scalar GetJointForce(
103  const Identity &_id, std::size_t _dof) const = 0;
104 
105  // see Joint::GetTransform above
106  public: virtual Pose GetJointTransform(const Identity &_id) const = 0;
107  };
108  };
109 
114  class IGNITION_PHYSICS_VISIBLE SetBasicJointState : public virtual Feature
115  {
117  public: template <typename PolicyT, typename FeaturesT>
118  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
119  {
120  public: using Scalar = typename PolicyT::Scalar;
121 
130  public: void SetPosition(const std::size_t _dof, const Scalar _value);
131 
140  public: void SetVelocity(const std::size_t _dof, const Scalar _value);
141 
150  public: void SetAcceleration(
151  const std::size_t _dof, const Scalar _value);
152 
161  public: void SetForce(const std::size_t _dof, const Scalar _value);
162  };
163 
165  public: template <typename PolicyT>
166  class Implementation : public virtual Feature::Implementation<PolicyT>
167  {
168  public: using Scalar = typename PolicyT::Scalar;
169 
170  // see Joint::SetPosition above
171  public: virtual void SetJointPosition(
172  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
173 
174  // See Joint::SetVelocity above
175  public: virtual void SetJointVelocity(
176  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
177 
178  // See Joint::SetAcceleration above
179  public: virtual void SetJointAcceleration(
180  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
181 
182  // See Joint::SetForce above
183  public: virtual void SetJointForce(
184  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
185  };
186  };
187 
193  class IGNITION_PHYSICS_VISIBLE GetBasicJointProperties
194  : public virtual Feature
195  {
197  public: template <typename PolicyT, typename FeaturesT>
198  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
199  {
200  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
201 
205  public: std::size_t GetDegreesOfFreedom() const;
206 
219  public: Pose GetTransformFromParent() const;
220 
233  public: Pose GetTransformToChild() const;
234  };
235 
237  public: template <typename PolicyT>
238  class Implementation : public virtual Feature::Implementation<PolicyT>
239  {
240  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
241 
242  public: virtual std::size_t GetJointDegreesOfFreedom(
243  const Identity &_id) const = 0;
244 
245  public: virtual Pose GetJointTransformFromParent(
246  const Identity &_id) const = 0;
247 
248  public: virtual Pose GetJointTransformToChild(
249  const Identity &_id) const = 0;
250  };
251  };
252 
254  class IGNITION_PHYSICS_VISIBLE SetJointTransformFromParentFeature
255  : public virtual Feature
256  {
258  public: template <typename PolicyT, typename FeaturesT>
259  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
260  {
261  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
262 
276  public: void SetTransformFromParent(const Pose &_pose);
277  };
278 
281  public: template <typename PolicyT>
282  class Implementation : public virtual Feature::Implementation<PolicyT>
283  {
284  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
285 
286  // see Joint::SetTransformFromParent above
287  public: virtual void SetJointTransformFromParent(
288  const Identity &_id, const Pose &_pose) = 0;
289  };
290  };
291 
293  class IGNITION_PHYSICS_VISIBLE SetJointTransformToChildFeature
294  : public virtual Feature
295  {
297  public: template <typename PolicyT, typename FeaturesT>
298  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
299  {
300  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
301 
315  public: void SetTransformToChild(const Pose &_pose);
316  };
317 
319  public: template <typename PolicyT>
320  class Implementation : public virtual Feature::Implementation<PolicyT>
321  {
322  public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
323 
324  // see Joint::SetTransformToChild above
325  public: virtual void SetJointTransformToChild(
326  const Identity &_id, const Pose &_pose) = 0;
327  };
328  };
329 
333  class IGNITION_PHYSICS_VISIBLE SetJointVelocityCommandFeature
334  : public virtual Feature
335  {
341  public: template <typename PolicyT, typename FeaturesT>
342  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
343  {
344  public: using Scalar = typename PolicyT::Scalar;
345 
354  public: void SetVelocityCommand(
355  const std::size_t _dof, const Scalar _value);
356  };
357 
359  public: template <typename PolicyT>
360  class Implementation : public virtual Feature::Implementation<PolicyT>
361  {
362  public: using Scalar = typename PolicyT::Scalar;
363 
364  // See Joint::SetVelocityCommand above
365  public: virtual void SetJointVelocityCommand(
366  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
367  };
368  };
369 
373  class IGNITION_PHYSICS_VISIBLE SetJointPositionLimitsFeature
374  : public virtual Feature
375  {
377  public: template <typename PolicyT, typename FeaturesT>
378  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
379  {
380  public: using Scalar = typename PolicyT::Scalar;
381 
390  public: void SetMinPosition(
391  const std::size_t _dof, const Scalar _value);
392 
401  public: void SetMaxPosition(
402  const std::size_t _dof, const Scalar _value);
403  };
404 
406  public: template <typename PolicyT>
407  class Implementation : public virtual Feature::Implementation<PolicyT>
408  {
409  public: using Scalar = typename PolicyT::Scalar;
410 
411  // See Joint::SetMinPositionCommand above
412  public: virtual void SetJointMinPosition(
413  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
414 
415  // See Joint::SetMaxPositionCommand above
416  public: virtual void SetJointMaxPosition(
417  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
418  };
419  };
420 
424  class IGNITION_PHYSICS_VISIBLE SetJointVelocityLimitsFeature
425  : public virtual Feature
426  {
429  public: template <typename PolicyT, typename FeaturesT>
430  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
431  {
432  public: using Scalar = typename PolicyT::Scalar;
433 
442  public: void SetMinVelocity(
443  const std::size_t _dof, const Scalar _value);
444 
453  public: void SetMaxVelocity(
454  const std::size_t _dof, const Scalar _value);
455  };
456 
458  public: template <typename PolicyT>
459  class Implementation : public virtual Feature::Implementation<PolicyT>
460  {
461  public: using Scalar = typename PolicyT::Scalar;
462 
463  // See Joint::SetMinVelocityCommand above
464  public: virtual void SetJointMinVelocity(
465  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
466 
467  // See Joint::SetMaxVelocityCommand above
468  public: virtual void SetJointMaxVelocity(
469  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
470  };
471  };
472 
475  class IGNITION_PHYSICS_VISIBLE SetJointEffortLimitsFeature
476  : public virtual Feature
477  {
481  public: template <typename PolicyT, typename FeaturesT>
482  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
483  {
484  public: using Scalar = typename PolicyT::Scalar;
485 
493  public: void SetMinEffort(const std::size_t _dof, const Scalar _value);
494 
502  public: void SetMaxEffort(const std::size_t _dof, const Scalar _value);
503  };
504 
506  public: template <typename PolicyT>
507  class Implementation : public virtual Feature::Implementation<PolicyT>
508  {
509  public: using Scalar = typename PolicyT::Scalar;
510 
511  // See Joint::SetMinEffortCommand above
512  public: virtual void SetJointMinEffort(
513  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
514 
515  // See Joint::SetMaxEffortCommand above
516  public: virtual void SetJointMaxEffort(
517  const Identity &_id, std::size_t _dof, Scalar _value) = 0;
518  };
519  };
520 
521  class IGNITION_PHYSICS_VISIBLE DetachJointFeature
522  : public virtual Feature
523  {
524  public: template <typename PolicyT, typename FeaturesT>
525  class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
526  {
528  public: void Detach();
529  };
530 
531  public: template <typename PolicyT>
532  class Implementation : public virtual Feature::Implementation<PolicyT>
533  {
534  public: virtual void DetachJoint(const Identity &_jointID) = 0;
535  };
536  };
537 
538  class IGNITION_PHYSICS_VISIBLE GetJointTransmittedWrench
539  : public virtual FeatureWithRequirements<JointFrameSemantics>
540  {
541  public: template <typename PolicyT, typename FeaturesT>
542  class Joint
543  : public virtual JointFrameSemantics::Joint<PolicyT, FeaturesT>
544  {
545  public: using Wrench = typename FromPolicy<
546  PolicyT>::template Use<Wrench>;
547 
556  public: Wrench GetTransmittedWrench() const;
557 
572  public: Wrench GetTransmittedWrench(
573  const FrameID &_relativeTo,
574  const FrameID &_inCoordinatesOf) const;
575  };
576 
577  public: template <typename PolicyT>
578  class Implementation : public virtual Feature::Implementation<PolicyT>
579  {
580  public: using Wrench = typename FromPolicy<
581  PolicyT>::template Use<Wrench>;
582  public: virtual Wrench GetJointTransmittedWrenchInJointFrame(
583  const Identity &_jointID) const = 0;
584  };
585  };
586 
587  }
588 }
589 
590 #include <ignition/physics/detail/Joint.hh>
591 
592 #endif
typename PolicyT::Scalar Scalar
Definition: Joint.hh:362
typename PolicyT::Scalar Scalar
Definition: Joint.hh:484
This feature sets the min and max generalized position of this Joint.
Definition: Joint.hh:373
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:87
If your feature is known to require any other features, then you should have your feature class inher...
Definition: FeatureList.hh:108
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:41
This feature retrieves the generalized joint states such as position, velocity, acceleration of the j...
Definition: Joint.hh:34
The Joint API for getting basic joint state.
Definition: Joint.hh:38
The Joint API for setting basic joint state.
Definition: Joint.hh:118
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:259
typename PolicyT::Scalar Scalar
Definition: Joint.hh:86
This struct is used to conveniently convert from a policy to a geometric type. Example usage: ...
Definition: Geometry.hh:77
The Joint API for setting effort limits of a joint. These limits are applied to joints controlled via...
Definition: Joint.hh:482
This feature sets the commanded value of generalized velocity of this Joint.
Definition: Joint.hh:333
The Joint API for setting velocity commands (target velocity). This is different from SetVelocity in ...
Definition: Joint.hh:342
typename PolicyT::Scalar Scalar
Definition: Joint.hh:168
Base class for the API of a Frame. This will be inherited by any objects that are able to express Fra...
Definition: FrameSemantics.hh:41
typename PolicyT::Scalar Scalar
Definition: Joint.hh:432
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:200
typename PolicyT::Scalar Scalar
Definition: Joint.hh:461
typename PolicyT::Scalar Scalar
Definition: Joint.hh:380
The Joint API for setting velocity limits of a joint. These limits apply to joints commanded via velo...
Definition: Joint.hh:430
This feature retrieves the generalized joint properties such as Degrees Of Freedom (DoF)...
Definition: Joint.hh:193
This feature sets the generalized joint states such as position, velocity, acceleration of the joint ...
Definition: Joint.hh:114
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:284
This feature sets the min and max value of generalized velocity of this Joint.
Definition: Joint.hh:424
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:300
The implementation API for setting effort limit commands.
Definition: Joint.hh:507
The implementation API for getting basic joint state.
Definition: Joint.hh:84
Placeholder class in case a Feature does not define its own Joint API.
Definition: Feature.hh:76
typename FromPolicy< PolicyT >::template Use< Wrench > Wrench
Definition: Joint.hh:581
The implementation API for setting basic joint state.
Definition: Joint.hh:166
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:322
The Joint API for setting position limits of a joint.
Definition: Joint.hh:378
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:261
typename PolicyT::Scalar Scalar
Definition: Joint.hh:509
typename PolicyT::Scalar Scalar
Definition: Joint.hh:409
The implementation API for setting velocity limit commands.
Definition: Joint.hh:459
The implementation API for setting position limit commands.
Definition: Joint.hh:407
This feature sets the min and max value of effort of this Joint.
Definition: Joint.hh:475
typename FromPolicy< PolicyT >::template Use< Wrench > Wrench
Definition: Joint.hh:546
typename PolicyT::Scalar Scalar
Definition: Joint.hh:120
The implementation API for setting joint velocity commands.
Definition: Joint.hh:360
The implementation API for getting basic joint properties.
Definition: Joint.hh:238
typename PolicyT::Scalar Scalar
Definition: Joint.hh:40
The Joint API for setting the transform to the joint&#39;s child.
Definition: Joint.hh:298
The Joint API for getting basic joint properties.
Definition: Joint.hh:198
typename PolicyT::Scalar Scalar
Definition: Joint.hh:344
Container for specifying Frame IDs. We do not want to use a generic integer type for this...
Definition: FrameID.hh:46
The implementation API for setting the transform to the child.
Definition: Joint.hh:320
typename FromPolicy< PolicyT >::template Use< Pose > Pose
Definition: Joint.hh:240