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 <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
30namespace 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
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
236 const std::string &_name) const;
237
243 public: ParticleEmitter *ParticleEmitterByName(const std::string &_name);
244
258 public: const gz::math::Inertiald &Inertial() const;
259
264 public: bool SetInertial(const gz::math::Inertiald &_inertial);
265
273 public: Errors ResolveInertial(gz::math::Inertiald &_inertial,
274 const std::string &_resolveTo = "") const;
275
279 public: const gz::math::Pose3d &RawPose() const;
280
284 public: void SetRawPose(const gz::math::Pose3d &_pose);
285
290 public: const std::string &PoseRelativeTo() const;
291
296 public: void SetPoseRelativeTo(const std::string &_frame);
297
302 public: sdf::ElementPtr Element() const;
303
308
312 private: void SetPoseRelativeToGraph(
314
316 friend class Model;
317
322 public: bool EnableWind() const;
323
328 public: void SetEnableWind(bool _enableWind);
329
334 public: bool AddCollision(const Collision &_collision);
335
340 public: bool AddVisual(const Visual &_visual);
341
346 public: bool AddLight(const Light &_light);
347
352 public: bool AddSensor(const Sensor &_sensor);
353
358 public: bool AddParticleEmitter(const ParticleEmitter &_sensor);
359
361 public: void ClearCollisions();
362
364 public: void ClearVisuals();
365
367 public: void ClearLights();
368
370 public: void ClearSensors();
371
373 public: void ClearParticleEmitters();
374
380 public: sdf::ElementPtr ToElement() const;
381
383 IGN_UTILS_IMPL_PTR(dataPtr)
384 };
385 }
386}
387#endif
A collision element descibes the collision properties associated with a link.
Definition: Collision.hh:46
Provides a description of a light source.
Definition: Light.hh:64
Definition: Model.hh:55
A description of a particle emitter, which can be attached to a link.
Definition: ParticleEmitter.hh:61
Definition: Collision.hh:39
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:55
Information about an SDF sensor.
Definition: Sensor.hh:137
Definition: Visual.hh:48
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:54
namespace for Simulation Description Format parser
Definition: Actor.hh:35
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:25