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  class Sensor;
40 
44  enum class JointType
45  {
48  INVALID = 0,
49 
51  BALL = 1,
52 
55  CONTINUOUS = 2,
56 
59  FIXED = 3,
60 
62  GEARBOX = 4,
63 
66  PRISMATIC = 5,
67 
70  REVOLUTE = 6,
71 
73  REVOLUTE2 = 7,
74 
77  SCREW = 8,
78 
80  UNIVERSAL = 9
81  };
82 
84  {
86  public: Joint();
87 
90  public: Joint(const Joint &_joint);
91 
94  public: Joint(Joint &&_joint) noexcept;
95 
99  public: Joint &operator=(Joint &&_joint);
100 
104  public: Joint &operator=(const Joint &_joint);
105 
107  public: ~Joint();
108 
115  public: Errors Load(ElementPtr _sdf);
116 
120  public: const std::string &Name() const;
121 
125  public: void SetName(const std::string &_name);
126 
129  public: JointType Type() const;
130 
133  public: void SetType(const JointType _jointType);
134 
137  public: const std::string &ParentLinkName() const;
138 
141  public: void SetParentLinkName(const std::string &_name);
142 
145  public: const std::string &ChildLinkName() const;
146 
149  public: void SetChildLinkName(const std::string &_name);
150 
159  public: const JointAxis *Axis(const unsigned int _index = 0) const;
160 
167  public: void SetAxis(const unsigned int _index, const JointAxis &_axis);
168 
174  public: const ignition::math::Pose3d &RawPose() const;
175 
179  public: void SetRawPose(const ignition::math::Pose3d &_pose);
180 
185  public: const std::string &PoseRelativeTo() const;
186 
191  public: void SetPoseRelativeTo(const std::string &_frame);
192 
195  public: double ThreadPitch() const;
196 
199  public: void SetThreadPitch(double _threadPitch);
200 
205  public: sdf::ElementPtr Element() const;
206 
210  public: sdf::SemanticPose SemanticPose() const;
211 
214  public: uint64_t SensorCount() const;
215 
221  public: const Sensor *SensorByIndex(const uint64_t _index) const;
222 
226  public: bool SensorNameExists(const std::string &_name) const;
227 
233  public: const Sensor *SensorByName(const std::string &_name) const;
234 
239  private: void SetPoseRelativeToGraph(
240  std::weak_ptr<const PoseRelativeToGraph> _graph);
241 
243  friend class Model;
244 
246  private: JointPrivate *dataPtr = nullptr;
247  };
248  }
249 }
250 #endif
A hinge joint that rotates on a single axis with a fixed range of motion.
A single degree of freedom joint with coupled sliding and rotational motion.
JointType
The set of joint types.
Definition: Joint.hh:44
Definition: Model.hh:43
A sliding joint that slides along an axis with a limited range specified by upper and lower limits...
Information about an SDF sensor.
Definition: Sensor.hh:121
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
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 joint with zero degrees of freedom that rigidly connects two links.
Same as two revolute joints connected in series.
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:25
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
namespace for Simulation Description Format parser
Definition: Actor.hh:32
Similar to a ball joint, but constrains one degree of freedom.
Definition: Joint.hh:83
Parameters related to the axis of rotation for rotational joints, and the axis of translation for pri...
Definition: JointAxis.hh:41
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:95