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 
25 #include "sdf/Element.hh"
26 #include "sdf/Types.hh"
27 #include "sdf/Link.hh"
28 #include "sdf/Joint.hh"
29 #include "sdf/sdf_config.h"
30 #include "sdf/system_util.hh"
31 
32 namespace sdf
33 {
34  // Inline bracke to help doxygen filtering.
35  inline namespace SDF_VERSION_NAMESPACE {
36  //
37 
38  // Forward declare private data class.
39  class AnimationPrivate;
40 
41  // Forward declare private data class.
42  class WaypointPrivate;
43 
44  // Forward declare private data class.
45  class TrajectoryPrivate;
46 
47  // Forward declare private data class.
48  class ActorPrivate;
49 
52  {
54  public: Animation();
55 
58  public: Animation(const Animation &_animation);
59 
62  public: Animation(Animation &&_animation) noexcept;
63 
65  public: ~Animation();
66 
70  public: Animation &operator=(Animation &&_animation);
71 
75  public: Animation &operator=(const Animation &_animation);
76 
83  public: Errors Load(ElementPtr _sdf);
84 
87  public: const std::string &Name() const;
88 
91  public: void SetName(const std::string &_name);
92 
95  public: const std::string &Filename() const;
96 
99  public: void SetFilename(const std::string &_filename);
100 
103  public: const std::string &FilePath() const;
104 
107  public: void SetFilePath(const std::string &_filePath);
108 
111  public: double Scale() const;
112 
115  public: void SetScale(double _scale);
116 
119  public: bool InterpolateX() const;
120 
123  public: void SetInterpolateX(bool _interpolateX);
124 
127  public: void CopyFrom(const Animation &_animation);
128 
130  private: AnimationPrivate *dataPtr = nullptr;
131  };
132 
135  {
137  public: Waypoint();
138 
141  public: Waypoint(const Waypoint &_waypoint);
142 
145  public: Waypoint(Waypoint &&_waypoint) noexcept;
146 
148  public: ~Waypoint();
149 
153  public: Waypoint &operator=(Waypoint &&_waypoint);
154 
158  public: Waypoint &operator=(const Waypoint &_waypoint);
159 
166  public: Errors Load(ElementPtr _sdf);
167 
170  public: double Time() const;
171 
174  public: void SetTime(double _time);
175 
178  public: ignition::math::Pose3d Pose() const;
179 
182  public: void SetPose(const ignition::math::Pose3d &_pose);
183 
186  public: void CopyFrom(const Waypoint &_waypoint);
187 
189  private: WaypointPrivate *dataPtr = nullptr;
190  };
191 
194  {
196  public: Trajectory();
197 
200  public: Trajectory(const Trajectory &_trajectory);
201 
204  public: Trajectory(Trajectory &&_trajectory) noexcept;
205 
207  public: ~Trajectory();
208 
212  public: Trajectory &operator=(Trajectory &&_trajectory);
213 
217  public: Trajectory &operator=(const Trajectory &_trajectory);
218 
225  public: Errors Load(ElementPtr _sdf);
226 
229  public: uint64_t Id() const;
230 
233  public: void SetId(uint64_t _id);
234 
237  public: const std::string &Type() const;
238 
242  public: void SetType(const std::string &_type);
243 
246  public: double Tension() const;
247 
250  public: void SetTension(double _tension);
251 
254  public: uint64_t WaypointCount() const;
255 
261  public: const Waypoint *WaypointByIndex(uint64_t _index) const;
262 
265  public: void AddWaypoint(const Waypoint &_waypoint);
266 
269  public: void CopyFrom(const Trajectory &_trajectory);
270 
272  private: TrajectoryPrivate *dataPtr = nullptr;
273  };
274 
275 
278  {
280  public: Actor();
281 
284  public: Actor(const Actor &_actor);
285 
288  public: Actor(Actor &&_actor) noexcept;
289 
291  public: ~Actor();
292 
296  public: Actor &operator=(Actor &&_actor);
297 
301  public: Actor &operator=(const Actor &_actor);
302 
305  public: void CopyFrom(const Actor &_actor);
306 
313  public: Errors Load(ElementPtr _sdf);
314 
317  public: std::string &Name() const;
318 
321  public: void SetName(const std::string &_name);
322 
329  public: const ignition::math::Pose3d &Pose() const
330  SDF_DEPRECATED(9.0);
331 
336  public: void SetPose(const ignition::math::Pose3d &_pose)
337  SDF_DEPRECATED(9.0);
338 
344  public: const ignition::math::Pose3d &RawPose() const;
345 
349  public: void SetRawPose(const ignition::math::Pose3d &_pose);
350 
355  public: const std::string &PoseRelativeTo() const;
356 
361  public: void SetPoseRelativeTo(const std::string &_frame);
362 
368  public: const std::string &PoseFrame() const
369  SDF_DEPRECATED(9.0);
370 
376  public: void SetPoseFrame(const std::string &_frame)
377  SDF_DEPRECATED(9.0);
378 
381  public: const std::string &FilePath() const;
382 
385  public: void SetFilePath(const std::string &_filePath);
386 
389  public: const std::string &SkinFilename() const;
390 
393  public: void SetSkinFilename(std::string _skinFilename);
394 
397  public: double SkinScale() const;
398 
401  public: void SetSkinScale(double _skinScale);
402 
405  public: uint64_t AnimationCount() const;
406 
412  public: const Animation *AnimationByIndex(uint64_t _index) const;
413 
417  public: bool AnimationNameExists(const std::string &_name) const;
418 
421  public: void AddAnimation(const Animation &_anim);
422 
425  public: bool ScriptLoop() const;
426 
430  public: void SetScriptLoop(bool _scriptLoop);
431 
434  public: double ScriptDelayStart() const;
435 
438  public: void SetScriptDelayStart(double _scriptDelayStart);
439 
442  public: bool ScriptAutoStart() const;
443 
447  public: void SetScriptAutoStart(bool _scriptAutoStart);
448 
451  public: uint64_t TrajectoryCount() const;
452 
458  public: const Trajectory *TrajectoryByIndex(uint64_t _index) const;
459 
463  public: bool TrajectoryIdExists(uint64_t _id) const;
464 
467  public: void AddTrajectory(const Trajectory &_traj);
468 
471  public: uint64_t LinkCount() const;
472 
478  public: const Link *LinkByIndex(uint64_t _index) const;
479 
483  public: bool LinkNameExists(const std::string &_name) const;
484 
487  public: uint64_t JointCount() const;
488 
494  public: const Joint *JointByIndex(uint64_t _index) const;
495 
499  public: bool JointNameExists(const std::string &_name) const;
500 
505  public: sdf::ElementPtr Element() const;
506 
508  private: ActorPrivate *dataPtr = nullptr;
509  };
510  }
511 }
512 #endif
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:32
sdf::v9::Animation
Animation in Actor.
Definition: Actor.hh:51
Types.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::Joint
Definition: Joint.hh:83
sdf::v9::SDF_DEPRECATED
class SDFORMAT_VISIBLE SDF_DEPRECATED(9.2) URDF2SDF
URDF to SDF converter.
Definition: parser_urdf.hh:40
sdf::v9::Trajectory
Trajectory for Animation.
Definition: Actor.hh:193
Joint.hh
sdf::v9::Waypoint
Waypoint for Trajectory.
Definition: Actor.hh:134
sdf::v9::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
sdf::v9::Actor
Provides a description of an actor.
Definition: Actor.hh:277
system_util.hh
sdf::v9::Time
A Time class, can be used to hold wall- or sim-time.
Definition: Types.hh:153
sdf::v9::Element
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
Element.hh