Loading...
Searching...
No Matches
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
32namespace 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
#define SDF_DEPRECATED(version)
Definition Types.hh:38
Provides a description of an actor.
Definition Actor.hh:278
std::string & Name() const
Get the name of the actor.
Actor(Actor &&_actor) noexcept
Move constructor.
void CopyFrom(const Actor &_actor)
Copy dataPtr from an actor instance.
const ignition::math::Pose3d & Pose() const SDF_DEPRECATED(9.0)
Get the pose of the actor.
Errors Load(ElementPtr _sdf)
Load the actor based on a element pointer.
Actor(const Actor &_actor)
Copy constructor.
void SetName(const std::string &_name)
Set the name of the actor.
Actor & operator=(Actor &&_actor)
Move assignment operator.
Actor & operator=(const Actor &_actor)
Assignment operator.
~Actor()
Destructor.
Actor()
Default constructor.
Animation in Actor.
Definition Actor.hh:52
Animation(Animation &&_animation) noexcept
Move constructor.
Animation()
Default constructor.
Animation & operator=(const Animation &_animation)
Assignment operator.
void SetInterpolateX(bool _interpolateX)
Set whether the animation is interpolated on X.
void CopyFrom(const Animation &_animation)
Copy animation from an Animation instance.
Errors Load(ElementPtr _sdf)
Load the animation based on a element pointer.
void SetFilename(const std::string &_filename)
Set the filename of the animation.
const std::string & Name() const
Get the name of the animation.
Animation(const Animation &_animation)
Copy constructor.
bool InterpolateX() const
Get whether the animation is interpolated on X.
const std::string & Filename() const
Get the animation filename.
void SetFilePath(const std::string &_filePath)
Set the path to the file where this element was loaded from.
void SetScale(double _scale)
Set the scale of the animation skeleton.
const std::string & FilePath() const
The path to the file where this element was loaded from.
Animation & operator=(Animation &&_animation)
Move assignment operator.
double Scale() const
Get the scale for the animation skeleton.
void SetName(const std::string &_name)
Set the name of the animation.
~Animation()
Destructor.
SDF Element class.
Definition Element.hh:74
Definition Joint.hh:84
Trajectory for Animation.
Definition Actor.hh:194
Trajectory & operator=(const Trajectory &_trajectory)
Assignment operator.
Trajectory & operator=(Trajectory &&_trajectory)
Move assignment operator.
const Waypoint * WaypointByIndex(uint64_t _index) const
Get a waypoint based on an index.
void SetType(const std::string &_type)
Set the animation type of the trajectory.
Trajectory(const Trajectory &_trajectory)
Copy constructor.
void CopyFrom(const Trajectory &_trajectory)
Copy trajectory from a trajectory instance.
uint64_t Id() const
Get the unique id of the trajectory.
double Tension() const
Get the tension of the trajectory spline.
void SetId(uint64_t _id)
Set the ID of the trajectory.
Trajectory()
Default constructor.
~Trajectory()
Destructor.
void SetTension(double _tension)
Set the tension of trajectory spline.
Errors Load(ElementPtr _sdf)
Load the trajectory based on a element pointer.
uint64_t WaypointCount() const
Get the number of waypoints.
const std::string & Type() const
Get the type of the trajectory.
Trajectory(Trajectory &&_trajectory) noexcept
Move constructor.
void AddWaypoint(const Waypoint &_waypoint)
Add a new waypoint.
Waypoint for Trajectory.
Definition Actor.hh:135
Errors Load(ElementPtr _sdf)
Load the waypoint based on a element pointer.
Waypoint()
Default constructor.
void SetPose(const ignition::math::Pose3d &_pose)
Set the pose to be reached.
double Time() const
Get the time in seconds when the pose should be reached.
void SetTime(double _time)
Set the time in seconds when the pose should be reached.
Waypoint(Waypoint &&_waypoint) noexcept
Move constructor.
Waypoint(const Waypoint &_waypoint)
Copy constructor.
ignition::math::Pose3d Pose() const
Get the pose to be reached.
~Waypoint()
Destructor.
Waypoint & operator=(Waypoint &&_waypoint)
Move assignment operator.
Waypoint & operator=(const Waypoint &_waypoint)
Assignment operator.
void CopyFrom(const Waypoint &_waypoint)
Copy waypoint from an Waypoint instance.
std::vector< Error > Errors
A vector of Error.
Definition Types.hh:89
std::shared_ptr< Element > ElementPtr
Definition Element.hh:53
namespace for Simulation Description Format parser
Definition Actor.hh:33
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:48