Gazebo Physics

API Reference

7.4.0
RevoluteJoint.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_REVOLUTEJOINT_HH_
19 #define GZ_PHYSICS_REVOLUTEJOINT_HH_
20 
21 #include <string>
22 
24 #include <gz/physics/Geometry.hh>
25 
26 namespace gz
27 {
28  namespace physics
29  {
30  GZ_PHYSICS_DECLARE_JOINT_TYPE(RevoluteJoint)
31 
32  class GZ_PHYSICS_VISIBLE GetRevoluteJointProperties
33  : public virtual FeatureWithRequirements<RevoluteJointCast>
34  {
36  public: template <typename PolicyT, typename FeaturesT>
37  class RevoluteJoint : public virtual Entity<PolicyT, FeaturesT>
38  {
39  public: using Axis =
40  typename FromPolicy<PolicyT>::template Use<AngularVector>;
41 
51  public: Axis GetAxis() const;
52  };
53 
56  public: template <typename PolicyT>
57  class Implementation : public virtual Feature::Implementation<PolicyT>
58  {
59  public: using Axis =
60  typename FromPolicy<PolicyT>::template Use<AngularVector>;
61 
65  public: virtual Axis GetRevoluteJointAxis(
66  const Identity &_id) const = 0;
67  };
68  };
69 
73  class GZ_PHYSICS_VISIBLE SetRevoluteJointProperties
74  : public virtual FeatureWithRequirements<RevoluteJointCast>
75  {
77  public: template <typename PolicyT, typename FeaturesT>
78  class RevoluteJoint : public virtual Entity<PolicyT, FeaturesT>
79  {
80  public: using Axis =
81  typename FromPolicy<PolicyT>::template Use<AngularVector>;
82 
91  public: void SetAxis(const Axis &_axis);
92  };
93 
96  public: template <typename PolicyT>
97  class Implementation : public virtual Feature::Implementation<PolicyT>
98  {
99  public: using Axis =
100  typename FromPolicy<PolicyT>::template Use<AngularVector>;
101 
103  public: virtual void SetRevoluteJointAxis(
104  const Identity &_id, const Axis &_axis) = 0;
105  };
106  };
107 
111  class GZ_PHYSICS_VISIBLE AttachRevoluteJointFeature
112  : public virtual FeatureWithRequirements<RevoluteJointCast>
113  {
114  public: template <typename PolicyT, typename FeaturesT>
115  class Link : public virtual Feature::Link<PolicyT, FeaturesT>
116  {
117  public: using Axis =
118  typename FromPolicy<PolicyT>::template Use<AngularVector>;
119 
120  public: using JointPtrType = RevoluteJointPtr<PolicyT, FeaturesT>;
121 
132  //
133  // TODO(MXG): Instead of _name and _axis, consider passing in a struct
134  // containing all base joint properties plus the axis.
136  const BaseLinkPtr<PolicyT> &_parent,
137  const std::string &_name = "revolute",
138  const Axis &_axis = Axis::UnitX());
139  };
140 
141  public: template <typename PolicyT>
142  class Implementation : public virtual Feature::Implementation<PolicyT>
143  {
144  public: using Axis =
145  typename FromPolicy<PolicyT>::template Use<AngularVector>;
146 
157  public: virtual Identity AttachRevoluteJoint(
158  const Identity &_childID,
159  const BaseLinkPtr<PolicyT> &_parent,
160  const std::string &_name,
161  const Axis &_axis) = 0;
162  };
163  };
164  }
165 }
166 
167 #include <gz/physics/detail/RevoluteJoint.hh>
168 
169 #endif