Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Ways of applying force to a body in Gazebo

In a Gazebo API there are many methods of applying force to a link.

  • AddForce
  • AddForceAtRelativePosition
  • AddForceAtWorldPosition
  • AddLinkForce
  • SetForce

  • AddRelativeTorque

  • AddTorque
  • SetTorque

What do they do? What is the difference between AddForce and SetForce? How is AddLinkForce different from the others?

Here is their specification:

virtual void AddForce   (   const math::Vector3 &   _force  )   
pure virtual
Add a force to the body.

Parameters
[in]    _force  Force to add.
Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink.

virtual void AddForceAtRelativePosition (   const math::Vector3 &   _force,
const math::Vector3 &   _relPos 
)       
pure virtual
Add a force to the body at position expressed to the body's own frame of reference.

Parameters
[in]    _force  Force to add.
[in]    _relPos Position on the link to add the force.
Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink.

virtual void AddForceAtWorldPosition    (   const math::Vector3 &   _force,
const math::Vector3 &   _pos 
)       
pure virtual
Add a force to the body using a global position.

Parameters
[in]    _force  Force to add.
[in]    _pos    Position in global coord frame to add the force.
Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink.

virtual void AddLinkForce   (   const math::Vector3 &   _force,
const math::Vector3 &   _offset = math::Vector3::Zero 
)       
pure virtual
Add a force expressed in the link frame.

Parameters
[in]    _force  Direction vector expressed in the link frame. Each component corresponds to the force which will be added in that axis and the vector's magnitude corresponds to the total force.
[in]    _offset Offset position expressed in the link frame. It defaults to the link origin.
Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink.

virtual void AddRelativeTorque  (   const math::Vector3 &   _torque )   
pure virtual
Add a torque to the body, components are relative to the body's own frame of reference.

Parameters
[in]    _torque Torque value to add.
Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink.

virtual void AddTorque  (   const math::Vector3 &   _torque )   
pure virtual
Add a torque to the body.

virtual void SetForce   (   const math::Vector3 &   _force  )   
pure virtual
Set the force applied to the body.

Parameters
[in]    _force  Force value.
Implemented in ODELink, BulletLink, DARTLink, and SimbodyLink.

virtual void SetTorque  (   const math::Vector3 &   _torque )   
pure virtual
Set the torque applied to the body.

Parameters
[in]    _torque Torque value.
Implemented in ODELink, BulletLink, DARTLink, and SimbodyLink.

Ways of applying force to a body in Gazebo

In a Gazebo API there are many methods of applying force to a link.

  • AddForce
  • AddForceAtRelativePosition
  • AddForceAtWorldPosition
  • AddLinkForce
  • SetForce

  • AddRelativeTorque

  • AddTorque
  • SetTorque

What do they do? What is the difference between AddForce and SetForce? How is AddLinkForce different from the others?

Here is their specification:

virtual void AddForce ( const const math::Vector3 & _force ) pure virtual pure virtual Add a force to the body. Parameters [in] body.

Parameters [in] _force Force to add. Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink.

virtual void AddForceAtRelativePosition ( const math::Vector3 & _force, const math::Vector3 & _relPos ) pure virtual Add a force to the body at position expressed to the body's own frame of reference.

Parameters [in] _force Force to add. [in] _relPos Position on the link to add the force. Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink. virtual void AddForceAtRelativePosition and DARTLink.

virtual void AddForceAtWorldPosition ( const math::Vector3 & _force, const math::Vector3 & _relPos const math::Vector3 & _force, const math::Vector3 & _pos ) pure virtual pure virtual Add a force to the body at position expressed to the body's own using a global position.

Parameters [in] _force Force to add. [in] _pos Position in global coord frame of reference. Parameters [in] _force Force to add. [in] _relPos Position on the link to add the force. force. Implemented in in BulletLink, SimbodyLink, ODELink, and DARTLink. and DARTLink.

virtual void AddForceAtWorldPosition AddLinkForce ( const math::Vector3 & _force, const math::Vector3 & _pos const math::Vector3 & _force, const math::Vector3 & _offset = math::Vector3::Zero ) pure virtual Add a force to the body using a global position. Parameters [in] _force Force to add. [in] _pos Position in global coord frame to add the force. Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink. virtual void AddLinkForce ( const math::Vector3 & _force, const math::Vector3 & _offset = math::Vector3::Zero ) pure virtual Add a force expressed in the link frame.

Parameters [in] _force Direction vector expressed in the link frame. Parameters [in] _force Direction vector expressed in the link frame. Each component corresponds to the the force which will be added in that axis axis and the vector's magnitude corresponds corresponds to the total force. [in] [in] _offset Offset position expressed expressed in the link frame. It defaults to the the link origin. origin. Implemented in in BulletLink, SimbodyLink, ODELink, and DARTLink. and DARTLink.

virtual void AddRelativeTorque ( const const math::Vector3 & _torque ) pure virtual pure virtual Add a torque to the body, body, components are relative to the body's body's own frame of reference. Parameters [in] reference.

Parameters [in] _torque Torque value to add. value to add. Implemented in BulletLink, BulletLink, SimbodyLink, ODELink, and DARTLink. DARTLink.

virtual void AddTorque ( const const math::Vector3 & _torque ) pure virtual pure virtual Add a torque to the body. body.

virtual void SetForce ( const const math::Vector3 & _force ) pure virtual pure virtual Set the force applied to the body. Parameters [in] the body.

Parameters [in] _force Force value. Implemented in ODELink, BulletLink, BulletLink, DARTLink, and SimbodyLink. SimbodyLink.

virtual void SetTorque ( const const math::Vector3 & _torque ) pure virtual pure virtual Set the torque applied to the body. Parameters [in] the body.

Parameters [in] _torque Torque value. Implemented in ODELink, BulletLink, BulletLink, DARTLink, and SimbodyLink.

SimbodyLink.

Ways of applying force to a body in Gazebo

In a Gazebo API there are many methods of applying force to a link.

  • AddForce
  • AddForceAtRelativePosition
  • AddForceAtWorldPosition
  • AddLinkForce
  • SetForce

  • AddRelativeTorque

  • AddTorque
  • SetTorque

What do they do? What is the difference between AddForce and SetForce? How is AddLinkForce different from the others?

Here is their specification:

virtual void AddForce ( const math::Vector3 & _force ) ) pure virtual Add a force to the body.

Parameters [in] _force Force to add. Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink.

virtual void AddForceAtRelativePosition ( const math::Vector3 & _force, const math::Vector3 & _relPos ) ) pure virtual Add a force to the body at position expressed to the body's own frame of reference.

Parameters [in] _force Force to add. [in] _relPos Position on the link to add the force. Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink.

virtual void AddForceAtWorldPosition ( const math::Vector3 & _force, const math::Vector3 & _pos ) ) pure virtual Add a force to the body using a global position.

Parameters [in] _force Force to add. [in] _pos Position in global coord frame to add the force. Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink.

virtual void AddLinkForce ( const math::Vector3 & _force, const math::Vector3 & _offset = math::Vector3::Zero ) ) pure virtual Add a force expressed in the link frame.

Parameters [in] _force Direction vector expressed in the link frame. Each component corresponds to the force which will be added in that axis and the vector's magnitude corresponds to the total force. [in] _offset Offset position expressed in the link frame. It defaults to the link origin. Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink.

virtual void AddRelativeTorque ( const math::Vector3 & _torque ) ) pure virtual Add a torque to the body, components are relative to the body's own frame of reference.

Parameters [in] _torque Torque value to add. Implemented in BulletLink, SimbodyLink, ODELink, and DARTLink.

virtual void AddTorque ( const math::Vector3 & _torque ) ) pure virtual Add a torque to the body.

virtual void SetForce ( const math::Vector3 & _force ) ) pure virtual Set the force applied to the body.

Parameters [in] _force Force value. Implemented in ODELink, BulletLink, DARTLink, and SimbodyLink.

virtual void SetTorque ( const math::Vector3 & _torque ) ) pure virtual Set the torque applied to the body.

Parameters [in] _torque Torque value. Implemented in ODELink, BulletLink, DARTLink, and SimbodyLink.