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 <gz/math/Pose3.hh>
23 #include <gz/utils/ImplPtr.hh>
24 #include "sdf/Element.hh"
25 #include "sdf/SemanticPose.hh"
26 #include "sdf/Types.hh"
27 #include "sdf/sdf_config.h"
28 #include "sdf/system_util.hh"
29 
30 namespace sdf
31 {
32  // Inline bracket to help doxygen filtering.
33  inline namespace SDF_VERSION_NAMESPACE {
34  //
35 
36  // Forward declarations.
37  class JointAxis;
38  struct FrameAttachedToGraph;
39  struct PoseRelativeToGraph;
40  template <typename T> class ScopedGraph;
41  class Sensor;
42 
46  enum class JointType
47  {
50  INVALID = 0,
51 
53  BALL = 1,
54 
57  CONTINUOUS = 2,
58 
61  FIXED = 3,
62 
64  GEARBOX = 4,
65 
68  PRISMATIC = 5,
69 
72  REVOLUTE = 6,
73 
75  REVOLUTE2 = 7,
76 
79  SCREW = 8,
80 
82  UNIVERSAL = 9
83  };
84 
86  {
88  public: Joint();
89 
96  public: Errors Load(ElementPtr _sdf);
97 
101  public: const std::string &Name() const;
102 
106  public: void SetName(const std::string &_name);
107 
110  public: JointType Type() const;
111 
114  public: void SetType(const JointType _jointType);
115 
118  public: const std::string &ParentName() const;
119 
122  public: void SetParentName(const std::string &_name);
123 
126  public: const std::string &ChildName() const;
127 
130  public: void SetChildName(const std::string &_name);
131 
135  public: GZ_DEPRECATED(13) const std::string &ParentLinkName() const;
136 
140  public: GZ_DEPRECATED(13) void SetParentLinkName(const std::string &_name);
141 
145  public: GZ_DEPRECATED(13) const std::string &ChildLinkName() const;
146 
150  public: GZ_DEPRECATED(13) void SetChildLinkName(const std::string &_name);
151 
156  public: Errors ResolveChildLink(std::string &_link) const;
157 
162  public: Errors ResolveParentLink(std::string &_link) const;
163 
172  public: const JointAxis *Axis(const unsigned int _index = 0) const;
173 
180  public: void SetAxis(const unsigned int _index, const JointAxis &_axis);
181 
187  public: const gz::math::Pose3d &RawPose() const;
188 
192  public: void SetRawPose(const gz::math::Pose3d &_pose);
193 
198  public: const std::string &PoseRelativeTo() const;
199 
204  public: void SetPoseRelativeTo(const std::string &_frame);
205 
210  public: double ScrewThreadPitch() const;
211 
215  public: void SetScrewThreadPitch(double _threadPitch);
216 
221  public: double ThreadPitch() const;
222 
227  public: void SetThreadPitch(double _threadPitch);
228 
233  public: sdf::ElementPtr Element() const;
234 
238  public: sdf::SemanticPose SemanticPose() const;
239 
242  public: uint64_t SensorCount() const;
243 
249  public: const Sensor *SensorByIndex(const uint64_t _index) const;
250 
256  public: Sensor *SensorByIndex(uint64_t _index);
257 
261  public: bool SensorNameExists(const std::string &_name) const;
262 
268  public: const Sensor *SensorByName(const std::string &_name) const;
269 
275  public: Sensor *SensorByName(const std::string &_name);
276 
282  public: sdf::ElementPtr ToElement() const;
283 
288  public: bool AddSensor(const Sensor &_sensor);
289 
291  public: void ClearSensors();
292 
297  private: void SetFrameAttachedToGraph(
299 
303  private: void SetPoseRelativeToGraph(
305 
307  friend class Model;
308 
310  friend class World;
311 
313  GZ_UTILS_IMPL_PTR(dataPtr)
314  };
315  }
316 }
317 #endif
sdf::SDF_VERSION_NAMESPACE::GZ_DEPRECATED
class GZ_SDFORMAT_VISIBLE GZ_DEPRECATED(13) Inertia
A class for inertial information about a link.
Definition: Types.hh:147
sdf::SDF_VERSION_NAMESPACE::JointType::FIXED
@ FIXED
A joint with zero degrees of freedom that rigidly connects two links.
sdf::SDF_VERSION_NAMESPACE::JointAxis
Parameters related to the axis of rotation for rotational joints, and the axis of translation for pri...
Definition: JointAxis.hh:42
sdf::SDF_VERSION_NAMESPACE::Model
Definition: Model.hh:54
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:34
sdf::SDF_VERSION_NAMESPACE::JointType::REVOLUTE2
@ REVOLUTE2
Same as two revolute joints connected in series.
sdf::SDF_VERSION_NAMESPACE::JointType::REVOLUTE
@ REVOLUTE
A hinge joint that rotates on a single axis with a fixed range of motion.
Types.hh
sdf::SDF_VERSION_NAMESPACE::JointType::GEARBOX
@ GEARBOX
Geared revolute joint.
SemanticPose.hh
sdf_config.h
sdf::SDF_VERSION_NAMESPACE::JointType::CONTINUOUS
@ CONTINUOUS
A hinge joint that rotates on a single axis with a continuous range of motion.
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:25
sdf::SDF_VERSION_NAMESPACE::JointType::PRISMATIC
@ PRISMATIC
A sliding joint that slides along an axis with a limited range specified by upper and lower limits.
sdf::SDF_VERSION_NAMESPACE::JointType::SCREW
@ SCREW
A single degree of freedom joint with coupled sliding and rotational motion.
sdf::SDF_VERSION_NAMESPACE::JointType
JointType
Definition: Joint.hh:46
sdf::SDF_VERSION_NAMESPACE::JointType::INVALID
@ INVALID
An invalid joint.
sdf::SDF_VERSION_NAMESPACE::Joint
Definition: Joint.hh:85
sdf::SDF_VERSION_NAMESPACE::Element
class GZ_SDFORMAT_VISIBLE Element
Definition: Element.hh:51
sdf::SDF_VERSION_NAMESPACE::SemanticPose
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:54
sdf::SDF_VERSION_NAMESPACE::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:80
sdf::SDF_VERSION_NAMESPACE::ScopedGraph
Definition: Collision.hh:40
sdf::SDF_VERSION_NAMESPACE::JointType::BALL
@ BALL
A ball and socket joint.
sdf::SDF_VERSION_NAMESPACE::JointType::UNIVERSAL
@ UNIVERSAL
Similar to a ball joint, but constrains one degree of freedom.
system_util.hh
sdf::SDF_VERSION_NAMESPACE::World
Definition: World.hh:58
sdf::SDF_VERSION_NAMESPACE::Sensor
Information about an SDF sensor.
Definition: Sensor.hh:140
sdf::SDF_VERSION_NAMESPACE::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:55
Element.hh