Joint.hh
Go to the documentation of this file.
1 /*
2  * Copyright 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 #ifndef SDF_JOINT_HH_
18 #define SDF_JOINT_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <ignition/math/Pose3.hh>
23 #include "sdf/Element.hh"
24 #include "sdf/SemanticPose.hh"
25 #include "sdf/Types.hh"
26 #include "sdf/sdf_config.h"
27 #include "sdf/system_util.hh"
28 
29 namespace sdf
30 {
31  // Inline bracket to help doxygen filtering.
32  inline namespace SDF_VERSION_NAMESPACE {
33  //
34 
35  // Forward declarations.
36  class JointAxis;
37  class JointPrivate;
38  struct PoseRelativeToGraph;
39 
43  enum class JointType
44  {
47  INVALID = 0,
48 
50  BALL = 1,
51 
54  CONTINUOUS = 2,
55 
58  FIXED = 3,
59 
61  GEARBOX = 4,
62 
65  PRISMATIC = 5,
66 
69  REVOLUTE = 6,
70 
72  REVOLUTE2 = 7,
73 
76  SCREW = 8,
77 
79  UNIVERSAL = 9
80  };
81 
83  {
85  public: Joint();
86 
89  public: Joint(const Joint &_joint);
90 
93  public: Joint(Joint &&_joint) noexcept;
94 
98  public: Joint &operator=(Joint &&_joint);
99 
103  public: Joint &operator=(const Joint &_joint);
104 
106  public: ~Joint();
107 
114  public: Errors Load(ElementPtr _sdf);
115 
119  public: const std::string &Name() const;
120 
124  public: void SetName(const std::string &_name);
125 
128  public: JointType Type() const;
129 
132  public: void SetType(const JointType _jointType);
133 
136  public: const std::string &ParentLinkName() const;
137 
140  public: void SetParentLinkName(const std::string &_name);
141 
144  public: const std::string &ChildLinkName() const;
145 
148  public: void SetChildLinkName(const std::string &_name);
149 
158  public: const JointAxis *Axis(const unsigned int _index = 0) const;
159 
166  public: void SetAxis(const unsigned int _index, const JointAxis &_axis);
167 
174  public: const ignition::math::Pose3d &Pose() const
175  SDF_DEPRECATED(9.0);
176 
181  public: void SetPose(const ignition::math::Pose3d &_pose)
182  SDF_DEPRECATED(9.0);
183 
189  public: const ignition::math::Pose3d &RawPose() const;
190 
194  public: void SetRawPose(const ignition::math::Pose3d &_pose);
195 
200  public: const std::string &PoseRelativeTo() const;
201 
206  public: void SetPoseRelativeTo(const std::string &_frame);
207 
213  public: const std::string &PoseFrame() const
214  SDF_DEPRECATED(9.0);
215 
221  public: void SetPoseFrame(const std::string &_frame)
222  SDF_DEPRECATED(9.0);
223 
226  public: double ThreadPitch() const;
227 
230  public: void SetThreadPitch(double _threadPitch);
231 
236  public: sdf::ElementPtr Element() const;
237 
241  public: sdf::SemanticPose SemanticPose() const;
242 
247  private: void SetPoseRelativeToGraph(
248  std::weak_ptr<const PoseRelativeToGraph> _graph);
249 
251  friend class Model;
252 
254  private: JointPrivate *dataPtr = nullptr;
255  };
256  }
257 }
258 #endif
Definition: Model.hh:43
A hinge joint that rotates on a single axis with a fixed range of motion.
An invalid joint.
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
A sliding joint that slides along an axis with a limited range specified by upper and lower limits...
A hinge joint that rotates on a single axis with a continuous range of motion.
Similar to a ball joint, but constrains one degree of freedom.
Same as two revolute joints connected in series.
A ball and socket joint.
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:89
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
JointType
The set of joint types.
Definition: Joint.hh:43
Definition: Joint.hh:82
Parameters related to the axis of rotation for rotational joints, and the axis of translation for pri...
Definition: JointAxis.hh:40
A joint with zero degrees of freedom that rigidly connects two links.
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:53
Geared revolute joint.
namespace for Simulation Description Format parser
Definition: Actor.hh:32
A single degree of freedom joint with coupled sliding and rotational motion.
#define SDF_DEPRECATED(version)
Definition: Types.hh:38