Gazebo Gazebo

API Reference

6.16.0
gz/sim/Actor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 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 GZ_GAZEBO_ACTOR_HH_
18 #define GZ_GAZEBO_ACTOR_HH_
19 
20 #include <memory>
21 #include <optional>
22 #include <string>
23 
24 #include <gz/math/Pose3.hh>
25 
26 #include <gz/utils/ImplPtr.hh>
27 
28 #include "gz/sim/config.hh"
30 #include "gz/sim/Export.hh"
31 #include "gz/sim/Types.hh"
32 
33 namespace ignition
34 {
35  namespace gazebo
36  {
37  // Inline bracket to help doxygen filtering.
38  inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
39  //
59  class IGNITION_GAZEBO_VISIBLE Actor
60  {
63  public: explicit Actor(gazebo::Entity _entity = kNullEntity);
64 
67  public: gazebo::Entity Entity() const;
68 
71  public: void ResetEntity(gazebo::Entity _newEntity);
72 
77  public: bool Valid(const EntityComponentManager &_ecm) const;
78 
83  public: std::optional<std::string> Name(
84  const EntityComponentManager &_ecm) const;
85 
93  public: std::optional<math::Pose3d> Pose(
94  const EntityComponentManager &_ecm) const;
95 
104  public: std::optional<math::Pose3d> TrajectoryPose(
105  const EntityComponentManager &_ecm) const;
106 
115  public: void SetTrajectoryPose(EntityComponentManager &_ecm,
116  const math::Pose3d &_pose);
117 
128  public: std::optional<math::Pose3d> WorldPose(
129  const EntityComponentManager &_ecm) const;
130 
134  public: void SetAnimationName(EntityComponentManager &_ecm,
135  const std::string &_name);
136 
140  public: void SetAnimationTime(EntityComponentManager &_ecm,
141  const std::chrono::steady_clock::duration &_time);
142 
146  public: std::optional<std::string> AnimationName(
147  const EntityComponentManager &_ecm) const;
148 
152  public: std::optional<std::chrono::steady_clock::duration> AnimationTime(
153  const EntityComponentManager &_ecm) const;
154 
156  IGN_UTILS_IMPL_PTR(dataPtr)
157  };
158  }
159  }
160 }
161 #endif
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light....
Definition: gz/sim/Entity.hh:58
This library is part of the Gazebo project.
STL class.
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:66
void ResetEntity(gazebo::Entity _newEntity)
Reset Entity to a new one.
std::optional< std::string > AnimationName(const EntityComponentManager &_ecm) const
Get the name of animation used by the actor.
std::optional< math::Pose3d > Pose(const EntityComponentManager &_ecm) const
Get the pose of the actor. If the actor has a trajectory, this will only return the origin pose of th...
void SetAnimationName(EntityComponentManager &_ecm, const std::string &_name)
Set the name of animation to use for this actor.
Actor(gazebo::Entity _entity=kNullEntity)
Constructor.
std::optional< std::string > Name(const EntityComponentManager &_ecm) const
Get the actor's unscoped name.
void SetTrajectoryPose(EntityComponentManager &_ecm, const math::Pose3d &_pose)
Set the trajectory pose of the actor. There are two ways that the actor can follow a trajectory: 1) S...
This class provides wrappers around entities and components which are more convenient and straight-fo...
Definition: gz/sim/Actor.hh:59
Component< gz::math::Pose3d, class PoseTag > Pose
A component type that contains pose, gz::math::Pose3d, information.
Definition: gz/sim/components/Pose.hh:35
const Entity kNullEntity
Indicates a non-existant or invalid Entity.
Definition: gz/sim/Entity.hh:61
Component< sdf::Actor, class ActorTag, serializers::ActorSerializer > Actor
This component contains actor source information. For more information on actors, see SDF's Actor ele...
Definition: gz/sim/components/Actor.hh:80
bool Valid(const EntityComponentManager &_ecm) const
Check whether this actor correctly refers to an entity that has a components::Actor.
std::optional< math::Pose3d > WorldPose(const EntityComponentManager &_ecm) const
Get the world pose of the actor. This returns the current world pose of the actor computed by gazebo....
std::optional< std::chrono::steady_clock::duration > AnimationTime(const EntityComponentManager &_ecm) const
Get the time of animation for this actor.
std::optional< math::Pose3d > TrajectoryPose(const EntityComponentManager &_ecm) const
Get the trajectory pose of the actor. There are two ways that the actor can follow a trajectory: 1) S...
gazebo::Entity Entity() const
Get the entity which this Actor is related to.
void SetAnimationTime(EntityComponentManager &_ecm, const std::chrono::steady_clock::duration &_time)
Set the time of animation for this actor.
Component< std::string, class NameTag, serializers::StringSerializer > Name
This component holds an entity's name. The component has no concept of scoped names nor does it care ...
Definition: gz/sim/components/Name.hh:37