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 joint entity.
More...
#include <gz/sim/Joint.hh>
Public Member Functions | |
Joint (sim::Entity _entity=kNullEntity) | |
Constructor. | |
std::optional< std::vector< sdf::JointAxis > > | Axis (const EntityComponentManager &_ecm) const |
Get the joint axis. | |
std::optional< std::string > | ChildLinkName (const EntityComponentManager &_ecm) const |
Get the child link name. | |
void | EnablePositionCheck (EntityComponentManager &_ecm, bool _enable=true) const |
By default, Gazebo will not report positions for a joint, so functions like Position will return nullopt. This function can be used to enable joint position check. | |
void | EnableTransmittedWrenchCheck (EntityComponentManager &_ecm, bool _enable=true) const |
By default, Gazebo will not report transmitted wrench for a joint, so functions like TransmittedWrench will return nullopt. This function can be used to enable joint transmitted wrench check. | |
void | EnableVelocityCheck (EntityComponentManager &_ecm, bool _enable=true) const |
By default, Gazebo will not report velocities for a joint, so functions like Velocity will return nullopt. This function can be used to enable joint velocity check. | |
sim::Entity | Entity () const |
Get the entity which this Joint is related to. | |
std::optional< std::string > | Name (const EntityComponentManager &_ecm) const |
Get the joint's unscoped name. | |
std::optional< std::string > | ParentLinkName (const EntityComponentManager &_ecm) const |
Get the parent link name. | |
std::optional< Model > | ParentModel (const EntityComponentManager &_ecm) const |
Get the parent model. | |
std::optional< math::Pose3d > | Pose (const EntityComponentManager &_ecm) const |
Get the pose of the joint. | |
std::optional< std::vector< double > > | Position (const EntityComponentManager &_ecm) const |
Get the position of the joint. | |
void | ResetEntity (sim::Entity _newEntity) |
Reset Entity to a new one. | |
void | ResetPosition (EntityComponentManager &_ecm, const std::vector< double > &_positions) |
Reset the joint positions. | |
void | ResetVelocity (EntityComponentManager &_ecm, const std::vector< double > &_velocities) |
Reset the joint velocities. | |
sim::Entity | SensorByName (const EntityComponentManager &_ecm, const std::string &_name) const |
Get the ID of a sensor entity which is an immediate child of this joint. | |
uint64_t | SensorCount (const EntityComponentManager &_ecm) const |
Get the number of sensors which are immediate children of this joint. | |
std::vector< sim::Entity > | Sensors (const EntityComponentManager &_ecm) const |
Get all sensors which are immediate children of this joint. | |
void | SetEffortLimits (EntityComponentManager &_ecm, const std::vector< math::Vector2d > &_limits) |
Set the effort limits on a joint axis. | |
void | SetForce (EntityComponentManager &_ecm, const std::vector< double > &_forces) |
Set force on this joint. If both forces and velocities are set, only forces are applied. | |
void | SetPositionLimits (EntityComponentManager &_ecm, const std::vector< math::Vector2d > &_limits) |
Set the position limits on a joint axis. | |
void | SetVelocity (EntityComponentManager &_ecm, const std::vector< double > &_velocities) |
Set velocity on this joint. Only applied if no forces are set. | |
void | SetVelocityLimits (EntityComponentManager &_ecm, const std::vector< math::Vector2d > &_limits) |
Set the velocity limits on a joint axis. | |
std::optional< double > | ThreadPitch (const EntityComponentManager &_ecm) const |
Get the thread pitch of the joint. | |
std::optional< std::vector< msgs::Wrench > > | TransmittedWrench (const EntityComponentManager &_ecm) const |
Get the transmitted wrench of the joint. | |
std::optional< sdf::JointType > | Type (const EntityComponentManager &_ecm) const |
Get the joint type. | |
bool | Valid (const EntityComponentManager &_ecm) const |
Check whether this joint correctly refers to an entity that has a components::Joint. | |
std::optional< std::vector< double > > | Velocity (const EntityComponentManager &_ecm) const |
Get the velocity of the joint. | |
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 joint entity.
For example, given a joint'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:
Joint joint(entity); std::string name = joint.Name(ecm);
Constructor & Destructor Documentation
🔗Joint()
|
explicit |
Constructor.
- Parameters
-
[in] _entity Joint entity
Member Function Documentation
🔗Axis()
std::optional< std::vector< sdf::JointAxis > > Axis | ( | const EntityComponentManager & | _ecm | ) | const |
Get the joint axis.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Axis of the joint or nullopt if the entity does not have a components::JointAxis or components::JointAxis2 component.
🔗ChildLinkName()
std::optional< std::string > ChildLinkName | ( | const EntityComponentManager & | _ecm | ) | const |
Get the child link name.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Child link name or nullopt if the entity does not have a components::ChildLinkName component.
🔗EnablePositionCheck()
void EnablePositionCheck | ( | EntityComponentManager & | _ecm, |
bool | _enable = true |
||
) | const |
By default, Gazebo will not report positions for a joint, so functions like Position
will return nullopt. This function can be used to enable joint position check.
- Parameters
-
[in] _ecm Mutable reference to the ECM. [in] _enable True to enable checks, false to disable. Defaults to true.
🔗EnableTransmittedWrenchCheck()
void EnableTransmittedWrenchCheck | ( | EntityComponentManager & | _ecm, |
bool | _enable = true |
||
) | const |
By default, Gazebo will not report transmitted wrench for a joint, so functions like TransmittedWrench
will return nullopt. This function can be used to enable joint transmitted wrench check.
- Parameters
-
[in] _ecm Mutable reference to the ECM. [in] _enable True to enable checks, false to disable. Defaults to true.
🔗EnableVelocityCheck()
void EnableVelocityCheck | ( | EntityComponentManager & | _ecm, |
bool | _enable = true |
||
) | const |
By default, Gazebo will not report velocities for a joint, so functions like Velocity
will return nullopt. This function can be used to enable joint velocity check.
- Parameters
-
[in] _ecm Mutable reference to the ECM. [in] _enable True to enable checks, false to disable. Defaults to true.
🔗Entity()
sim::Entity Entity | ( | ) | const |
🔗Name()
std::optional< std::string > Name | ( | const EntityComponentManager & | _ecm | ) | const |
Get the joint's unscoped name.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Joint's name or nullopt if the entity does not have a components::Name component
🔗ParentLinkName()
std::optional< std::string > ParentLinkName | ( | const EntityComponentManager & | _ecm | ) | const |
Get the parent link name.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Parent link name or nullopt if the entity does not have a components::ParentLinkName component.
🔗ParentModel()
std::optional< Model > ParentModel | ( | const EntityComponentManager & | _ecm | ) | const |
Get the parent model.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Parent Model 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 joint.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Pose of the joint or nullopt if the entity does not have a components::Pose component.
🔗Position()
std::optional< std::vector< double > > Position | ( | const EntityComponentManager & | _ecm | ) | const |
Get the position of the joint.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Position of the joint or nullopt if position check is not enabled.
- See also
- EnablePositionCheck
🔗ResetEntity()
void ResetEntity | ( | sim::Entity | _newEntity | ) |
Reset Entity to a new one.
- Parameters
-
[in] _newEntity New joint entity.
🔗ResetPosition()
void ResetPosition | ( | EntityComponentManager & | _ecm, |
const std::vector< double > & | _positions | ||
) |
Reset the joint positions.
- Parameters
-
[in] _ecm Entity Component manager. [in] _positions Joint positions to reset to. The vector of positions should have the same size as the degrees of freedom of the joint.
🔗ResetVelocity()
void ResetVelocity | ( | EntityComponentManager & | _ecm, |
const std::vector< double > & | _velocities | ||
) |
Reset the joint velocities.
- Parameters
-
[in] _ecm Entity Component manager. [in] _velocities Joint velocities to reset to. This is different from SetVelocity as this modifies the internal state of the joint. The vector of velocities should have the same size as the degrees of freedom of the joint.
🔗SensorByName()
sim::Entity SensorByName | ( | const EntityComponentManager & | _ecm, |
const std::string & | _name | ||
) | const |
🔗SensorCount()
uint64_t SensorCount | ( | const EntityComponentManager & | _ecm | ) | const |
Get the number of sensors which are immediate children of this joint.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Number of sensors in this joint.
🔗Sensors()
std::vector< sim::Entity > Sensors | ( | const EntityComponentManager & | _ecm | ) | const |
Get all sensors which are immediate children of this joint.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- All sensors in this joint.
🔗SetEffortLimits()
void SetEffortLimits | ( | EntityComponentManager & | _ecm, |
const std::vector< math::Vector2d > & | _limits | ||
) |
Set the effort limits on a joint axis.
- Parameters
-
[in] _ecm Entity Component manager. [in] _limits Joint limits to set to. The X() component of the Vector2 specifies the minimum effort limit, the Y() component stands for maximum limit. The vector of limits should have the same size as the degrees of freedom of the joint.
🔗SetForce()
void SetForce | ( | EntityComponentManager & | _ecm, |
const std::vector< double > & | _forces | ||
) |
Set force on this joint. If both forces and velocities are set, only forces are applied.
- Parameters
-
[in] _ecm Entity Component manager. [in] _forces Joint force or torque commands (target forces or torques). The vector of forces should have the same size as the degrees of freedom of the joint.
🔗SetPositionLimits()
void SetPositionLimits | ( | EntityComponentManager & | _ecm, |
const std::vector< math::Vector2d > & | _limits | ||
) |
Set the position limits on a joint axis.
- Parameters
-
[in] _ecm Entity Component manager. [in] _limits Joint limits to set to. The X() component of the Vector2 specifies the minimum position limit, the Y() component stands for maximum limit. The vector of limits should have the same size as the degrees of freedom of the joint.
🔗SetVelocity()
void SetVelocity | ( | EntityComponentManager & | _ecm, |
const std::vector< double > & | _velocities | ||
) |
Set velocity on this joint. Only applied if no forces are set.
- Parameters
-
[in] _ecm Entity Component manager. [in] _velocities Joint velocities commands (target velocities). This is different from ResetVelocity in that this does not modify the internal state of the joint. Instead, the physics engine is expected to compute the necessary joint torque for the commanded velocity and apply it in the next simulation step. The vector of velocities should have the same size as the degrees of freedom of the joint.
🔗SetVelocityLimits()
void SetVelocityLimits | ( | EntityComponentManager & | _ecm, |
const std::vector< math::Vector2d > & | _limits | ||
) |
Set the velocity limits on a joint axis.
- Parameters
-
[in] _ecm Entity Component manager. [in] _limits Joint limits to set to. The X() component of the Vector2 specifies the minimum velocity limit, the Y() component stands for maximum limit. The vector of limits should have the same size as the degrees of freedom of the joint.
🔗ThreadPitch()
std::optional< double > ThreadPitch | ( | const EntityComponentManager & | _ecm | ) | const |
Get the thread pitch of the joint.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Thread pitch of the joint or nullopt if the entity does not have a components::ThreadPitch component.
🔗TransmittedWrench()
std::optional< std::vector< msgs::Wrench > > TransmittedWrench | ( | const EntityComponentManager & | _ecm | ) | const |
Get the transmitted wrench of the joint.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Transmitted wrench of the joint or nullopt if transmitted wrench check is not enabled.
- See also
- EnableTransmittedWrenchCheck
🔗Type()
std::optional< sdf::JointType > Type | ( | const EntityComponentManager & | _ecm | ) | const |
Get the joint type.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Type of the joint or nullopt if the entity does not have a components::JointType component.
🔗Valid()
bool Valid | ( | const EntityComponentManager & | _ecm | ) | const |
Check whether this joint correctly refers to an entity that has a components::Joint.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- True if it's a valid joint in the manager.
🔗Velocity()
std::optional< std::vector< double > > Velocity | ( | const EntityComponentManager & | _ecm | ) | const |
Get the velocity of the joint.
- Parameters
-
[in] _ecm Entity-component manager.
- Returns
- Velocity of the joint or nullopt if velocity check is not enabled.
- See also
- EnableVelocityCheck
The documentation for this class was generated from the following file: