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 model entity.
More...
#include <ignition/gazebo/Model.hh>
Public Member Functions | |
Model (gazebo::Entity _entity=kNullEntity) | |
Constructor. More... | |
Model (const Model &_model) | |
Copy constructor. More... | |
Model (Model &&_model) noexcept | |
Move constructor. More... | |
virtual | ~Model () |
Destructor. More... | |
gazebo::Entity | Entity () const |
Get the entity which this Model is related to. More... | |
gazebo::Entity | JointByName (const EntityComponentManager &_ecm, const std::string &_name) |
Get the ID of a joint entity which is an immediate child of this model. More... | |
gazebo::Entity | LinkByName (const EntityComponentManager &_ecm, const std::string &_name) |
Get the ID of a link entity which is an immediate child of this model. More... | |
std::string | Name (const EntityComponentManager &_ecm) const |
Get the model's unscoped name. More... | |
Model & | operator= (Model &&_model) noexcept |
Move assignment operator. More... | |
Model & | operator= (const Model &_model) |
Copy assignment operator. More... | |
bool | Valid (const EntityComponentManager &_ecm) const |
Check whether this model correctly refers to an entity that has a components::Model. 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 model entity.
For example, given a model's entity, to 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:
Model model(entity); std::string name = model.Name(ecm);
- Todo:
- (louise) Store the ecm instead of passing it at every API call.
Constructor & Destructor Documentation
◆ Model() [1/3]
|
explicit |
Constructor.
- Parameters
-
[in] _entity Model entity
◆ Model() [2/3]
◆ Model() [3/3]
◆ ~Model()
|
virtual |
Destructor.
Member Function Documentation
◆ Entity()
gazebo::Entity Entity | ( | ) | const |
◆ JointByName()
gazebo::Entity JointByName | ( | const EntityComponentManager & | _ecm, |
const std::string & | _name | ||
) |
Get the ID of a joint entity which is an immediate child of this model.
- Parameters
-
[in] _ecm Entity-component manager. [in] _name Joint name.
- Returns
- Joint entity.
◆ LinkByName()
gazebo::Entity LinkByName | ( | const EntityComponentManager & | _ecm, |
const std::string & | _name | ||
) |
Get the ID of a link entity which is an immediate child of this model.
- Parameters
-
[in] _ecm Entity-component manager. [in] _name Link name.
- Returns
- Link entity.
◆ Name()
std::string Name | ( | const EntityComponentManager & | _ecm | ) | const |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ Valid()
bool Valid | ( | const EntityComponentManager & | _ecm | ) | const |
Check whether this model correctly refers to an entity that has a components::Model.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- True if it's a valid model in the manager.
The documentation for this class was generated from the following file: