Core¶
-
namespace scenario::core¶
Typedefs
Enums
-
enum JointType¶
Supported joint types.
Values:
-
enumerator Invalid¶
-
enumerator Fixed¶
-
enumerator Revolute¶
-
enumerator Prismatic¶
-
enumerator Ball¶
-
enumerator Invalid
-
enumerator Fixed
-
enumerator Revolute
-
enumerator Prismatic
-
enumerator Ball
-
enumerator Invalid¶
-
enum JointControlMode¶
Supported joint control modes.
Values:
-
enumerator Invalid¶
Marks the joint to have an invalid control mode.
-
enumerator Idle¶
Marks the joint to be IDLE. An IDLE joint is equivalent to a joint controlled in Force with zero references. The joint shows only passive behaviour.
-
enumerator Force¶
Marks the joint to be controlled in force. A Force joint receives generalized force references that are actuated by a force actuator. Depending on the active backend, the presence of friction and other loss components could be compensated.
-
enumerator Velocity¶
Marks the joint to be controlled in velocity. A Velocity joint receives velocity references that are actuated using a PID controller.
-
enumerator VelocityFollowerDart¶
Marks the joint to follow precisely a velocity trajectory. A VelocityFollowerDart joint receives velocity references that are processed by the physics engine, which computes instantaneously the right force to apply to follow the desired trajectory. It works only with the DART physics engine.
-
enumerator Position¶
Marks the joint to be controlled in position. A Position joint receives position references that are actuated using a PID controller.
-
enumerator PositionInterpolated¶
Marks the joint to be controlled in position with trajectory smoothing. A PositionInterpolated joint receives position references that are filtered to get a smooth trajectory. The resulting trajectory is then actuated using a position PID controller.
-
enumerator Invalid
Marks the joint to have an invalid control mode.
-
enumerator Idle
Marks the joint to be IDLE. An IDLE joint is equivalent to a joint controlled in Force with zero references. The joint shows only passive behaviour.
-
enumerator Force
Marks the joint to be controlled in force. A Force joint receives generalized force references that are actuated by a force actuator. Depending on the active backend, the presence of friction and other loss components could be compensated.
-
enumerator Velocity
Marks the joint to be controlled in velocity. A Velocity joint receives velocity references that are actuated using a PID controller.
-
enumerator VelocityFollowerDart
Marks the joint to follow precisely a velocity trajectory. A VelocityFollowerDart joint receives velocity references that are processed by the physics engine, which computes instantaneously the right force to apply to follow the desired trajectory. It works only with the DART physics engine.
-
enumerator Position
Marks the joint to be controlled in position. A Position joint receives position references that are actuated using a PID controller.
-
enumerator PositionInterpolated
Marks the joint to be controlled in position with trajectory smoothing. A PositionInterpolated joint receives position references that are filtered to get a smooth trajectory. The resulting trajectory is then actuated using a position PID controller.
-
enumerator Invalid¶
-
enum JointType
Supported joint types.
Values:
-
enumerator Invalid
-
enumerator Fixed
-
enumerator Revolute
-
enumerator Prismatic
-
enumerator Ball
-
enumerator Invalid
-
enumerator Fixed
-
enumerator Revolute
-
enumerator Prismatic
-
enumerator Ball
-
enumerator Invalid
-
enum JointControlMode
Supported joint control modes.
Values:
-
enumerator Invalid
Marks the joint to have an invalid control mode.
-
enumerator Idle
Marks the joint to be IDLE. An IDLE joint is equivalent to a joint controlled in Force with zero references. The joint shows only passive behaviour.
-
enumerator Force
Marks the joint to be controlled in force. A Force joint receives generalized force references that are actuated by a force actuator. Depending on the active backend, the presence of friction and other loss components could be compensated.
-
enumerator Velocity
Marks the joint to be controlled in velocity. A Velocity joint receives velocity references that are actuated using a PID controller.
-
enumerator VelocityFollowerDart
Marks the joint to follow precisely a velocity trajectory. A VelocityFollowerDart joint receives velocity references that are processed by the physics engine, which computes instantaneously the right force to apply to follow the desired trajectory. It works only with the DART physics engine.
-
enumerator Position
Marks the joint to be controlled in position. A Position joint receives position references that are actuated using a PID controller.
-
enumerator PositionInterpolated
Marks the joint to be controlled in position with trajectory smoothing. A PositionInterpolated joint receives position references that are filtered to get a smooth trajectory. The resulting trajectory is then actuated using a position PID controller.
-
enumerator Invalid
Marks the joint to have an invalid control mode.
-
enumerator Idle
Marks the joint to be IDLE. An IDLE joint is equivalent to a joint controlled in Force with zero references. The joint shows only passive behaviour.
-
enumerator Force
Marks the joint to be controlled in force. A Force joint receives generalized force references that are actuated by a force actuator. Depending on the active backend, the presence of friction and other loss components could be compensated.
-
enumerator Velocity
Marks the joint to be controlled in velocity. A Velocity joint receives velocity references that are actuated using a PID controller.
-
enumerator VelocityFollowerDart
Marks the joint to follow precisely a velocity trajectory. A VelocityFollowerDart joint receives velocity references that are processed by the physics engine, which computes instantaneously the right force to apply to follow the desired trajectory. It works only with the DART physics engine.
-
enumerator Position
Marks the joint to be controlled in position. A Position joint receives position references that are actuated using a PID controller.
-
enumerator PositionInterpolated
Marks the joint to be controlled in position with trajectory smoothing. A PositionInterpolated joint receives position references that are filtered to get a smooth trajectory. The resulting trajectory is then actuated using a position PID controller.
-
enumerator Invalid
-
struct Contact¶
-
struct ContactPoint¶
-
class Joint¶
Subclassed by scenario::gazebo::Joint
Public Functions
-
virtual bool valid() const = 0¶
Check if the joint is valid.
- Returns
True if the joint is valid, false otherwise.
-
virtual size_t dofs() const = 0¶
Get the number of degrees of freedom of the joint.
- Returns
The number of DOFs of the joint.
-
virtual std::string name(const bool scoped = false) const = 0¶
Get the name of the joint.
- Parameters
scoped – If true, the scoped name of the joint is returned.
- Returns
The name of the joint.
-
virtual JointControlMode controlMode() const = 0¶
Get the active joint control mode.
- Returns
The active joint control mode.
-
virtual bool setControlMode(const JointControlMode mode) = 0¶
Set the joint control mode.
- Parameters
mode – The desired control mode.
- Returns
True for success, false otherwise.
-
virtual double controllerPeriod() const = 0¶
Get the period of the controller, if any.
The controller period is a model quantity. If no controller is active, infinity is returned.
- Returns
The the controller period.
-
virtual PID pid() const = 0¶
Get the PID parameters of the joint.
If no PID parameters have been set, the default parameters are returned.
- Returns
The joint PID parameters.
-
virtual bool setPID(const PID &pid) = 0¶
Set the PID parameters of the joint.
- Parameters
pid – The desired PID parameters.
- Returns
True for success, false otherwise.
-
virtual bool historyOfAppliedJointForcesEnabled() const = 0¶
Check if the history of applied joint forces is enabled.
- Returns
True if the history is enabled, false otherwise.
-
virtual bool enableHistoryOfAppliedJointForces(const bool enable = true, const size_t maxHistorySize = 100) = 0¶
Enable the history of joint forces.
- Parameters
enable – True to enable, false to disable.
maxHistorySize – The size of the history window.
- Returns
True for success, false otherwise.
-
virtual std::vector<double> historyOfAppliedJointForces() const = 0¶
Get the history of applied joint forces.
The vector is populated with #DoFs values at each physics step.
- Returns
The vector containing the history of joint forces.
-
virtual double coulombFriction() const = 0¶
Get the Coulomb friction of the joint.
If \( K_c \) is the Coulomb friction parameter, and \( \dot{q} \) the joint velocity, the corresponding torque is often modelled as:
\( \tau_{static} = sign(\dot{q}) K_c \)
- Returns
The Coulomb friction parameter of the joint.
-
virtual double viscousFriction() const = 0¶
Get the viscous friction of the joint.
If \( K_v \) is the viscous friction parameter, and \( \dot{q} \) the joint velocity, the corresponding torque is often modelled as:
\( \tau_{static} = K_v \dot{q} \)
- Returns
The viscous friction parameter of the joint.
-
virtual Limit positionLimit(const size_t dof = 0) const = 0¶
Get the position limits of a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The position limits of the joint DOF.
-
virtual Limit velocityLimit(const size_t dof = 0) const = 0¶
Get the velocity limit of a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The velocity limit of the joint DOF.
-
virtual bool setVelocityLimit(const double maxVelocity, const size_t dof = 0) = 0¶
Set the maximum velocity of a joint DOF.
This limit can be used to clip the velocity applied by joint controllers.
- Parameters
maxVelocity – The maximum velocity.
dof – The index of the DOF.
- Returns
True for success, false otherwise.
-
virtual double maxGeneralizedForce(const size_t dof = 0) const = 0¶
Get the maximum generalized force that could be applied to a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The maximum generalized force of the joint DOF.
-
virtual bool setMaxGeneralizedForce(const double maxForce, const size_t dof = 0) = 0¶
Set the maximum generalized force that can be applied to a joint DOF.
This limit can be used to clip the force applied by joint controllers.
- Parameters
maxForce – The maximum generalized force.
dof – The index of the DOF.
- Returns
True for success, false otherwise.
-
virtual double position(const size_t dof = 0) const = 0¶
Get the position of a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The position of the joint DOF.
-
virtual double velocity(const size_t dof = 0) const = 0¶
Get the velocity of a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The velocity of the joint DOF.
-
virtual double acceleration(const size_t dof = 0) const = 0¶
Get the acceleration of a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The acceleration of the joint DOF.
-
virtual double generalizedForce(const size_t dof = 0) const = 0¶
Get the generalized force of a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The generalized force of the joint DOF.
-
virtual bool setPositionTarget(const double position, const size_t dof = 0) = 0¶
Set the position target of a joint DOF.
The target is processed by a joint controller, if enabled.
- Parameters
position – The position target of the joint DOF.
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
True for success, false otherwise.
-
virtual bool setVelocityTarget(const double velocity, const size_t dof = 0) = 0¶
Set the velocity target of a joint DOF.
The target is processed by a joint controller, if enabled.
- Parameters
velocity – The velocity target of the joint DOF.
dof – The index of the DOF.
- Returns
True for success, false otherwise.
-
virtual bool setAccelerationTarget(const double acceleration, const size_t dof = 0) = 0¶
Set the acceleration target of a joint DOF.
The target is processed by a joint controller, if enabled.
- Parameters
acceleration – The acceleration target of the joint DOF.
dof – The index of the DOF.
- Returns
True for success, false otherwise.
-
virtual bool setGeneralizedForceTarget(const double force, const size_t dof = 0) = 0¶
Set the generalized force target of a joint DOF.
The force is applied to the desired DOF. Note that if there’s friction or other loss components, the real joint force will differ.
- Parameters
force – The generalized force target of the joint DOF.
dof – The index of the DOF.
- Returns
True for success, false otherwise.
-
virtual double positionTarget(const size_t dof = 0) const = 0¶
Get the active position target of the joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid or if no position target was set.
- Returns
The position target of the joint DOF.
-
virtual double velocityTarget(const size_t dof = 0) const = 0¶
Get the active velocity target of the joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid or if no velocity target was set.
- Returns
The velocity target of the joint DOF.
-
virtual double accelerationTarget(const size_t dof = 0) const = 0¶
Get the active acceleration target of the joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid or if no acceleration target was set.
- Returns
The acceleration target of the joint DOF.
-
virtual double generalizedForceTarget(const size_t dof = 0) const = 0¶
Get the active generalized force target of the joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid or if no generalized force target was set.
- Returns
The generalized force target of the joint DOF.
-
virtual JointLimit jointPositionLimit() const = 0¶
Get the position limits of the joint.
- Returns
The position limits of the joint.
-
virtual JointLimit jointVelocityLimit() const = 0¶
Get the velocity limits of the joint.
- Returns
The velocity limits of the joint.
-
virtual bool setJointVelocityLimit(const std::vector<double> &maxVelocity) = 0¶
Set the maximum velocity of the joint.
This limit can be used to clip the velocity applied by joint controllers.
- Parameters
maxVelocity – A vector with the maximum velocity of the joint DOFs.
- Returns
True for success, false otherwise.
-
virtual std::vector<double> jointMaxGeneralizedForce() const = 0¶
Get the maximum generalized force that could be applied to the joint.
- Returns
The maximum generalized force of the joint.
-
virtual bool setJointMaxGeneralizedForce(const std::vector<double> &maxForce) = 0¶
Set the maximum generalized force that can be applied to the joint.
This limit can be used to clip the force applied by joint controllers.
- Parameters
maxForce – A vector with the maximum generalized forces of the joint DOFs.
- Returns
True for success, false otherwise.
-
virtual std::vector<double> jointPosition() const = 0¶
Get the position of the joint.
- Returns
The position of the joint.
-
virtual std::vector<double> jointVelocity() const = 0¶
Get the velocity of the joint.
- Returns
The velocity of the joint.
-
virtual std::vector<double> jointAcceleration() const = 0¶
Get the acceleration of the joint.
- Returns
The acceleration of the joint.
-
virtual std::vector<double> jointGeneralizedForce() const = 0¶
Get the generalized force of the joint.
- Returns
The generalized force of the joint.
-
virtual bool setJointPositionTarget(const std::vector<double> &position) = 0¶
Set the position target of the joint.
The target is processed by a joint controller, if enabled.
- Parameters
position – A vector with the position targets of the joint DOFs.
- Returns
True for success, false otherwise.
-
virtual bool setJointVelocityTarget(const std::vector<double> &velocity) = 0¶
Set the velocity target of the joint.
The target is processed by a joint controller, if enabled.
- Parameters
velocity – A vector with the velocity targets of the joint DOFs.
- Returns
True for success, false otherwise.
-
virtual bool setJointAccelerationTarget(const std::vector<double> &acceleration) = 0¶
Set the acceleration target of the joint.
The target is processed by a joint controller, if enabled.
- Parameters
acceleration – A vector with the acceleration targets of the joint DOFs.
- Returns
True for success, false otherwise.
-
virtual bool setJointGeneralizedForceTarget(const std::vector<double> &force) = 0¶
Set the generalized force target of the joint.
Note that if there’s friction or other loss components, the real joint force will differ.
- Parameters
force – A vector with the generalized force targets of the joint DOFs.
- Returns
True for success, false otherwise.
-
virtual std::vector<double> jointPositionTarget() const = 0¶
Get the active position target.
- Returns
The position target of the joint.
-
virtual std::vector<double> jointVelocityTarget() const = 0¶
Get the active velocity target.
- Returns
The velocity target of the joint.
-
virtual std::vector<double> jointAccelerationTarget() const = 0¶
Get the active acceleration target.
- Returns
The acceleration target of the joint.
-
virtual std::vector<double> jointGeneralizedForceTarget() const = 0¶
Get the active generalized force target.
- Returns
The generalized force target of the joint.
-
virtual bool valid() const = 0
Check if the joint is valid.
- Returns
True if the joint is valid, false otherwise.
-
virtual size_t dofs() const = 0
Get the number of degrees of freedom of the joint.
- Returns
The number of DOFs of the joint.
-
virtual std::string name(const bool scoped = false) const = 0
Get the name of the joint.
- Parameters
scoped – If true, the scoped name of the joint is returned.
- Returns
The name of the joint.
-
virtual JointType type() const = 0
Get the type of the joint.
- Returns
The type of the joint.
-
virtual JointControlMode controlMode() const = 0
Get the active joint control mode.
- Returns
The active joint control mode.
-
virtual bool setControlMode(const JointControlMode mode) = 0
Set the joint control mode.
- Parameters
mode – The desired control mode.
- Returns
True for success, false otherwise.
-
virtual double controllerPeriod() const = 0
Get the period of the controller, if any.
The controller period is a model quantity. If no controller is active, infinity is returned.
- Returns
The the controller period.
-
virtual PID pid() const = 0
Get the PID parameters of the joint.
If no PID parameters have been set, the default parameters are returned.
- Returns
The joint PID parameters.
-
virtual bool setPID(const PID &pid) = 0
Set the PID parameters of the joint.
- Parameters
pid – The desired PID parameters.
- Returns
True for success, false otherwise.
-
virtual bool historyOfAppliedJointForcesEnabled() const = 0
Check if the history of applied joint forces is enabled.
- Returns
True if the history is enabled, false otherwise.
-
virtual bool enableHistoryOfAppliedJointForces(const bool enable = true, const size_t maxHistorySize = 100) = 0
Enable the history of joint forces.
- Parameters
enable – True to enable, false to disable.
maxHistorySize – The size of the history window.
- Returns
True for success, false otherwise.
-
virtual std::vector<double> historyOfAppliedJointForces() const = 0
Get the history of applied joint forces.
The vector is populated with #DoFs values at each physics step.
- Returns
The vector containing the history of joint forces.
-
virtual double coulombFriction() const = 0
Get the Coulomb friction of the joint.
If \( K_c \) is the Coulomb friction parameter, and \( \dot{q} \) the joint velocity, the corresponding torque is often modelled as:
\( \tau_{static} = sign(\dot{q}) K_c \)
- Returns
The Coulomb friction parameter of the joint.
-
virtual double viscousFriction() const = 0
Get the viscous friction of the joint.
If \( K_v \) is the viscous friction parameter, and \( \dot{q} \) the joint velocity, the corresponding torque is often modelled as:
\( \tau_{static} = K_v \dot{q} \)
- Returns
The viscous friction parameter of the joint.
-
virtual Limit positionLimit(const size_t dof = 0) const = 0
Get the position limits of a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The position limits of the joint DOF.
-
virtual Limit velocityLimit(const size_t dof = 0) const = 0
Get the velocity limit of a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The velocity limit of the joint DOF.
-
virtual bool setVelocityLimit(const double maxVelocity, const size_t dof = 0) = 0
Set the maximum velocity of a joint DOF.
This limit can be used to clip the velocity applied by joint controllers.
- Parameters
maxVelocity – The maximum velocity.
dof – The index of the DOF.
- Returns
True for success, false otherwise.
-
virtual double maxGeneralizedForce(const size_t dof = 0) const = 0
Get the maximum generalized force that could be applied to a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The maximum generalized force of the joint DOF.
-
virtual bool setMaxGeneralizedForce(const double maxForce, const size_t dof = 0) = 0
Set the maximum generalized force that can be applied to a joint DOF.
This limit can be used to clip the force applied by joint controllers.
- Parameters
maxForce – The maximum generalized force.
dof – The index of the DOF.
- Returns
True for success, false otherwise.
-
virtual double position(const size_t dof = 0) const = 0
Get the position of a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The position of the joint DOF.
-
virtual double velocity(const size_t dof = 0) const = 0
Get the velocity of a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The velocity of the joint DOF.
-
virtual double acceleration(const size_t dof = 0) const = 0
Get the acceleration of a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The acceleration of the joint DOF.
-
virtual double generalizedForce(const size_t dof = 0) const = 0
Get the generalized force of a joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
The generalized force of the joint DOF.
-
virtual bool setPositionTarget(const double position, const size_t dof = 0) = 0
Set the position target of a joint DOF.
The target is processed by a joint controller, if enabled.
- Parameters
position – The position target of the joint DOF.
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid.
- Returns
True for success, false otherwise.
-
virtual bool setVelocityTarget(const double velocity, const size_t dof = 0) = 0
Set the velocity target of a joint DOF.
The target is processed by a joint controller, if enabled.
- Parameters
velocity – The velocity target of the joint DOF.
dof – The index of the DOF.
- Returns
True for success, false otherwise.
-
virtual bool setAccelerationTarget(const double acceleration, const size_t dof = 0) = 0
Set the acceleration target of a joint DOF.
The target is processed by a joint controller, if enabled.
- Parameters
acceleration – The acceleration target of the joint DOF.
dof – The index of the DOF.
- Returns
True for success, false otherwise.
-
virtual bool setGeneralizedForceTarget(const double force, const size_t dof = 0) = 0
Set the generalized force target of a joint DOF.
The force is applied to the desired DOF. Note that if there’s friction or other loss components, the real joint force will differ.
- Parameters
force – The generalized force target of the joint DOF.
dof – The index of the DOF.
- Returns
True for success, false otherwise.
-
virtual double positionTarget(const size_t dof = 0) const = 0
Get the active position target of the joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid or if no position target was set.
- Returns
The position target of the joint DOF.
-
virtual double velocityTarget(const size_t dof = 0) const = 0
Get the active velocity target of the joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid or if no velocity target was set.
- Returns
The velocity target of the joint DOF.
-
virtual double accelerationTarget(const size_t dof = 0) const = 0
Get the active acceleration target of the joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid or if no acceleration target was set.
- Returns
The acceleration target of the joint DOF.
-
virtual double generalizedForceTarget(const size_t dof = 0) const = 0
Get the active generalized force target of the joint DOF.
- Parameters
dof – The index of the DOF.
- Throws
std::runtime_error – if the DOF is not valid or if no generalized force target was set.
- Returns
The generalized force target of the joint DOF.
-
virtual JointLimit jointPositionLimit() const = 0
Get the position limits of the joint.
- Returns
The position limits of the joint.
-
virtual JointLimit jointVelocityLimit() const = 0
Get the velocity limits of the joint.
- Returns
The velocity limits of the joint.
-
virtual bool setJointVelocityLimit(const std::vector<double> &maxVelocity) = 0
Set the maximum velocity of the joint.
This limit can be used to clip the velocity applied by joint controllers.
- Parameters
maxVelocity – A vector with the maximum velocity of the joint DOFs.
- Returns
True for success, false otherwise.
-
virtual std::vector<double> jointMaxGeneralizedForce() const = 0
Get the maximum generalized force that could be applied to the joint.
- Returns
The maximum generalized force of the joint.
-
virtual bool setJointMaxGeneralizedForce(const std::vector<double> &maxForce) = 0
Set the maximum generalized force that can be applied to the joint.
This limit can be used to clip the force applied by joint controllers.
- Parameters
maxForce – A vector with the maximum generalized forces of the joint DOFs.
- Returns
True for success, false otherwise.
-
virtual std::vector<double> jointPosition() const = 0
Get the position of the joint.
- Returns
The position of the joint.
-
virtual std::vector<double> jointVelocity() const = 0
Get the velocity of the joint.
- Returns
The velocity of the joint.
-
virtual std::vector<double> jointAcceleration() const = 0
Get the acceleration of the joint.
- Returns
The acceleration of the joint.
-
virtual std::vector<double> jointGeneralizedForce() const = 0
Get the generalized force of the joint.
- Returns
The generalized force of the joint.
-
virtual bool setJointPositionTarget(const std::vector<double> &position) = 0
Set the position target of the joint.
The target is processed by a joint controller, if enabled.
- Parameters
position – A vector with the position targets of the joint DOFs.
- Returns
True for success, false otherwise.
-
virtual bool setJointVelocityTarget(const std::vector<double> &velocity) = 0
Set the velocity target of the joint.
The target is processed by a joint controller, if enabled.
- Parameters
velocity – A vector with the velocity targets of the joint DOFs.
- Returns
True for success, false otherwise.
-
virtual bool setJointAccelerationTarget(const std::vector<double> &acceleration) = 0
Set the acceleration target of the joint.
The target is processed by a joint controller, if enabled.
- Parameters
acceleration – A vector with the acceleration targets of the joint DOFs.
- Returns
True for success, false otherwise.
-
virtual bool setJointGeneralizedForceTarget(const std::vector<double> &force) = 0
Set the generalized force target of the joint.
Note that if there’s friction or other loss components, the real joint force will differ.
- Parameters
force – A vector with the generalized force targets of the joint DOFs.
- Returns
True for success, false otherwise.
-
virtual std::vector<double> jointPositionTarget() const = 0
Get the active position target.
- Returns
The position target of the joint.
-
virtual std::vector<double> jointVelocityTarget() const = 0
Get the active velocity target.
- Returns
The velocity target of the joint.
-
virtual std::vector<double> jointAccelerationTarget() const = 0
Get the active acceleration target.
- Returns
The acceleration target of the joint.
-
virtual std::vector<double> jointGeneralizedForceTarget() const = 0
Get the active generalized force target.
- Returns
The generalized force target of the joint.
-
virtual bool valid() const = 0¶
-
struct JointLimit¶
-
struct Limit¶
-
class Link¶
Subclassed by scenario::gazebo::Link
Public Functions
-
virtual bool valid() const = 0¶
Check if the link is valid.
- Returns
True if the link is valid, false otherwise.
-
virtual std::string name(const bool scoped = false) const = 0¶
Get the name of the link.
- Parameters
scoped – If true, the scoped name of the link is returned.
- Returns
The name of the link.
-
virtual double mass() const = 0¶
Get the mass of the link.
- Returns
The mass of the link.
-
virtual std::array<double, 3> position() const = 0¶
Get the position of the link.
The returned position is the position of the link frame, as it was defined in the model file, in world coordinates.
- Returns
The cartesian position of the link frame in world coordinates.
-
virtual std::array<double, 4> orientation() const = 0¶
Get the orientation of the link.
The orientation is returned as a quaternion, which defines the rotation between the world frame and the link frame.
- Returns
The wxyz quaternion defining the orientation if the link wrt the world frame.
-
virtual std::array<double, 3> worldLinearVelocity() const = 0¶
Get the linear mixed velocity of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The linear mixed velocity of the link.
-
virtual std::array<double, 3> worldAngularVelocity() const = 0¶
Get the angular mixed velocity of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The angular mixed velocity of the link.
-
virtual std::array<double, 3> bodyLinearVelocity() const = 0¶
Get the linear body velocity of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The linear body velocity of the link.
-
virtual std::array<double, 3> bodyAngularVelocity() const = 0¶
Get the angular body velocity of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The angular body velocity of the link.
-
virtual std::array<double, 3> worldLinearAcceleration() const = 0¶
Get the linear mixed acceleration of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The linear mixed acceleration of the link.
-
virtual std::array<double, 3> worldAngularAcceleration() const = 0¶
Get the angular mixed acceleration of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The angular mixed acceleration of the link.
-
virtual std::array<double, 3> bodyLinearAcceleration() const = 0¶
Get the linear body acceleration of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The linear body acceleration of the link.
-
virtual std::array<double, 3> bodyAngularAcceleration() const = 0¶
Get the angular body acceleration of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The angular body acceleration of the link.
-
virtual bool contactsEnabled() const = 0¶
Check if the contact detection is enabled.
- Returns
True if the contact detection is enabled, false otherwise.
-
virtual bool enableContactDetection(const bool enable) = 0¶
Enable the contact detection.
- Parameters
enable – True to enable the contact detection, false to disable.
- Returns
True for success, false otherwise.
-
virtual bool inContact() const = 0¶
Check if the link has active contacts.
- Returns
True if the link has at least one contact and contacts are enabled, false otherwise.
-
virtual std::vector<Contact> contacts() const = 0¶
Get the active contacts of the link.
- Returns
The vector of active contacts.
-
virtual std::array<double, 6> contactWrench() const = 0¶
Get the total wrench generated by the active contacts.
All the contact wrenches are composed to an equivalent wrench applied to the origin of the link frame and expressed in world coordinates.
- Returns
The total wrench of the active contacts.
-
virtual bool valid() const = 0
Check if the link is valid.
- Returns
True if the link is valid, false otherwise.
-
virtual std::string name(const bool scoped = false) const = 0
Get the name of the link.
- Parameters
scoped – If true, the scoped name of the link is returned.
- Returns
The name of the link.
-
virtual double mass() const = 0
Get the mass of the link.
- Returns
The mass of the link.
-
virtual std::array<double, 3> position() const = 0
Get the position of the link.
The returned position is the position of the link frame, as it was defined in the model file, in world coordinates.
- Returns
The cartesian position of the link frame in world coordinates.
-
virtual std::array<double, 4> orientation() const = 0
Get the orientation of the link.
The orientation is returned as a quaternion, which defines the rotation between the world frame and the link frame.
- Returns
The wxyz quaternion defining the orientation if the link wrt the world frame.
-
virtual std::array<double, 3> worldLinearVelocity() const = 0
Get the linear mixed velocity of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The linear mixed velocity of the link.
-
virtual std::array<double, 3> worldAngularVelocity() const = 0
Get the angular mixed velocity of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The angular mixed velocity of the link.
-
virtual std::array<double, 3> bodyLinearVelocity() const = 0
Get the linear body velocity of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The linear body velocity of the link.
-
virtual std::array<double, 3> bodyAngularVelocity() const = 0
Get the angular body velocity of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The angular body velocity of the link.
-
virtual std::array<double, 3> worldLinearAcceleration() const = 0
Get the linear mixed acceleration of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The linear mixed acceleration of the link.
-
virtual std::array<double, 3> worldAngularAcceleration() const = 0
Get the angular mixed acceleration of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The angular mixed acceleration of the link.
-
virtual std::array<double, 3> bodyLinearAcceleration() const = 0
Get the linear body acceleration of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The linear body acceleration of the link.
-
virtual std::array<double, 3> bodyAngularAcceleration() const = 0
Get the angular body acceleration of the link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The angular body acceleration of the link.
-
virtual bool contactsEnabled() const = 0
Check if the contact detection is enabled.
- Returns
True if the contact detection is enabled, false otherwise.
-
virtual bool enableContactDetection(const bool enable) = 0
Enable the contact detection.
- Parameters
enable – True to enable the contact detection, false to disable.
- Returns
True for success, false otherwise.
-
virtual bool inContact() const = 0
Check if the link has active contacts.
- Returns
True if the link has at least one contact and contacts are enabled, false otherwise.
-
virtual std::vector<Contact> contacts() const = 0
Get the active contacts of the link.
- Returns
The vector of active contacts.
-
virtual std::array<double, 6> contactWrench() const = 0
Get the total wrench generated by the active contacts.
All the contact wrenches are composed to an equivalent wrench applied to the origin of the link frame and expressed in world coordinates.
- Returns
The total wrench of the active contacts.
-
virtual bool valid() const = 0¶
-
class Model¶
Subclassed by scenario::gazebo::Model
Public Functions
-
virtual bool valid() const = 0¶
Check if the model is valid.
- Returns
True if the model is valid, false otherwise.
-
virtual size_t dofs(const std::vector<std::string> &jointNames = {}) const = 0¶
Get the degrees of freedom of the model.
- Parameters
jointNames – Optionally restrict the count to a subset of joints.
- Returns
The number of degrees of freedom of the model.
-
virtual std::string name() const = 0¶
Get the name of the model.
- Returns
The name of the model.
-
virtual size_t nrOfLinks() const = 0¶
Get the number of links of the model.
- Returns
The number of links.
-
virtual size_t nrOfJoints() const = 0¶
Get the number of joints of the model.
- Returns
The number of joints.
-
virtual double totalMass(const std::vector<std::string> &linkNames = {}) const = 0¶
Get the total mass of the model.
- Parameters
linkNames – Optionally restrict the count to a subset of links.
- Returns
The total mass of the model.
-
virtual LinkPtr getLink(const std::string &linkName) const = 0¶
Get a link belonging to the model.
- Parameters
linkName – The name of the link.
- Throws
std::runtime_error – if the link does not exist.
- Returns
The desired link.
-
virtual JointPtr getJoint(const std::string &jointName) const = 0¶
Get a joint belonging to the model.
- Parameters
jointName – The name of the joint.
- Throws
std::runtime_error – if the joint does not exist.
- Returns
The desired joint.
-
virtual std::vector<std::string> linkNames(const bool scoped = false) const = 0¶
Get the name of all the model’s links.
- Parameters
scoped – Scope the link names with the model name (e.g.
mymodel::link1
).- Returns
The list of link names.
-
virtual std::vector<std::string> jointNames(const bool scoped = false) const = 0¶
Get the name of all the model’s joints.
- Parameters
scoped – Scope the joint names with the model name, (e.g.
mymodel::joint1
).- Returns
The list of joint names.
-
virtual double controllerPeriod() const = 0¶
Get the controller period of the model.
If no controller has been enabled, infinite is returned.
- Returns
The controller period of the model.
-
virtual bool setControllerPeriod(const double period) = 0¶
Set the controller period of the model.
This controller period is used by PIDs and custom controller. If it is smaller than the physics step, it is treated as 0.
- Parameters
period – The desired controller period.
- Returns
True for success, false otherwise.
-
virtual bool enableHistoryOfAppliedJointForces(const bool enable = true, const size_t maxHistorySizePerJoint = 100, const std::vector<std::string> &jointNames = {}) = 0¶
Enable logging the applied joint forces.
The output of joint controllers is often a torque. This method allows to log the force references that the controller sent to the joints. It is useful when the controller runs in its own thread at its own rate and the caller wants to extract the forces at a lower frequency.
- Parameters
enable – True to enable logging, false to disable.
maxHistorySizePerJoint – Size of the logging window of each joint.
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.
- Returns
True for success, false otherwise.
-
virtual bool historyOfAppliedJointForcesEnabled(const std::vector<std::string> &jointNames) const = 0¶
Check if logging the applied joint force is enabled.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
True if the log is enabled, false otherwise.
-
virtual std::vector<double> historyOfAppliedJointForces(const std::vector<std::string> &jointNames = {}) const = 0¶
Get the log of applied joint forces.
Note
Given a serialization, the window has
DoFs * JointWindowSize
elements. The elements are ordered per time steps, i.e. the first#DoFs
elements refer to the oldest forces of the windows ordered with the active joint serialization.Note
If a joint has multiple DoFs, they are serialized contiguously.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
The entire window of applied joint forces.
-
virtual bool contactsEnabled() const = 0¶
Check if the contact detection is enabled model-wise.
- Returns
True if the contact detection is enabled model-wise, false otherwise.
-
virtual bool enableContacts(const bool enable = true) = 0¶
Enable the contact detection model-wise.
- Parameters
enable – True to enable the contact detection model-wise, false to disable.
- Returns
True for success, false otherwise.
-
virtual std::vector<std::string> linksInContact() const = 0¶
Get the vector of links with active contacts with other bodies.
- Returns
The vector of links in contact.
-
virtual std::vector<Contact> contacts(const std::vector<std::string> &linkNames = {}) const = 0¶
Get the active contacts of the model.
- Parameters
linkNames – Optionally restrict the considered links.
- Returns
A vector of contacts.
-
virtual std::vector<double> jointPositions(const std::vector<std::string> &jointNames = {}) const = 0¶
Get the joint positions.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
The serialization of joint positions. The vector has as many elements as DoFs of the considered joints.
-
virtual std::vector<double> jointVelocities(const std::vector<std::string> &jointNames = {}) const = 0¶
Get the joint velocities.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
The serialization of joint velocities. The vector has as many elements as DoFs of the considered joints.
-
virtual std::vector<double> jointAccelerations(const std::vector<std::string> &jointNames = {}) const = 0¶
Get the joint accelerations.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
The serialization of joint accelerations. The vector has as many elements as DoFs of the considered joints.
-
virtual std::vector<double> jointGeneralizedForces(const std::vector<std::string> &jointNames = {}) const = 0¶
Get the joint generalized forces.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
The serialization of joint forces. The vector has as many elements as DoFs of the considered joints.
-
virtual JointLimit jointLimits(const std::vector<std::string> &jointNames = {}) const = 0¶
Get the joint limits of the model.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
The joint limits of the model. The vectors of the limit object have as many elements as DoFs of the considered joints.
-
virtual bool setJointControlMode(const JointControlMode mode, const std::vector<std::string> &jointNames = {}) = 0¶
Set the control mode of model joints.
- Parameters
mode – The desired joint control mode.
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.
- Returns
True for success, false otherwise.
-
virtual std::vector<LinkPtr> links(const std::vector<std::string> &linkNames = {}) const = 0¶
Get the links of the model.
- Parameters
linkNames – Optional vector of considered links. By default,
Model::linkNames
is used.- Returns
A vector of pointers to the link objects.
-
virtual std::vector<JointPtr> joints(const std::vector<std::string> &jointNames = {}) const = 0¶
Get the joints of the model.
- Parameters
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.- Returns
A vector of pointers to the joint objects.
-
virtual bool setJointPositionTargets(const std::vector<double> &positions, const std::vector<std::string> &jointNames = {}) = 0¶
Set the position targets of the joints.
- Parameters
positions – The vector with the joint position targets. It must have as many elements as the considered joint DoFs.
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.
- Returns
True for success, false otherwise.
-
virtual bool setJointVelocityTargets(const std::vector<double> &velocities, const std::vector<std::string> &jointNames = {}) = 0¶
Set the velocity targets of the joints.
- Parameters
velocities – The vector with the joint velocity targets. It must have as many elements as the considered joint DoFs.
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.
- Returns
True for success, false otherwise.
-
virtual bool setJointAccelerationTargets(const std::vector<double> &accelerations, const std::vector<std::string> &jointNames = {}) = 0¶
Set the acceleration targets of the joints.
- Parameters
accelerations – The vector with the joint acceleration targets. It must have as many elements as the considered joint DoFs.
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.
- Returns
True for success, false otherwise.
-
virtual bool setJointGeneralizedForceTargets(const std::vector<double> &forces, const std::vector<std::string> &jointNames = {}) = 0¶
Set the generalized force targets of the joints.
- Parameters
forces – The vector with the joint generalized force targets. It must have as many elements as the considered joint DoFs.
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.
- Returns
True for success, false otherwise.
-
virtual std::vector<double> jointPositionTargets(const std::vector<std::string> &jointNames = {}) const = 0¶
Get the position targets of the joints.
- Parameters
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.- Returns
The position targets of the joints.
-
virtual std::vector<double> jointVelocityTargets(const std::vector<std::string> &jointNames = {}) const = 0¶
Get the velocity targets of the joints.
- Parameters
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.- Returns
The velocity targets of the joints.
-
virtual std::vector<double> jointAccelerationTargets(const std::vector<std::string> &jointNames = {}) const = 0¶
Get the acceleration targets of the joints.
- Parameters
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.- Returns
The acceleration targets of the joints.
-
virtual std::vector<double> jointGeneralizedForceTargets(const std::vector<std::string> &jointNames = {}) const = 0¶
Get the generalized force targets of the joints.
- Parameters
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.- Returns
The generalized force targets of the joints.
-
virtual std::string baseFrame() const = 0¶
Get the name of the model’s base frame.
By default, the base frame is typically the root of the kinematic tree of the model.
- Returns
The name of the model’s base frame.
-
virtual std::array<double, 3> basePosition() const = 0¶
Get the position of the base link.
- Returns
The position of the base link in world coordinates.
-
virtual std::array<double, 4> baseOrientation() const = 0¶
Get the orientation of the base link.
- Returns
The wxyz quaternion defining the orientation of the base link wrt the world frame.
-
virtual std::array<double, 3> baseBodyLinearVelocity() const = 0¶
Get the linear body velocity of the base link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The linear body velocity of the base link.
-
virtual std::array<double, 3> baseBodyAngularVelocity() const = 0¶
Get the angular body velocity of the base link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The angular body velocity of the base link.
-
virtual std::array<double, 3> baseWorldLinearVelocity() const = 0¶
Get the linear mixed velocity of the base link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The linear mixed velocity of the base link.
-
virtual std::array<double, 3> baseWorldAngularVelocity() const = 0¶
Get the angular mixed velocity of the base link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The angular mixed velocity of the base link.
-
virtual bool setBasePoseTarget(const std::array<double, 3> &position, const std::array<double, 4> &orientation) = 0¶
Set the pose target of the base link.
- Parameters
position – The position target of the base link in world coordinates.
orientation – The wxyz quaternion defining the orientation target of the base link wrt the world frame.
- Returns
True for success, false otherwise.
-
virtual bool setBasePositionTarget(const std::array<double, 3> &position) = 0¶
Set the position target of the base link.
- Parameters
position – The position target of the base link in world coordinates.
- Returns
True for success, false otherwise.
-
virtual bool setBaseOrientationTarget(const std::array<double, 4> &orientation) = 0¶
Set the orientation target of the base link.
- Parameters
orientation – The wxyz quaternion defining the orientation target of the base link wrt the world frame.
- Returns
True for success, false otherwise.
-
virtual bool setBaseWorldVelocityTarget(const std::array<double, 3> &linear, const std::array<double, 3> &angular) = 0¶
Set the mixed velocity target of the base link.
- Parameters
linear – The mixed linear velocity target of the base link.
angular – The mixed angular velocity target of the base link.
- Returns
True for success, false otherwise.
-
virtual bool setBaseWorldLinearVelocityTarget(const std::array<double, 3> &linear) = 0¶
Set the mixed linear velocity target of the base link.
- Parameters
linear – The mixed linear velocity target of the base link.
- Returns
True for success, false otherwise.
-
virtual bool setBaseWorldAngularVelocityTarget(const std::array<double, 3> &angular) = 0¶
Set the mixed angular velocity target of the base link.
- Parameters
angular – The mixed angular velocity target of the base link.
- Returns
True for success, false otherwise.
-
virtual bool setBaseWorldLinearAccelerationTarget(const std::array<double, 3> &linear) = 0¶
Set the mixed linear acceleration target of the base link.
- Parameters
linear – The mixed linear acceleration target of the base link.
- Returns
True for success, false otherwise.
-
virtual bool setBaseWorldAngularAccelerationTarget(const std::array<double, 3> &angular) = 0¶
Set the mixed angular acceleration target of the base link.
- Parameters
angular – The mixed angular acceleration target of the base link.
- Returns
True for success, false otherwise.
-
virtual std::array<double, 3> basePositionTarget() const = 0¶
Get the position target of the base link.
- Returns
The position target of the base link.
-
virtual std::array<double, 4> baseOrientationTarget() const = 0¶
Get the orientation target of the base link.
- Returns
The quaternion defining the orientation target of the base link.
-
virtual std::array<double, 3> baseWorldLinearVelocityTarget() const = 0¶
Get the mixed linear velocity target of the base link.
- Returns
The mixed linear velocity target of the base link.
-
virtual std::array<double, 3> baseWorldAngularVelocityTarget() const = 0¶
Get the mixed angular velocity target of the base link.
- Returns
The mixed angular velocity target of the base link.
-
virtual std::array<double, 3> baseWorldLinearAccelerationTarget() const = 0¶
Get the mixed linear acceleration target of the base link.
- Returns
The mixed linear acceleration target of the base link.
-
virtual std::array<double, 3> baseWorldAngularAccelerationTarget() const = 0¶
Get the mixed angular acceleration target of the base link.
- Returns
The mixed angular acceleration target of the base link.
-
virtual bool valid() const = 0
Check if the model is valid.
- Returns
True if the model is valid, false otherwise.
-
virtual size_t dofs(const std::vector<std::string> &jointNames = {}) const = 0
Get the degrees of freedom of the model.
- Parameters
jointNames – Optionally restrict the count to a subset of joints.
- Returns
The number of degrees of freedom of the model.
-
virtual std::string name() const = 0
Get the name of the model.
- Returns
The name of the model.
-
virtual size_t nrOfLinks() const = 0
Get the number of links of the model.
- Returns
The number of links.
-
virtual size_t nrOfJoints() const = 0
Get the number of joints of the model.
- Returns
The number of joints.
-
virtual double totalMass(const std::vector<std::string> &linkNames = {}) const = 0
Get the total mass of the model.
- Parameters
linkNames – Optionally restrict the count to a subset of links.
- Returns
The total mass of the model.
-
virtual LinkPtr getLink(const std::string &linkName) const = 0
Get a link belonging to the model.
- Parameters
linkName – The name of the link.
- Throws
std::runtime_error – if the link does not exist.
- Returns
The desired link.
-
virtual JointPtr getJoint(const std::string &jointName) const = 0
Get a joint belonging to the model.
- Parameters
jointName – The name of the joint.
- Throws
std::runtime_error – if the joint does not exist.
- Returns
The desired joint.
-
virtual std::vector<std::string> linkNames(const bool scoped = false) const = 0
Get the name of all the model’s links.
- Parameters
scoped – Scope the link names with the model name (e.g.
mymodel::link1
).- Returns
The list of link names.
-
virtual std::vector<std::string> jointNames(const bool scoped = false) const = 0
Get the name of all the model’s joints.
- Parameters
scoped – Scope the joint names with the model name, (e.g.
mymodel::joint1
).- Returns
The list of joint names.
-
virtual double controllerPeriod() const = 0
Get the controller period of the model.
If no controller has been enabled, infinite is returned.
- Returns
The controller period of the model.
-
virtual bool setControllerPeriod(const double period) = 0
Set the controller period of the model.
This controller period is used by PIDs and custom controller. If it is smaller than the physics step, it is treated as 0.
- Parameters
period – The desired controller period.
- Returns
True for success, false otherwise.
-
virtual bool enableHistoryOfAppliedJointForces(const bool enable = true, const size_t maxHistorySizePerJoint = 100, const std::vector<std::string> &jointNames = {}) = 0
Enable logging the applied joint forces.
The output of joint controllers is often a torque. This method allows to log the force references that the controller sent to the joints. It is useful when the controller runs in its own thread at its own rate and the caller wants to extract the forces at a lower frequency.
- Parameters
enable – True to enable logging, false to disable.
maxHistorySizePerJoint – Size of the logging window of each joint.
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.
- Returns
True for success, false otherwise.
-
virtual bool historyOfAppliedJointForcesEnabled(const std::vector<std::string> &jointNames) const = 0
Check if logging the applied joint force is enabled.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
True if the log is enabled, false otherwise.
-
virtual std::vector<double> historyOfAppliedJointForces(const std::vector<std::string> &jointNames = {}) const = 0
Get the log of applied joint forces.
Note
Given a serialization, the window has
DoFs * JointWindowSize
elements. The elements are ordered per time steps, i.e. the first#DoFs
elements refer to the oldest forces of the windows ordered with the active joint serialization.Note
If a joint has multiple DoFs, they are serialized contiguously.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
The entire window of applied joint forces.
-
virtual bool contactsEnabled() const = 0
Check if the contact detection is enabled model-wise.
- Returns
True if the contact detection is enabled model-wise, false otherwise.
-
virtual bool enableContacts(const bool enable = true) = 0
Enable the contact detection model-wise.
- Parameters
enable – True to enable the contact detection model-wise, false to disable.
- Returns
True for success, false otherwise.
-
virtual std::vector<std::string> linksInContact() const = 0
Get the vector of links with active contacts with other bodies.
- Returns
The vector of links in contact.
-
virtual std::vector<Contact> contacts(const std::vector<std::string> &linkNames = {}) const = 0
Get the active contacts of the model.
- Parameters
linkNames – Optionally restrict the considered links.
- Returns
A vector of contacts.
-
virtual std::vector<double> jointPositions(const std::vector<std::string> &jointNames = {}) const = 0
Get the joint positions.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
The serialization of joint positions. The vector has as many elements as DoFs of the considered joints.
-
virtual std::vector<double> jointVelocities(const std::vector<std::string> &jointNames = {}) const = 0
Get the joint velocities.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
The serialization of joint velocities. The vector has as many elements as DoFs of the considered joints.
-
virtual std::vector<double> jointAccelerations(const std::vector<std::string> &jointNames = {}) const = 0
Get the joint accelerations.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
The serialization of joint accelerations. The vector has as many elements as DoFs of the considered joints.
-
virtual std::vector<double> jointGeneralizedForces(const std::vector<std::string> &jointNames = {}) const = 0
Get the joint generalized forces.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
The serialization of joint forces. The vector has as many elements as DoFs of the considered joints.
-
virtual JointLimit jointLimits(const std::vector<std::string> &jointNames = {}) const = 0
Get the joint limits of the model.
- Parameters
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.- Returns
The joint limits of the model. The vectors of the limit object have as many elements as DoFs of the considered joints.
-
virtual bool setJointControlMode(const JointControlMode mode, const std::vector<std::string> &jointNames = {}) = 0
Set the control mode of model joints.
- Parameters
mode – The desired joint control mode.
jointNames – Optional vector of considered joints that also defines the joint serialization. By default,
Model::jointNames
is used.
- Returns
True for success, false otherwise.
-
virtual std::vector<LinkPtr> links(const std::vector<std::string> &linkNames = {}) const = 0
Get the links of the model.
- Parameters
linkNames – Optional vector of considered links. By default,
Model::linkNames
is used.- Returns
A vector of pointers to the link objects.
-
virtual std::vector<JointPtr> joints(const std::vector<std::string> &jointNames = {}) const = 0
Get the joints of the model.
- Parameters
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.- Returns
A vector of pointers to the joint objects.
-
virtual bool setJointPositionTargets(const std::vector<double> &positions, const std::vector<std::string> &jointNames = {}) = 0
Set the position targets of the joints.
- Parameters
positions – The vector with the joint position targets. It must have as many elements as the considered joint DoFs.
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.
- Returns
True for success, false otherwise.
-
virtual bool setJointVelocityTargets(const std::vector<double> &velocities, const std::vector<std::string> &jointNames = {}) = 0
Set the velocity targets of the joints.
- Parameters
velocities – The vector with the joint velocity targets. It must have as many elements as the considered joint DoFs.
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.
- Returns
True for success, false otherwise.
-
virtual bool setJointAccelerationTargets(const std::vector<double> &accelerations, const std::vector<std::string> &jointNames = {}) = 0
Set the acceleration targets of the joints.
- Parameters
accelerations – The vector with the joint acceleration targets. It must have as many elements as the considered joint DoFs.
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.
- Returns
True for success, false otherwise.
-
virtual bool setJointGeneralizedForceTargets(const std::vector<double> &forces, const std::vector<std::string> &jointNames = {}) = 0
Set the generalized force targets of the joints.
- Parameters
forces – The vector with the joint generalized force targets. It must have as many elements as the considered joint DoFs.
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.
- Returns
True for success, false otherwise.
-
virtual std::vector<double> jointPositionTargets(const std::vector<std::string> &jointNames = {}) const = 0
Get the position targets of the joints.
- Parameters
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.- Returns
The position targets of the joints.
-
virtual std::vector<double> jointVelocityTargets(const std::vector<std::string> &jointNames = {}) const = 0
Get the velocity targets of the joints.
- Parameters
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.- Returns
The velocity targets of the joints.
-
virtual std::vector<double> jointAccelerationTargets(const std::vector<std::string> &jointNames = {}) const = 0
Get the acceleration targets of the joints.
- Parameters
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.- Returns
The acceleration targets of the joints.
-
virtual std::vector<double> jointGeneralizedForceTargets(const std::vector<std::string> &jointNames = {}) const = 0
Get the generalized force targets of the joints.
- Parameters
jointNames – Optional vector of considered joints. By default,
Model::jointNames
is used.- Returns
The generalized force targets of the joints.
-
virtual std::string baseFrame() const = 0
Get the name of the model’s base frame.
By default, the base frame is typically the root of the kinematic tree of the model.
- Returns
The name of the model’s base frame.
-
virtual std::array<double, 3> basePosition() const = 0
Get the position of the base link.
- Returns
The position of the base link in world coordinates.
-
virtual std::array<double, 4> baseOrientation() const = 0
Get the orientation of the base link.
- Returns
The wxyz quaternion defining the orientation of the base link wrt the world frame.
-
virtual std::array<double, 3> baseBodyLinearVelocity() const = 0
Get the linear body velocity of the base link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The linear body velocity of the base link.
-
virtual std::array<double, 3> baseBodyAngularVelocity() const = 0
Get the angular body velocity of the base link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The angular body velocity of the base link.
-
virtual std::array<double, 3> baseWorldLinearVelocity() const = 0
Get the linear mixed velocity of the base link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The linear mixed velocity of the base link.
-
virtual std::array<double, 3> baseWorldAngularVelocity() const = 0
Get the angular mixed velocity of the base link.
- Todo:
Add link to the velocity representation documentation page.
- Returns
The angular mixed velocity of the base link.
-
virtual bool setBasePoseTarget(const std::array<double, 3> &position, const std::array<double, 4> &orientation) = 0
Set the pose target of the base link.
- Parameters
position – The position target of the base link in world coordinates.
orientation – The wxyz quaternion defining the orientation target of the base link wrt the world frame.
- Returns
True for success, false otherwise.
-
virtual bool setBasePositionTarget(const std::array<double, 3> &position) = 0
Set the position target of the base link.
- Parameters
position – The position target of the base link in world coordinates.
- Returns
True for success, false otherwise.
-
virtual bool setBaseOrientationTarget(const std::array<double, 4> &orientation) = 0
Set the orientation target of the base link.
- Parameters
orientation – The wxyz quaternion defining the orientation target of the base link wrt the world frame.
- Returns
True for success, false otherwise.
-
virtual bool setBaseWorldVelocityTarget(const std::array<double, 3> &linear, const std::array<double, 3> &angular) = 0
Set the mixed velocity target of the base link.
- Parameters
linear – The mixed linear velocity target of the base link.
angular – The mixed angular velocity target of the base link.
- Returns
True for success, false otherwise.
-
virtual bool setBaseWorldLinearVelocityTarget(const std::array<double, 3> &linear) = 0
Set the mixed linear velocity target of the base link.
- Parameters
linear – The mixed linear velocity target of the base link.
- Returns
True for success, false otherwise.
-
virtual bool setBaseWorldAngularVelocityTarget(const std::array<double, 3> &angular) = 0
Set the mixed angular velocity target of the base link.
- Parameters
angular – The mixed angular velocity target of the base link.
- Returns
True for success, false otherwise.
-
virtual bool setBaseWorldLinearAccelerationTarget(const std::array<double, 3> &linear) = 0
Set the mixed linear acceleration target of the base link.
- Parameters
linear – The mixed linear acceleration target of the base link.
- Returns
True for success, false otherwise.
-
virtual bool setBaseWorldAngularAccelerationTarget(const std::array<double, 3> &angular) = 0
Set the mixed angular acceleration target of the base link.
- Parameters
angular – The mixed angular acceleration target of the base link.
- Returns
True for success, false otherwise.
-
virtual std::array<double, 3> basePositionTarget() const = 0
Get the position target of the base link.
- Returns
The position target of the base link.
-
virtual std::array<double, 4> baseOrientationTarget() const = 0
Get the orientation target of the base link.
- Returns
The quaternion defining the orientation target of the base link.
-
virtual std::array<double, 3> baseWorldLinearVelocityTarget() const = 0
Get the mixed linear velocity target of the base link.
- Returns
The mixed linear velocity target of the base link.
-
virtual std::array<double, 3> baseWorldAngularVelocityTarget() const = 0
Get the mixed angular velocity target of the base link.
- Returns
The mixed angular velocity target of the base link.
-
virtual std::array<double, 3> baseWorldLinearAccelerationTarget() const = 0
Get the mixed linear acceleration target of the base link.
- Returns
The mixed linear acceleration target of the base link.
-
virtual std::array<double, 3> baseWorldAngularAccelerationTarget() const = 0
Get the mixed angular acceleration target of the base link.
- Returns
The mixed angular acceleration target of the base link.
-
virtual bool valid() const = 0¶
-
struct PID¶
-
struct Pose¶
-
class World¶
Subclassed by scenario::gazebo::World
Public Functions
-
virtual bool valid() const = 0¶
Check if the world is valid.
- Returns
True if the world is valid, false otherwise.
-
virtual double time() const = 0¶
Get the simulated time.
Note
A physics plugin need to be part of the simulation in order to make the time flow.
- Returns
The simulated time.
-
virtual std::string name() const = 0¶
Get the name of the world.
- Returns
The name of the world.
-
virtual std::array<double, 3> gravity() const = 0¶
Get the gravity vector.
- Returns
The gravity vector.
-
virtual std::vector<std::string> modelNames() const = 0¶
Get the name of the models that are part of the world.
- Returns
The list of model names.
-
virtual ModelPtr getModel(const std::string &modelName) const = 0¶
Get a model part of the world.
- Parameters
modelName – The name of the model to get.
- Returns
The model if it is part of the world,
nullptr
otherwise.
-
virtual std::vector<ModelPtr> models(const std::vector<std::string> &modelNames = {}) const = 0¶
Get the models of the world.
- Parameters
modelNames – Optional vector of considered models. By default,
World::modelNames
is used.- Returns
A vector of pointers to the model objects.
-
virtual bool valid() const = 0
Check if the world is valid.
- Returns
True if the world is valid, false otherwise.
-
virtual double time() const = 0
Get the simulated time.
Note
A physics plugin need to be part of the simulation in order to make the time flow.
- Returns
The simulated time.
-
virtual std::string name() const = 0
Get the name of the world.
- Returns
The name of the world.
-
virtual std::array<double, 3> gravity() const = 0
Get the gravity vector.
- Returns
The gravity vector.
-
virtual std::vector<std::string> modelNames() const = 0
Get the name of the models that are part of the world.
- Returns
The list of model names.
-
virtual ModelPtr getModel(const std::string &modelName) const = 0
Get a model part of the world.
- Parameters
modelName – The name of the model to get.
- Returns
The model if it is part of the world,
nullptr
otherwise.
-
virtual std::vector<ModelPtr> models(const std::vector<std::string> &modelNames = {}) const = 0
Get the models of the world.
- Parameters
modelNames – Optional vector of considered models. By default,
World::modelNames
is used.- Returns
A vector of pointers to the model objects.
-
virtual bool valid() const = 0¶
-
namespace utils¶
Functions
-
std::string getInstallPrefix()¶
Get the install prefix used by the CMake project.
Note
It is defined only if the project is installed in Developer mode.
- Returns
A string with the install prefix if the project is installed in Developer mode, an empty string otherwise.
-
class SignalManager¶
-
std::string getInstallPrefix()¶
-
enum JointType¶