Public Member Functions | List of all members
sdf::v9::Model Class Reference

#include <Model.hh>

Public Member Functions

 Model ()
 Default constructor. More...
 
 Model (const Model &_model)
 Copy constructor. More...
 
 Model (Model &&_model) noexcept
 Move constructor. More...
 
 ~Model ()
 Destructor. More...
 
bool AllowAutoDisable () const
 Check if this model should be allowed to auto-disable. More...
 
const LinkCanonicalLink () const
 Get the model's canonical link. More...
 
const std::string & CanonicalLinkName () const
 Get the name of the model's canonical link. More...
 
sdf::ElementPtr Element () const
 Get a pointer to the SDF element that was used during load. More...
 
bool EnableWind () const
 Check if this model should be subject to wind. More...
 
const FrameFrameByIndex (const uint64_t _index) const
 Get an explicit frame based on an index. More...
 
const FrameFrameByName (const std::string &_name) const
 Get an explicit frame based on a name. More...
 
uint64_t FrameCount () const
 Get the number of explicit frames. More...
 
bool FrameNameExists (const std::string &_name) const
 Get whether an explicit frame name exists. More...
 
const JointJointByIndex (const uint64_t _index) const
 Get a joint based on an index. More...
 
const JointJointByName (const std::string &_name) const
 Get a joint based on a name. More...
 
uint64_t JointCount () const
 Get the number of joints. More...
 
bool JointNameExists (const std::string &_name) const
 Get whether a joint name exists. More...
 
const LinkLinkByIndex (const uint64_t _index) const
 Get a link based on an index. More...
 
const LinkLinkByName (const std::string &_name) const
 Get a link based on a name. More...
 
uint64_t LinkCount () const
 Get the number of links. More...
 
bool LinkNameExists (const std::string &_name) const
 Get whether a link name exists. More...
 
Errors Load (ElementPtr _sdf)
 Load the model based on a element pointer. More...
 
const ModelModelByIndex (const uint64_t _index) const
 Get a nested model based on an index. More...
 
const ModelModelByName (const std::string &_name) const
 Get a nested model based on a name. More...
 
uint64_t ModelCount () const
 Get the number of nested models. More...
 
bool ModelNameExists (const std::string &_name) const
 Get whether a nested model name exists. More...
 
std::string Name () const
 Get the name of the model. More...
 
Modeloperator= (const Model &_model)
 Copy assignment operator. More...
 
Modeloperator= (Model &&_model)
 Move assignment operator. More...
 
const gz::math::Pose3d & Pose () const SDF_DEPRECATED(9.0)
 Get the pose of the model. More...
 
const std::string & PoseFrame () const SDF_DEPRECATED(9.0)
 Get the name of the coordinate frame in which this model's pose is expressed. More...
 
const std::string & PoseRelativeTo () const
 Get the name of the coordinate frame relative to which this object's pose is expressed. More...
 
const gz::math::Pose3d & RawPose () const
 Get the pose of the model. More...
 
bool SelfCollide () const
 Check if this model should self-collide. More...
 
sdf::SemanticPose SemanticPose () const
 Get SemanticPose object of this object to aid in resolving poses. More...
 
void SetAllowAutoDisable (bool _allowAutoDisable)
 Set this model to allow auto-disabling. More...
 
void SetCanonicalLinkName (const std::string &_canonicalLink)
 Set the name of the model's canonical link. More...
 
void SetEnableWind (bool _enableWind)
 Set whether this model should be subject to wind. More...
 
void SetName (const std::string &_name)
 Set the name of the model. More...
 
void SetPose (const gz::math::Pose3d &_pose) SDF_DEPRECATED(9.0)
 Set the pose of the model. More...
 
void SetPoseFrame (const std::string &_frame) SDF_DEPRECATED(9.0)
 Set the name of the coordinate frame in which this model's pose is expressed. More...
 
void SetPoseRelativeTo (const std::string &_frame)
 Set the name of the coordinate frame relative to which this object's pose is expressed. More...
 
void SetRawPose (const gz::math::Pose3d &_pose)
 Set the pose of the model. More...
 
void SetSelfCollide (bool _selfCollide)
 Set this model to self-collide or not self-collide. More...
 
void SetStatic (bool _static)
 Set this model to be static or not static. More...
 
bool Static () const
 Check if this model should be static. More...
 
Errors ValidateGraphs () const
 Check that the FrameAttachedToGraph and PoseRelativeToGraph are valid. More...
 

Constructor & Destructor Documentation

◆ Model() [1/3]

sdf::v9::Model::Model ( )

Default constructor.

◆ Model() [2/3]

sdf::v9::Model::Model ( const Model _model)

Copy constructor.

Parameters
[in]_modelModel to copy.

◆ Model() [3/3]

sdf::v9::Model::Model ( Model &&  _model)
noexcept

Move constructor.

Parameters
[in]_modelModel to move.

◆ ~Model()

sdf::v9::Model::~Model ( )

Destructor.

Member Function Documentation

◆ AllowAutoDisable()

bool sdf::v9::Model::AllowAutoDisable ( ) const

Check if this model should be allowed to auto-disable.

If auto-disable is allowed, a model that is at rest can choose to not update its dynamics.

Returns
true if auto-disable is allowed for this model

◆ CanonicalLink()

const Link* sdf::v9::Model::CanonicalLink ( ) const

Get the model's canonical link.

Returns
An immutable pointer to the canonical link

◆ CanonicalLinkName()

const std::string& sdf::v9::Model::CanonicalLinkName ( ) const

Get the name of the model's canonical link.

An empty value indicates that the first link in the model or the first link found in a depth first search of nested models is the canonical link.

Returns
The name of the canonical link.

◆ Element()

sdf::ElementPtr sdf::v9::Model::Element ( ) const

Get a pointer to the SDF element that was used during load.

Returns
SDF element pointer. The value will be nullptr if Load has not been called.

◆ EnableWind()

bool sdf::v9::Model::EnableWind ( ) const

Check if this model should be subject to wind.

If true, all links in the model should be affected by the wind. This can be overridden per link.

Returns
true if the model should be subject to wind, false otherwise.

◆ FrameByIndex()

const Frame* sdf::v9::Model::FrameByIndex ( const uint64_t  _index) const

Get an explicit frame based on an index.

Parameters
[in]_indexIndex of the explicit frame. The index should be in the range [0..FrameCount()).
Returns
Pointer to the explicit frame. Nullptr if the index does not exist.
See also
uint64_t FrameCount() const

◆ FrameByName()

const Frame* sdf::v9::Model::FrameByName ( const std::string &  _name) const

Get an explicit frame based on a name.

Parameters
[in]_nameName of the explicit frame.
Returns
Pointer to the explicit frame. Nullptr if the name does not exist.

◆ FrameCount()

uint64_t sdf::v9::Model::FrameCount ( ) const

Get the number of explicit frames.

Returns
Number of explicit frames contained in this Model object.

◆ FrameNameExists()

bool sdf::v9::Model::FrameNameExists ( const std::string &  _name) const

Get whether an explicit frame name exists.

Parameters
[in]_nameName of the explicit frame to check.
Returns
True if there exists an explicit frame with the given name.

◆ JointByIndex()

const Joint* sdf::v9::Model::JointByIndex ( const uint64_t  _index) const

Get a joint based on an index.

Parameters
[in]_indexIndex of the joint. The index should be in the range [0..JointCount()).
Returns
Pointer to the joint. Nullptr if the index does not exist.
See also
uint64_t JointCount() const

◆ JointByName()

const Joint* sdf::v9::Model::JointByName ( const std::string &  _name) const

Get a joint based on a name.

Parameters
[in]_nameName of the joint.
Returns
Pointer to the joint. Nullptr if a joint with the given name does not exist.
See also
bool JointNameExists(const std::string &_name) const

◆ JointCount()

uint64_t sdf::v9::Model::JointCount ( ) const

Get the number of joints.

Returns
Number of joints contained in this Model object.

◆ JointNameExists()

bool sdf::v9::Model::JointNameExists ( const std::string &  _name) const

Get whether a joint name exists.

Parameters
[in]_nameName of the joint to check.
Returns
True if there exists a joint with the given name.

◆ LinkByIndex()

const Link* sdf::v9::Model::LinkByIndex ( const uint64_t  _index) const

Get a link based on an index.

Parameters
[in]_indexIndex of the link. The index should be in the range [0..LinkCount()).
Returns
Pointer to the link. Nullptr if the index does not exist.
See also
uint64_t LinkCount() const

◆ LinkByName()

const Link* sdf::v9::Model::LinkByName ( const std::string &  _name) const

Get a link based on a name.

Parameters
[in]_nameName of the link.
Returns
Pointer to the link. Nullptr if the name does not exist.

◆ LinkCount()

uint64_t sdf::v9::Model::LinkCount ( ) const

Get the number of links.

Returns
Number of links contained in this Model object.

◆ LinkNameExists()

bool sdf::v9::Model::LinkNameExists ( const std::string &  _name) const

Get whether a link name exists.

Parameters
[in]_nameName of the link to check.
Returns
True if there exists a link with the given name.

◆ Load()

Errors sdf::v9::Model::Load ( ElementPtr  _sdf)

Load the model based on a element pointer.

This is not the usual entry point. Typical usage of the SDF DOM is through the Root object.

Parameters
[in]_sdfThe SDF Element pointer
Returns
Errors, which is a vector of Error objects. Each Error includes an error code and message. An empty vector indicates no error.

◆ ModelByIndex()

const Model* sdf::v9::Model::ModelByIndex ( const uint64_t  _index) const

Get a nested model based on an index.

Parameters
[in]_indexIndex of the nested model. The index should be in the range [0..ModelCount()).
Returns
Pointer to the model. Nullptr if the index does not exist.
See also
uint64_t ModelCount() const

◆ ModelByName()

const Model* sdf::v9::Model::ModelByName ( const std::string &  _name) const

Get a nested model based on a name.

Parameters
[in]_nameName of the nested model.
Returns
Pointer to the model. Nullptr if a model with the given name does not exist.
See also
bool ModelNameExists(const std::string &_name) const

◆ ModelCount()

uint64_t sdf::v9::Model::ModelCount ( ) const

Get the number of nested models.

Returns
Number of nested models contained in this Model object.

◆ ModelNameExists()

bool sdf::v9::Model::ModelNameExists ( const std::string &  _name) const

Get whether a nested model name exists.

Parameters
[in]_nameName of the nested model to check.
Returns
True if there exists a nested model with the given name.

◆ Name()

std::string sdf::v9::Model::Name ( ) const

Get the name of the model.

The name of the model should be unique within the scope of a World.

Returns
Name of the model.

◆ operator=() [1/2]

Model& sdf::v9::Model::operator= ( const Model _model)

Copy assignment operator.

Parameters
[in]_modelModel to copy.
Returns
Reference to this.

◆ operator=() [2/2]

Model& sdf::v9::Model::operator= ( Model &&  _model)

Move assignment operator.

Parameters
[in]_modelModel to move.
Returns
Reference to this.

◆ Pose()

const gz::math::Pose3d& sdf::v9::Model::Pose ( ) const

Get the pose of the model.

This is the pose of the model as specified in SDF (<model> <pose> ... </pose></model>), and is typically used to express the position and rotation of a model in a global coordinate frame.

Returns
The pose of the model.
Deprecated:
See RawPose.

◆ PoseFrame()

const std::string& sdf::v9::Model::PoseFrame ( ) const

Get the name of the coordinate frame in which this model's pose is expressed.

A empty value indicates that the frame is the global/world coordinate frame.

Returns
The name of the pose frame.
Deprecated:
See PoseRelativeTo.

◆ PoseRelativeTo()

const std::string& sdf::v9::Model::PoseRelativeTo ( ) const

Get the name of the coordinate frame relative to which this object's pose is expressed.

An empty value indicates that the frame is relative to the parent model/world coordinate frame.

Returns
The name of the pose relative-to frame.

◆ RawPose()

const gz::math::Pose3d& sdf::v9::Model::RawPose ( ) const

Get the pose of the model.

This is the pose of the model as specified in SDF (<model> <pose> ... </pose></model>), and is typically used to express the position and rotation of a model in a global coordinate frame.

Returns
The pose of the model.

◆ SelfCollide()

bool sdf::v9::Model::SelfCollide ( ) const

Check if this model should self-collide.

A self-colliding model is a model whose links will collide if they come into contact. If a model is not self-colliding, its links will pass through each other.

Returns
true if the model should self-collide, false otherwise.

◆ SemanticPose()

sdf::SemanticPose sdf::v9::Model::SemanticPose ( ) const

Get SemanticPose object of this object to aid in resolving poses.

Returns
SemanticPose object for this link.

◆ SetAllowAutoDisable()

void sdf::v9::Model::SetAllowAutoDisable ( bool  _allowAutoDisable)

Set this model to allow auto-disabling.

Parameters
[in]_allowAutoDisableTrue or false depending on whether the model should be allowed to auto-disable.
See also
AllowAutoDisable()

◆ SetCanonicalLinkName()

void sdf::v9::Model::SetCanonicalLinkName ( const std::string &  _canonicalLink)

Set the name of the model's canonical link.

An empty value indicates that the first link in the model or the first link found in a depth first search of nested models is the canonical link.

Parameters
[in]_canonicalLinkThe name of the canonical link.

◆ SetEnableWind()

void sdf::v9::Model::SetEnableWind ( bool  _enableWind)

Set whether this model should be subject to wind.

Parameters
[in]_enableWindTrue or false depending on whether the model should be subject to wind.

◆ SetName()

void sdf::v9::Model::SetName ( const std::string &  _name)

Set the name of the model.

The name of the model should be unique within the scope of a World.

Parameters
[in]_nameName of the model.

◆ SetPose()

void sdf::v9::Model::SetPose ( const gz::math::Pose3d &  _pose)

Set the pose of the model.

See also
const gz::math::Pose3d &Pose() const
Parameters
[in]_poseThe new model pose.
Deprecated:
See SetRawPose.

◆ SetPoseFrame()

void sdf::v9::Model::SetPoseFrame ( const std::string &  _frame)

Set the name of the coordinate frame in which this model's pose is expressed.

A empty value indicates that the frame is the global/world coordinate frame.

Parameters
[in]_frameThe name of the pose frame.
Deprecated:
See SetPoseRelativeTo.

◆ SetPoseRelativeTo()

void sdf::v9::Model::SetPoseRelativeTo ( const std::string &  _frame)

Set the name of the coordinate frame relative to which this object's pose is expressed.

An empty value indicates that the frame is relative to the parent model/world coordinate frame.

Parameters
[in]_frameThe name of the pose relative-to frame.

◆ SetRawPose()

void sdf::v9::Model::SetRawPose ( const gz::math::Pose3d &  _pose)

Set the pose of the model.

See also
const gz::math::Pose3d &RawPose() const
Parameters
[in]_poseThe new model pose.

◆ SetSelfCollide()

void sdf::v9::Model::SetSelfCollide ( bool  _selfCollide)

Set this model to self-collide or not self-collide.

Parameters
[in]_selfCollideTrue or false depending on whether the model should self-collide.
See also
SelfCollide()

◆ SetStatic()

void sdf::v9::Model::SetStatic ( bool  _static)

Set this model to be static or not static.

Parameters
[in]_staticTrue or false depending on whether the model should be static.
See also
Static()

◆ Static()

bool sdf::v9::Model::Static ( ) const

Check if this model should be static.

A static model is one that is not subject to physical forces (in other words, it's purely kinematic instead of dynamic).

Returns
true if the model should be static, false if it is dynamic.

◆ ValidateGraphs()

Errors sdf::v9::Model::ValidateGraphs ( ) const

Check that the FrameAttachedToGraph and PoseRelativeToGraph are valid.

Returns
Errors, which is a vector of Error objects. Each Error includes an error code and message. An empty vector indicates no error.

The documentation for this class was generated from the following file: