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 
173  public: const ignition::math::Pose3d &RawPose() const;
174 
178  public: void SetRawPose(const ignition::math::Pose3d &_pose);
179 
184  public: const std::string &PoseRelativeTo() const;
185 
190  public: void SetPoseRelativeTo(const std::string &_frame);
191 
194  public: double ThreadPitch() const;
195 
198  public: void SetThreadPitch(double _threadPitch);
199 
204  public: sdf::ElementPtr Element() const;
205 
209  public: sdf::SemanticPose SemanticPose() const;
210 
215  private: void SetPoseRelativeToGraph(
216  std::weak_ptr<const PoseRelativeToGraph> _graph);
217 
219  friend class Model;
220 
222  private: JointPrivate *dataPtr = nullptr;
223  };
224  }
225 }
226 #endif
Same as two revolute joints connected in series.
Geared revolute joint.
Similar to a ball joint, but constrains one degree of freedom.
Definition: Joint.hh:82
A hinge joint that rotates on a single axis with a fixed range of motion.
A sliding joint that slides along an axis with a limited range specified by upper and lower limits...
Definition: Model.hh:43
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
A joint with zero degrees of freedom that rigidly connects two links.
A ball and socket joint.
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:53
A hinge joint that rotates on a single axis with a continuous range of motion.
A single degree of freedom joint with coupled sliding and rotational motion.
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
namespace for Simulation Description Format parser
Definition: Actor.hh:32
JointType
The set of joint types.
Definition: Joint.hh:43
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:95
Parameters related to the axis of rotation for rotational joints, and the axis of translation for pri...
Definition: JointAxis.hh:41