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 <ignition/math/Pose3.hh>
23 #include <ignition/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 Collision;
38  class Light;
39  class ParticleEmitter;
40  class Sensor;
41  class Visual;
42  struct PoseRelativeToGraph;
43  template <typename T> class ScopedGraph;
44 
46  {
48  public: Link();
49 
56  public: Errors Load(ElementPtr _sdf);
57 
61  public: std::string Name() const;
62 
66  public: void SetName(const std::string &_name);
67 
70  public: uint64_t VisualCount() const;
71 
77  public: const Visual *VisualByIndex(const uint64_t _index) const;
78 
84  public: Visual *VisualByIndex(uint64_t _index);
85 
89  public: bool VisualNameExists(const std::string &_name) const;
90 
94  public: const Visual *VisualByName(const std::string &_name) const;
95 
99  public: Visual *VisualByName(const std::string &_name);
100 
103  public: uint64_t CollisionCount() const;
104 
110  public: const Collision *CollisionByIndex(const uint64_t _index) const;
111 
117  public: Collision *CollisionByIndex(uint64_t _index);
118 
122  public: bool CollisionNameExists(const std::string &_name) const;
123 
127  public: const Collision *CollisionByName(const std::string &_name) const;
128 
132  public: Collision *CollisionByName(const std::string &_name);
133 
136  public: uint64_t LightCount() const;
137 
143  public: const Light *LightByIndex(const uint64_t _index) const;
144 
150  public: Light *LightByIndex(uint64_t _index);
151 
155  public: bool LightNameExists(const std::string &_name) const;
156 
160  public: const Light *LightByName(const std::string &_name) const;
161 
165  public: Light *LightByName(const std::string &_name);
166 
169  public: uint64_t SensorCount() const;
170 
176  public: const Sensor *SensorByIndex(const uint64_t _index) const;
177 
183  public: Sensor *SensorByIndex(uint64_t _index);
184 
188  public: bool SensorNameExists(const std::string &_name) const;
189 
195  public: const Sensor *SensorByName(const std::string &_name) const;
196 
202  public: Sensor *SensorByName(const std::string &_name);
203 
206  public: uint64_t ParticleEmitterCount() const;
207 
214  public: const ParticleEmitter *ParticleEmitterByIndex(
215  const uint64_t _index) const;
216 
223  public: ParticleEmitter *ParticleEmitterByIndex(uint64_t _index);
224 
228  public: bool ParticleEmitterNameExists(const std::string &_name) const;
229 
235  public: const ParticleEmitter *ParticleEmitterByName(
236  const std::string &_name) const;
237 
243  public: ParticleEmitter *ParticleEmitterByName(const std::string &_name);
244 
258  public: const ignition::math::Inertiald &Inertial() const;
259 
264  public: bool SetInertial(const ignition::math::Inertiald &_inertial);
265 
269  public: const ignition::math::Pose3d &RawPose() const;
270 
274  public: void SetRawPose(const ignition::math::Pose3d &_pose);
275 
280  public: const std::string &PoseRelativeTo() const;
281 
286  public: void SetPoseRelativeTo(const std::string &_frame);
287 
292  public: sdf::ElementPtr Element() const;
293 
297  public: sdf::SemanticPose SemanticPose() const;
298 
302  private: void SetPoseRelativeToGraph(
304 
306  friend class Model;
307 
312  public: bool EnableWind() const;
313 
318  public: void SetEnableWind(bool _enableWind);
319 
324  public: bool AddCollision(const Collision &_collision);
325 
330  public: bool AddVisual(const Visual &_visual);
331 
336  public: bool AddLight(const Light &_light);
337 
342  public: bool AddSensor(const Sensor &_sensor);
343 
348  public: bool AddParticleEmitter(const ParticleEmitter &_sensor);
349 
351  public: void ClearCollisions();
352 
354  public: void ClearVisuals();
355 
357  public: void ClearLights();
358 
360  public: void ClearSensors();
361 
363  public: void ClearParticleEmitters();
364 
370  public: sdf::ElementPtr ToElement() const;
371 
373  IGN_UTILS_IMPL_PTR(dataPtr)
374  };
375  }
376 }
377 #endif
sdf::v12::Visual
Definition: Visual.hh:47
sdf::v12::ScopedGraph
Definition: Collision.hh:39
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:34
sdf::v12::Light
Provides a description of a light source.
Definition: Light.hh:63
sdf::v12::Model
Definition: Model.hh:54
sdf::v12::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106
sdf::v12::Collision
A collision element descibes the collision properties associated with a link.
Definition: Collision.hh:45
Types.hh
SemanticPose.hh
sdf_config.h
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:25
sdf::v12::ParticleEmitter
A description of a particle emitter, which can be attached to a link.
Definition: ParticleEmitter.hh:60
sdf::v12::Element
class IGNITION_SDFORMAT_VISIBLE Element
Definition: Element.hh:50
sdf::v12::SemanticPose
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:54
system_util.hh
sdf::v12::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:54
sdf::v12::Sensor
Information about an SDF sensor.
Definition: Sensor.hh:136
Element.hh