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 (const Model &_model) | |
Copy constructor. More... | |
Model (gz::sim::Entity _entity=kNullEntity) | |
Constructor. More... | |
Model (Model &&_model) noexcept | |
Move constructor. More... | |
virtual | ~Model () |
Destructor. More... | |
gz::sim::Entity | CanonicalLink (const EntityComponentManager &_ecm) const |
Get the model's canonical link entity. More... | |
gz::sim::Entity | Entity () const |
Get the entity which this Model is related to. More... | |
gz::sim::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... | |
uint64_t | JointCount (const EntityComponentManager &_ecm) const |
Get the number of joints which are immediate children of this model. More... | |
std::vector< gz::sim::Entity > | Joints (const EntityComponentManager &_ecm) const |
Get all joints which are immediate children of this model. More... | |
gz::sim::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... | |
uint64_t | LinkCount (const EntityComponentManager &_ecm) const |
Get the number of links which are immediate children of this model. More... | |
std::vector< gz::sim::Entity > | Links (const EntityComponentManager &_ecm) const |
Get all links which are immediate children of this model. More... | |
std::vector< gz::sim::Entity > | Models (const EntityComponentManager &_ecm) const |
Get all models which are immediate children of this model. More... | |
std::string | Name (const EntityComponentManager &_ecm) const |
Get the model's unscoped name. More... | |
Model & | operator= (const Model &_model) |
Copy assignment operator. More... | |
Model & | operator= (Model &&_model) noexcept |
Move assignment operator. More... | |
bool | SelfCollide (const EntityComponentManager &_ecm) const |
Get whether this model has self-collide enabled. More... | |
void | SetWorldPoseCmd (EntityComponentManager &_ecm, const math::Pose3d &_pose) |
Set a command to change the model's pose. More... | |
std::string | SourceFilePath (const EntityComponentManager &_ecm) const |
Get the source file where this model came from. If empty, the model wasn't loaded directly from a file, probably from an SDF string. More... | |
bool | Static (const EntityComponentManager &_ecm) const |
Get whether this model is static. More... | |
bool | Valid (const EntityComponentManager &_ecm) const |
Check whether this model correctly refers to an entity that has a components::Model. More... | |
bool | WindMode (const EntityComponentManager &_ecm) const |
Get whether this model has wind enabled. 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
◆ CanonicalLink()
gz::sim::Entity CanonicalLink | ( | const EntityComponentManager & | _ecm | ) | const |
Get the model's canonical link entity.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Link entity.
◆ Entity()
gz::sim::Entity Entity | ( | ) | const |
◆ JointByName()
gz::sim::Entity JointByName | ( | const EntityComponentManager & | _ecm, |
const std::string & | _name | ||
) |
◆ JointCount()
uint64_t JointCount | ( | const EntityComponentManager & | _ecm | ) | const |
Get the number of joints which are immediate children of this model.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Number of joints in this model.
◆ Joints()
std::vector<gz::sim::Entity> Joints | ( | const EntityComponentManager & | _ecm | ) | const |
Get all joints which are immediate children of this model.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- All joints in this model.
◆ LinkByName()
gz::sim::Entity LinkByName | ( | const EntityComponentManager & | _ecm, |
const std::string & | _name | ||
) |
◆ LinkCount()
uint64_t LinkCount | ( | const EntityComponentManager & | _ecm | ) | const |
Get the number of links which are immediate children of this model.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Number of links in this model.
◆ Links()
std::vector<gz::sim::Entity> Links | ( | const EntityComponentManager & | _ecm | ) | const |
Get all links which are immediate children of this model.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- All links in this model.
◆ Models()
std::vector<gz::sim::Entity> Models | ( | const EntityComponentManager & | _ecm | ) | const |
Get all models which are immediate children of this model.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- All models in this model.
◆ Name()
std::string Name | ( | const EntityComponentManager & | _ecm | ) | const |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ SelfCollide()
bool SelfCollide | ( | const EntityComponentManager & | _ecm | ) | const |
Get whether this model has self-collide enabled.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- True if self-colliding.
◆ SetWorldPoseCmd()
void SetWorldPoseCmd | ( | EntityComponentManager & | _ecm, |
const math::Pose3d & | _pose | ||
) |
Set a command to change the model's pose.
- Parameters
-
[in] _ecm Entity-component manager. [in] _pose New model pose.
◆ SourceFilePath()
std::string SourceFilePath | ( | const EntityComponentManager & | _ecm | ) | const |
Get the source file where this model came from. If empty, the model wasn't loaded directly from a file, probably from an SDF string.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Path to the source SDF file.
◆ Static()
bool Static | ( | const EntityComponentManager & | _ecm | ) | const |
Get whether this model is static.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- True if static.
◆ 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.
◆ WindMode()
bool WindMode | ( | const EntityComponentManager & | _ecm | ) | const |
Get whether this model has wind enabled.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- True if wind mode is on.
The documentation for this class was generated from the following file: