Link.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_LINK_HH_
18 #define SDF_LINK_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <gz/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 Collision;
37  class Light;
38  class LinkPrivate;
39  class Sensor;
40  class Visual;
41  class LinkPrivate;
42  struct PoseRelativeToGraph;
43 
45  {
47  public: Link();
48 
51  public: Link(const Link &_link);
52 
55  public: Link(Link &&_link) noexcept;
56 
60  public: Link &operator=(Link &&_link);
61 
65  public: Link &operator=(const Link &_link);
66 
68  public: ~Link();
69 
76  public: Errors Load(ElementPtr _sdf);
77 
81  public: std::string Name() const;
82 
86  public: void SetName(const std::string &_name) const;
87 
90  public: uint64_t VisualCount() const;
91 
97  public: const Visual *VisualByIndex(const uint64_t _index) const;
98 
102  public: bool VisualNameExists(const std::string &_name) const;
103 
107  public: const Visual *VisualByName(const std::string &_name) const;
108 
111  public: uint64_t CollisionCount() const;
112 
118  public: const Collision *CollisionByIndex(const uint64_t _index) const;
119 
123  public: bool CollisionNameExists(const std::string &_name) const;
124 
128  public: const Collision *CollisionByName(const std::string &_name) const;
129 
132  public: uint64_t LightCount() const;
133 
139  public: const Light *LightByIndex(const uint64_t _index) const;
140 
144  public: bool LightNameExists(const std::string &_name) const;
145 
149  public: const Light *LightByName(const std::string &_name) const;
150 
153  public: uint64_t SensorCount() const;
154 
160  public: const Sensor *SensorByIndex(const uint64_t _index) const;
161 
165  public: bool SensorNameExists(const std::string &_name) const;
166 
172  public: const Sensor *SensorByName(const std::string &_name) const;
173 
187  public: const gz::math::Inertiald &Inertial() const;
188 
193  public: bool SetInertial(const gz::math::Inertiald &_inertial);
194 
202  public: Errors ResolveInertial(gz::math::Inertiald &_inertial,
203  const std::string &_resolveTo = "") const;
204 
209  public: const gz::math::Pose3d &Pose() const
210  SDF_DEPRECATED(9.0);
211 
216  public: void SetPose(const gz::math::Pose3d &_pose)
217  SDF_DEPRECATED(9.0);
218 
222  public: const gz::math::Pose3d &RawPose() const;
223 
227  public: void SetRawPose(const gz::math::Pose3d &_pose);
228 
233  public: const std::string &PoseRelativeTo() const;
234 
239  public: void SetPoseRelativeTo(const std::string &_frame);
240 
246  public: const std::string &PoseFrame() const
247  SDF_DEPRECATED(9.0);
248 
254  public: void SetPoseFrame(const std::string &_frame)
255  SDF_DEPRECATED(9.0);
256 
261  public: sdf::ElementPtr Element() const;
262 
266  public: sdf::SemanticPose SemanticPose() const;
267 
272  private: void SetPoseRelativeToGraph(
273  std::weak_ptr<const PoseRelativeToGraph> _graph);
274 
276  friend class Model;
277 
282  public: bool EnableWind() const;
283 
288  public: void SetEnableWind(bool _enableWind);
289 
291  private: LinkPrivate *dataPtr = nullptr;
292  };
293  }
294 }
295 #endif
sdf::v9::Visual
Definition: Visual.hh:45
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:32
Types.hh
SemanticPose.hh
sdf::v9::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:89
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:48
sdf::v9::SDF_DEPRECATED
class SDFORMAT_VISIBLE SDF_DEPRECATED(9.2) URDF2SDF
URDF to SDF converter.
Definition: parser_urdf.hh:40
sdf::v9::Collision
A collision element descibes the collision properties associated with a link.
Definition: Collision.hh:44
sdf::v9::Light
Provides a description of a light source.
Definition: Light.hh:62
sdf::v9::SemanticPose
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:53
sdf::v9::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
sdf::v9::Model
Definition: Model.hh:43
system_util.hh
sdf::v9::Element
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
sdf::SDF_VERSION_NAMESPACE::Sensor
Information about an SDF sensor.
Definition: Sensor.hh:121
Element.hh