Gazebo Physics

API Reference

8.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 GZ_PHYSICS_JOINT_HH_
19#define GZ_PHYSICS_JOINT_HH_
20
24
25#include <string>
26
27namespace gz
28{
29 namespace physics
30 {
36 class GZ_PHYSICS_VISIBLE GetBasicJointState : public virtual Feature
37 {
39 public: template <typename PolicyT, typename FeaturesT>
40 class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
41 {
42 public: using Scalar = typename PolicyT::Scalar;
43 public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
44
51 public: Scalar GetPosition(const std::size_t _dof) const;
52
59 public: Scalar GetVelocity(const std::size_t _dof) const;
60
67 public: Scalar GetAcceleration(const std::size_t _dof) const;
68
75 public: Scalar GetForce(const std::size_t _dof) const;
76
81 public: Pose GetTransform() const;
82 };
83
85 public: template <typename PolicyT>
86 class Implementation : public virtual Feature::Implementation<PolicyT>
87 {
88 public: using Scalar = typename PolicyT::Scalar;
89 public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
90
91 // see Joint::GetPosition above
92 public: virtual Scalar GetJointPosition(
93 const Identity &_id, std::size_t _dof) const = 0;
94
95 // see Joint::GetVelocity above
96 public: virtual Scalar GetJointVelocity(
97 const Identity &_id, std::size_t _dof) const = 0;
98
99 // see Joint::GetAcceleration above
101 const Identity &_id, std::size_t _dof) const = 0;
102
103 // see Joint::GetForce above
104 public: virtual Scalar GetJointForce(
105 const Identity &_id, std::size_t _dof) const = 0;
106
107 // see Joint::GetTransform above
108 public: virtual Pose GetJointTransform(const Identity &_id) const = 0;
109 };
110 };
111
116 class GZ_PHYSICS_VISIBLE SetBasicJointState : public virtual Feature
117 {
119 public: template <typename PolicyT, typename FeaturesT>
120 class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
121 {
122 public: using Scalar = typename PolicyT::Scalar;
123
132 public: void SetPosition(const std::size_t _dof, const Scalar _value);
133
142 public: void SetVelocity(const std::size_t _dof, const Scalar _value);
143
152 public: void SetAcceleration(
153 const std::size_t _dof, const Scalar _value);
154
163 public: void SetForce(const std::size_t _dof, const Scalar _value);
164 };
165
167 public: template <typename PolicyT>
168 class Implementation : public virtual Feature::Implementation<PolicyT>
169 {
170 public: using Scalar = typename PolicyT::Scalar;
171
172 // see Joint::SetPosition above
173 public: virtual void SetJointPosition(
174 const Identity &_id, std::size_t _dof, Scalar _value) = 0;
175
176 // See Joint::SetVelocity above
177 public: virtual void SetJointVelocity(
178 const Identity &_id, std::size_t _dof, Scalar _value) = 0;
179
180 // See Joint::SetAcceleration above
181 public: virtual void SetJointAcceleration(
182 const Identity &_id, std::size_t _dof, Scalar _value) = 0;
183
184 // See Joint::SetForce above
185 public: virtual void SetJointForce(
186 const Identity &_id, std::size_t _dof, Scalar _value) = 0;
187 };
188 };
189
195 class GZ_PHYSICS_VISIBLE GetBasicJointProperties
196 : public virtual Feature
197 {
199 public: template <typename PolicyT, typename FeaturesT>
200 class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
201 {
202 public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
203
208
222
235 public: Pose GetTransformToChild() const;
236 };
237
239 public: template <typename PolicyT>
240 class Implementation : public virtual Feature::Implementation<PolicyT>
241 {
242 public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
243
245 const Identity &_id) const = 0;
246
248 const Identity &_id) const = 0;
249
251 const Identity &_id) const = 0;
252 };
253 };
254
256 class GZ_PHYSICS_VISIBLE SetJointTransformFromParentFeature
257 : public virtual Feature
258 {
260 public: template <typename PolicyT, typename FeaturesT>
261 class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
262 {
263 public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
264
278 public: void SetTransformFromParent(const Pose &_pose);
279 };
280
283 public: template <typename PolicyT>
284 class Implementation : public virtual Feature::Implementation<PolicyT>
285 {
286 public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
287
288 // see Joint::SetTransformFromParent above
289 public: virtual void SetJointTransformFromParent(
290 const Identity &_id, const Pose &_pose) = 0;
291 };
292 };
293
295 class GZ_PHYSICS_VISIBLE SetJointTransformToChildFeature
296 : public virtual Feature
297 {
299 public: template <typename PolicyT, typename FeaturesT>
300 class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
301 {
302 public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
303
317 public: void SetTransformToChild(const Pose &_pose);
318 };
319
321 public: template <typename PolicyT>
322 class Implementation : public virtual Feature::Implementation<PolicyT>
323 {
324 public: using Pose = typename FromPolicy<PolicyT>::template Use<Pose>;
325
326 // see Joint::SetTransformToChild above
327 public: virtual void SetJointTransformToChild(
328 const Identity &_id, const Pose &_pose) = 0;
329 };
330 };
331
335 class GZ_PHYSICS_VISIBLE SetJointVelocityCommandFeature
336 : public virtual Feature
337 {
343 public: template <typename PolicyT, typename FeaturesT>
344 class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
345 {
346 public: using Scalar = typename PolicyT::Scalar;
347
356 public: void SetVelocityCommand(
357 const std::size_t _dof, const Scalar _value);
358 };
359
361 public: template <typename PolicyT>
362 class Implementation : public virtual Feature::Implementation<PolicyT>
363 {
364 public: using Scalar = typename PolicyT::Scalar;
365
366 // See Joint::SetVelocityCommand above
367 public: virtual void SetJointVelocityCommand(
368 const Identity &_id, std::size_t _dof, Scalar _value) = 0;
369 };
370 };
371
375 class GZ_PHYSICS_VISIBLE SetJointPositionLimitsFeature
376 : public virtual Feature
377 {
379 public: template <typename PolicyT, typename FeaturesT>
380 class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
381 {
382 public: using Scalar = typename PolicyT::Scalar;
383
392 public: void SetMinPosition(
393 const std::size_t _dof, const Scalar _value);
394
403 public: void SetMaxPosition(
404 const std::size_t _dof, const Scalar _value);
405 };
406
408 public: template <typename PolicyT>
409 class Implementation : public virtual Feature::Implementation<PolicyT>
410 {
411 public: using Scalar = typename PolicyT::Scalar;
412
413 // See Joint::SetMinPositionCommand above
414 public: virtual void SetJointMinPosition(
415 const Identity &_id, std::size_t _dof, Scalar _value) = 0;
416
417 // See Joint::SetMaxPositionCommand above
418 public: virtual void SetJointMaxPosition(
419 const Identity &_id, std::size_t _dof, Scalar _value) = 0;
420 };
421 };
422
426 class GZ_PHYSICS_VISIBLE SetJointVelocityLimitsFeature
427 : public virtual Feature
428 {
431 public: template <typename PolicyT, typename FeaturesT>
432 class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
433 {
434 public: using Scalar = typename PolicyT::Scalar;
435
444 public: void SetMinVelocity(
445 const std::size_t _dof, const Scalar _value);
446
455 public: void SetMaxVelocity(
456 const std::size_t _dof, const Scalar _value);
457 };
458
460 public: template <typename PolicyT>
461 class Implementation : public virtual Feature::Implementation<PolicyT>
462 {
463 public: using Scalar = typename PolicyT::Scalar;
464
465 // See Joint::SetMinVelocityCommand above
466 public: virtual void SetJointMinVelocity(
467 const Identity &_id, std::size_t _dof, Scalar _value) = 0;
468
469 // See Joint::SetMaxVelocityCommand above
470 public: virtual void SetJointMaxVelocity(
471 const Identity &_id, std::size_t _dof, Scalar _value) = 0;
472 };
473 };
474
477 class GZ_PHYSICS_VISIBLE SetJointEffortLimitsFeature
478 : public virtual Feature
479 {
483 public: template <typename PolicyT, typename FeaturesT>
484 class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
485 {
486 public: using Scalar = typename PolicyT::Scalar;
487
495 public: void SetMinEffort(const std::size_t _dof, const Scalar _value);
496
504 public: void SetMaxEffort(const std::size_t _dof, const Scalar _value);
505 };
506
508 public: template <typename PolicyT>
509 class Implementation : public virtual Feature::Implementation<PolicyT>
510 {
511 public: using Scalar = typename PolicyT::Scalar;
512
513 // See Joint::SetMinEffortCommand above
514 public: virtual void SetJointMinEffort(
515 const Identity &_id, std::size_t _dof, Scalar _value) = 0;
516
517 // See Joint::SetMaxEffortCommand above
518 public: virtual void SetJointMaxEffort(
519 const Identity &_id, std::size_t _dof, Scalar _value) = 0;
520 };
521 };
522
523 class GZ_PHYSICS_VISIBLE DetachJointFeature
524 : public virtual Feature
525 {
526 public: template <typename PolicyT, typename FeaturesT>
527 class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
528 {
530 public: void Detach();
531 };
532
533 public: template <typename PolicyT>
534 class Implementation : public virtual Feature::Implementation<PolicyT>
535 {
536 public: virtual void DetachJoint(const Identity &_jointID) = 0;
537 };
538 };
539
540 class GZ_PHYSICS_VISIBLE GetJointTransmittedWrench
541 : public virtual FeatureWithRequirements<JointFrameSemantics>
542 {
543 public: template <typename PolicyT, typename FeaturesT>
544 class Joint
545 : public virtual JointFrameSemantics::Joint<PolicyT, FeaturesT>
546 {
547 public: using Wrench = typename FromPolicy<
548 PolicyT>::template Use<Wrench>;
549
559
575 const FrameID &_relativeTo,
576 const FrameID &_inCoordinatesOf) const;
577 };
578
579 public: template <typename PolicyT>
580 class Implementation : public virtual Feature::Implementation<PolicyT>
581 {
582 public: using Wrench = typename FromPolicy<
583 PolicyT>::template Use<Wrench>;
585 const Identity &_jointID) const = 0;
586 };
587 };
588
598 class GZ_PHYSICS_VISIBLE SetMimicConstraintFeature
599 : public virtual Feature
600 {
601 public: template <typename PolicyT, typename FeaturesT>
602 class Joint : public virtual Feature::Joint<PolicyT, FeaturesT>
603 {
604 public: using Scalar = typename PolicyT::Scalar;
605
629 public: bool SetMimicConstraint(
630 std::size_t _dof,
631 const BaseJointPtr<PolicyT> &_leaderJoint,
632 std::size_t _leaderAxisDof,
633 Scalar _multiplier,
634 Scalar _offset,
635 Scalar _reference);
636 };
637
639 public: template <typename PolicyT>
640 class Implementation : public virtual Feature::Implementation<PolicyT>
641 {
642 public: using Scalar = typename PolicyT::Scalar;
643
644 // See Joint::MimicConstraint above
645 public: virtual bool SetJointMimicConstraint(
646 const Identity &_id,
647 std::size_t _dof,
648 const BaseJointPtr<PolicyT> &_leaderJoint,
649 std::size_t _leaderAxisDof,
650 Scalar _multiplier,
651 Scalar _offset,
652 Scalar _reference) = 0;
653 };
654 };
655 }
656}
657
658#include <gz/physics/detail/Joint.hh>
659
660#endif