Actor.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2019 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_ACTOR_HH_
18 #define SDF_ACTOR_HH_
19 
20 #include <memory>
21 #include <string>
22 
23 #include <ignition/math/Pose3.hh>
24 #include <ignition/utils/ImplPtr.hh>
25 
26 #include "sdf/Element.hh"
27 #include "sdf/Types.hh"
28 #include "sdf/Link.hh"
29 #include "sdf/Joint.hh"
30 #include "sdf/Plugin.hh"
31 #include "sdf/sdf_config.h"
32 #include "sdf/system_util.hh"
33 
34 namespace sdf
35 {
36  // Inline bracke to help doxygen filtering.
37  inline namespace SDF_VERSION_NAMESPACE {
38  //
41  {
43  public: Animation();
44 
51  public: Errors Load(ElementPtr _sdf);
52 
55  public: const std::string &Name() const;
56 
59  public: void SetName(const std::string &_name);
60 
63  public: const std::string &Filename() const;
64 
67  public: void SetFilename(const std::string &_filename);
68 
71  public: const std::string &FilePath() const;
72 
75  public: void SetFilePath(const std::string &_filePath);
76 
79  public: double Scale() const;
80 
83  public: void SetScale(double _scale);
84 
87  public: bool InterpolateX() const;
88 
91  public: void SetInterpolateX(bool _interpolateX);
92 
94  IGN_UTILS_IMPL_PTR(dataPtr)
95  };
96 
99  {
101  public: Waypoint();
102 
109  public: Errors Load(ElementPtr _sdf);
110 
113  public: double Time() const;
114 
117  public: void SetTime(double _time);
118 
121  public: ignition::math::Pose3d Pose() const;
122 
125  public: void SetPose(const ignition::math::Pose3d &_pose);
126 
128  IGN_UTILS_IMPL_PTR(dataPtr)
129  };
130 
133  {
135  public: Trajectory();
136 
143  public: Errors Load(ElementPtr _sdf);
144 
147  public: uint64_t Id() const;
148 
151  public: void SetId(uint64_t _id);
152 
155  public: const std::string &Type() const;
156 
160  public: void SetType(const std::string &_type);
161 
164  public: double Tension() const;
165 
168  public: void SetTension(double _tension);
169 
172  public: uint64_t WaypointCount() const;
173 
179  public: const Waypoint *WaypointByIndex(uint64_t _index) const;
180 
183  public: void AddWaypoint(const Waypoint &_waypoint);
184 
186  IGN_UTILS_IMPL_PTR(dataPtr)
187  };
188 
189 
192  {
194  public: Actor();
195 
202  public: Errors Load(ElementPtr _sdf);
203 
206  public: const std::string &Name() const;
207 
210  public: void SetName(const std::string &_name);
211 
217  public: const ignition::math::Pose3d &RawPose() const;
218 
222  public: void SetRawPose(const ignition::math::Pose3d &_pose);
223 
228  public: const std::string &PoseRelativeTo() const;
229 
234  public: void SetPoseRelativeTo(const std::string &_frame);
235 
238  public: const std::string &FilePath() const;
239 
242  public: void SetFilePath(const std::string &_filePath);
243 
246  public: const std::string &SkinFilename() const;
247 
250  public: void SetSkinFilename(std::string _skinFilename);
251 
254  public: double SkinScale() const;
255 
258  public: void SetSkinScale(double _skinScale);
259 
262  public: uint64_t AnimationCount() const;
263 
269  public: const Animation *AnimationByIndex(uint64_t _index) const;
270 
274  public: bool AnimationNameExists(const std::string &_name) const;
275 
278  public: void AddAnimation(const Animation &_anim);
279 
282  public: bool ScriptLoop() const;
283 
287  public: void SetScriptLoop(bool _scriptLoop);
288 
291  public: double ScriptDelayStart() const;
292 
295  public: void SetScriptDelayStart(double _scriptDelayStart);
296 
299  public: bool ScriptAutoStart() const;
300 
304  public: void SetScriptAutoStart(bool _scriptAutoStart);
305 
308  public: uint64_t TrajectoryCount() const;
309 
315  public: const Trajectory *TrajectoryByIndex(uint64_t _index) const;
316 
320  public: bool TrajectoryIdExists(uint64_t _id) const;
321 
324  public: void AddTrajectory(const Trajectory &_traj);
325 
328  public: uint64_t LinkCount() const;
329 
335  public: const Link *LinkByIndex(uint64_t _index) const;
336 
340  public: bool LinkNameExists(const std::string &_name) const;
341 
344  public: uint64_t JointCount() const;
345 
351  public: const Joint *JointByIndex(uint64_t _index) const;
352 
356  public: bool JointNameExists(const std::string &_name) const;
357 
362  public: sdf::ElementPtr Element() const;
363 
368  public: bool AddLink(const Link &_link);
369 
374  public: bool AddJoint(const Joint &_joint);
375 
377  public: void ClearLinks();
378 
380  public: void ClearJoints();
381 
387  public: sdf::ElementPtr ToElement() const;
388 
392  public: const sdf::Plugins &Plugins() const;
393 
397  public: sdf::Plugins &Plugins();
398 
400  public: void ClearPlugins();
401 
404  public: void AddPlugin(const Plugin &_plugin);
405 
407  IGN_UTILS_IMPL_PTR(dataPtr)
408  };
409  }
410 }
411 #endif
sdf::v12::Joint
Definition: Joint.hh:85
sdf::v12::Waypoint
Waypoint for Trajectory.
Definition: Actor.hh:98
sdf::v12::Actor
Provides a description of an actor.
Definition: Actor.hh:191
sdf::v12::Animation
Animation in Actor.
Definition: Actor.hh:40
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:34
sdf::v12::Plugins
std::vector< Plugin > Plugins
A vector of Plugin.
Definition: Plugin.hh:165
sdf::v12::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106
Types.hh
sdf_config.h
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:25
sdf::v12::Element
class IGNITION_SDFORMAT_VISIBLE Element
Definition: Element.hh:50
Joint.hh
sdf::v12::Plugin
Definition: Plugin.hh:45
sdf::v12::Time
A Time class, can be used to hold wall- or sim-time.
Definition: Types.hh:117
sdf::v12::Trajectory
Trajectory for Animation.
Definition: Actor.hh:132
system_util.hh
Plugin.hh
sdf::v12::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:54
Element.hh