This class provides wrappers around entities and components which are more convenient and straight-forward to use than dealing with the EntityComponentManager
directly. All the functions provided here are meant to be used with a sensor entity.
More...
#include <ignition/gazebo/Sensor.hh>
Public Member Functions | |
Sensor (gazebo::Entity _entity=kNullEntity) | |
Constructor. More... | |
gazebo::Entity | Entity () const |
Get the entity which this Sensor is related to. More... | |
std::optional< std::string > | Name (const EntityComponentManager &_ecm) const |
Get the sensor's unscoped name. More... | |
std::optional< gazebo::Entity > | Parent (const EntityComponentManager &_ecm) const |
Get the parent entity. This can be a link or a joint. More... | |
std::optional< math::Pose3d > | Pose (const EntityComponentManager &_ecm) const |
Get the pose of the sensor. More... | |
void | ResetEntity (gazebo::Entity _newEntity) |
Reset Entity to a new one. More... | |
std::optional< std::string > | Topic (const EntityComponentManager &_ecm) const |
Get the topic of the sensor. More... | |
bool | Valid (const EntityComponentManager &_ecm) const |
Check whether this sensor correctly refers to an entity that has a components::Sensor. More... | |
Detailed Description
This class provides wrappers around entities and components which are more convenient and straight-forward to use than dealing with the EntityComponentManager
directly. All the functions provided here are meant to be used with a sensor entity.
For example, given a sensor's entity, find the value of its name component, one could use the entity-component manager (ecm
) directly as follows:
std::string name = ecm.Component<components::Name>(entity)->Data();
Using this class however, the same information can be obtained with a simpler function call:
Sensor sensor(entity); std::string name = sensor.Name(ecm);
Constructor & Destructor Documentation
◆ Sensor()
|
explicit |
Constructor.
- Parameters
-
[in] _entity Sensor entity
Member Function Documentation
◆ Entity()
gazebo::Entity Entity | ( | ) | const |
◆ Name()
std::optional<std::string> Name | ( | const EntityComponentManager & | _ecm | ) | const |
Get the sensor's unscoped name.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Sensor's name or nullopt if the entity does not have a components::Name component
◆ Parent()
std::optional<gazebo::Entity> Parent | ( | const EntityComponentManager & | _ecm | ) | const |
Get the parent entity. This can be a link or a joint.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Parent entity or nullopt if the entity does not have a components::ParentEntity component.
◆ Pose()
std::optional<math::Pose3d> Pose | ( | const EntityComponentManager & | _ecm | ) | const |
Get the pose of the sensor.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Pose of the sensor or nullopt if the entity does not have a components::Pose component.
◆ ResetEntity()
void ResetEntity | ( | gazebo::Entity | _newEntity | ) |
Reset Entity to a new one.
- Parameters
-
[in] _newEntity New sensor entity.
◆ Topic()
std::optional<std::string> Topic | ( | const EntityComponentManager & | _ecm | ) | const |
Get the topic of the sensor.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Topic of the sensor or nullopt if the entity does not have a components::SensorTopic component.
◆ Valid()
bool Valid | ( | const EntityComponentManager & | _ecm | ) | const |
Check whether this sensor correctly refers to an entity that has a components::Sensor.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- True if it's a valid sensor in the manager.
The documentation for this class was generated from the following file: