Public Member Functions | Static Public Member Functions | List of all members
gazebo::physics::ODELink Class Reference

ODE Link class. More...

#include <ODELink.hh>

Inheritance diagram for gazebo::physics::ODELink:
Inheritance graph
[legend]

Public Member Functions

 ODELink (EntityPtr _parent)
 Constructor. More...
 
virtual ~ODELink ()
 Destructor. More...
 
virtual void AddForce (const math::Vector3 &_force)
 Add a force to the body. More...
 
virtual void AddForceAtRelativePosition (const math::Vector3 &_force, const math::Vector3 &_relpos)
 Add a force to the body at position expressed to the body's own frame of reference. More...
 
virtual void AddForceAtWorldPosition (const math::Vector3 &_force, const math::Vector3 &_pos)
 Add a force to the body using a global position. More...
 
virtual void AddLinkForce (const math::Vector3 &_force, const math::Vector3 &_offset=math::Vector3::Zero)
 Add a force expressed in the link frame. More...
 
virtual void AddRelativeForce (const math::Vector3 &_force)
 Add a force to the body, components are relative to the body's own frame of reference. More...
 
virtual void AddRelativeTorque (const math::Vector3 &_torque)
 Add a torque to the body, components are relative to the body's own frame of reference. More...
 
virtual void AddTorque (const math::Vector3 &_torque)
 Add a torque to the body. More...
 
virtual void Fini ()
 Finalize the body. More...
 
virtual bool GetEnabled () const
 Get whether this body is enabled in the physics engine. More...
 
virtual bool GetGravityMode () const
 Get the gravity mode. More...
 
virtual bool GetKinematic () const
 Implement this function. More...
 
dBodyID GetODEId () const
 Return the ID of this link. More...
 
dSpaceID GetSpaceId () const
 Get the ID of the collision space this link is in. More...
 
virtual math::Vector3 GetWorldAngularVel () const
 Get the angular velocity of the entity in the world frame. More...
 
virtual math::Vector3 GetWorldCoGLinearVel () const
 Get the linear velocity at the body's center of gravity in the world frame. More...
 
virtual math::Vector3 GetWorldForce () const
 Get the force applied to the body in the world frame. More...
 
virtual math::Vector3 GetWorldLinearVel (const math::Vector3 &_offset) const
 Get the linear velocity of a point on the body in the world frame, using an offset expressed in a body-fixed frame. More...
 
virtual math::Vector3 GetWorldLinearVel (const math::Vector3 &_offset, const math::Quaternion &_q) const
 Get the linear velocity of a point on the body in the world frame, using an offset expressed in an arbitrary frame. More...
 
virtual math::Vector3 GetWorldTorque () const
 Get the torque applied to the body in the world frame. More...
 
virtual void Init ()
 Initialize the body. More...
 
virtual void Load (sdf::ElementPtr _sdf)
 Load the body based on an SDF element. More...
 
virtual void OnPoseChange ()
 This function is called when the entity's (or one of its parents) pose of the parent has changed. More...
 
virtual void SetAngularDamping (double _damping)
 Set the angular damping factor. More...
 
virtual void SetAngularVel (const math::Vector3 &_vel)
 Set the angular velocity of the body. More...
 
virtual void SetAutoDisable (bool _disable)
 Allow the link to auto disable. More...
 
virtual void SetEnabled (bool _enable) const
 Set whether this body is enabled. More...
 
virtual void SetForce (const math::Vector3 &_force)
 Set the force applied to the body. More...
 
virtual void SetGravityMode (bool _mode)
 Set whether gravity affects this body. More...
 
virtual void SetKinematic (const bool &_state)
 Implement this function. More...
 
virtual void SetLinearDamping (double _damping)
 Set the linear damping factor. More...
 
virtual void SetLinearVel (const math::Vector3 &_vel)
 Set the linear velocity of the body. More...
 
virtual void SetLinkStatic (bool _static)
 Freeze link to ground (inertial frame). More...
 
void SetSelfCollide (bool _collide)
 Set whether this body will collide with others in the model. More...
 
void SetSpaceId (dSpaceID _spaceid)
 Set the ID of the collision space this link is in. More...
 
virtual void SetTorque (const math::Vector3 &_torque)
 Set the torque applied to the body. More...
 
void UpdateCollisionOffsets ()
 Update location of collisions relative to center of mass. More...
 
virtual void UpdateMass ()
 Update the mass matrix. More...
 
virtual void UpdateSurface ()
 Update surface parameters. More...
 
- Public Member Functions inherited from gazebo::physics::Entity
 Entity (BasePtr _parent)
 Constructor. More...
 
virtual ~Entity ()
 Destructor. More...
 
CollisionPtr GetChildCollision (const std::string &_name)
 Get a child collision entity, if one exists. More...
 
LinkPtr GetChildLink (const std::string &_name)
 Get a child linke entity, if one exists. More...
 
math::Box GetCollisionBoundingBox () const
 Returns collision bounding box. More...
 
const math::PoseGetDirtyPose () const
 Returns Entity::dirtyPose. More...
 
math::Pose GetInitialRelativePose () const
 Get the initial relative pose. More...
 
void GetNearestEntityBelow (double &_distBelow, std::string &_entityName)
 Get the distance to the nearest entity below (along the Z-axis) this entity. More...
 
ModelPtr GetParentModel ()
 Get the parent model, if one exists. More...
 
math::Pose GetRelativePose () const
 Get the pose of the entity relative to its parent. More...
 
virtual const math::PoseGetWorldPose () const
 Get the absolute pose of the entity. More...
 
bool IsCanonicalLink () const
 A helper function that checks if this is a canonical body. More...
 
bool IsStatic () const
 Return whether this entity is static. More...
 
void PlaceOnEntity (const std::string &_entityName)
 Move this entity to be ontop of another entity by name. More...
 
void PlaceOnNearestEntityBelow ()
 Move this entity to be ontop of the nearest entity below. More...
 
void SetAnimation (const common::PoseAnimationPtr &_anim, boost::function< void()> _onComplete)
 Set an animation for this entity. More...
 
void SetAnimation (common::PoseAnimationPtr _anim)
 Set an animation for this entity. More...
 
void SetCanonicalLink (bool _value)
 Set to true if this entity is a canonical link for a model. More...
 
void SetInitialRelativePose (const math::Pose &_pose)
 Set the initial pose. More...
 
virtual void SetName (const std::string &_name)
 Set the name of the entity. More...
 
void SetRelativePose (const math::Pose &_pose, bool _notify=true, bool _publish=true)
 Set the pose of the entity relative to its parent. More...
 
void SetStatic (const bool &_static)
 Set whether this entity is static: immovable. More...
 
void SetWorldPose (const math::Pose &_pose, bool _notify=true, bool _publish=true)
 Set the world pose of the entity. More...
 
void SetWorldTwist (const math::Vector3 &_linear, const math::Vector3 &_angular, bool _updateChildren=true)
 Set angular and linear rates of an physics::Entity. More...
 
virtual void StopAnimation ()
 Stop the current animation, if any. More...
 
- Public Member Functions inherited from gazebo::physics::Base
 Base (BasePtr _parent)
 Constructor. More...
 
virtual ~Base ()
 Destructor. More...
 
void AddChild (BasePtr _child)
 Add a child to this entity. More...
 
void AddType (EntityType _type)
 Add a type specifier. More...
 
BasePtr GetByName (const std::string &_name)
 Get by name. More...
 
BasePtr GetChild (unsigned int _i) const
 Get a child by index. More...
 
BasePtr GetChild (const std::string &_name)
 Get a child by name. More...
 
unsigned int GetChildCount () const
 Get the number of children. More...
 
uint32_t GetId () const
 Return the ID of this entity. More...
 
std::string GetName () const
 Return the name of the entity. More...
 
BasePtr GetParent () const
 Get the parent. More...
 
int GetParentId () const
 Return the ID of the parent. More...
 
bool GetSaveable () const
 Get whether the object should be "saved", when the user selects to save the world to xml. More...
 
std::string GetScopedName (bool _prependWorldName=false) const
 Return the name of this entity with the model scope model1::...::modelN::entityName. More...
 
virtual const sdf::ElementPtr GetSDF ()
 Get the SDF values for the object. More...
 
unsigned int GetType () const
 Get the full type definition. More...
 
const WorldPtrGetWorld () const
 Get the World this object is in. More...
 
bool HasType (const EntityType &_t) const
 Returns true if this object's type definition has the given type. More...
 
bool IsSelected () const
 True if the entity is selected by the user. More...
 
bool operator== (const Base &_ent) const
 Returns true if the entities are the same. More...
 
void Print (const std::string &_prefix)
 Print this object to screen via gzmsg. More...
 
virtual void RemoveChild (unsigned int _id)
 Remove a child from this entity. More...
 
void RemoveChild (const std::string &_name)
 Remove a child by name. More...
 
void RemoveChildren ()
 Remove all children. More...
 
virtual void Reset (Base::EntityType _resetType)
 Calls recursive Reset on one of the Base::EntityType's. More...
 
void SetParent (BasePtr _parent)
 Set the parent. More...
 
void SetSaveable (bool _v)
 Set whether the object should be "saved", when the user selects to save the world to xml. More...
 
void SetWorld (const WorldPtr &_newWorld)
 Set the world this object belongs to. More...
 
virtual void Update ()
 Update the object. More...
 

Static Public Member Functions

static void DisabledCallback (dBodyID _id)
 Callback when ODE determines a body is disabled. More...
 
static void MoveCallback (dBodyID _id)
 when ODE updates dynamics bodies, this callback propagates the chagnes in pose back to Gazebo More...
 

Additional Inherited Members

- Public Types inherited from gazebo::physics::Base
enum  EntityType {
  BASE = 0x00000000, ENTITY = 0x00000001, MODEL = 0x00000002, LINK = 0x00000004,
  COLLISION = 0x00000008, ACTOR = 0x00000016, LIGHT = 0x00000010, VISUAL = 0x00000020,
  JOINT = 0x00000040, BALL_JOINT = 0x00000080, HINGE2_JOINT = 0x00000100, HINGE_JOINT = 0x00000200,
  SLIDER_JOINT = 0x00000400, SCREW_JOINT = 0x00000800, UNIVERSAL_JOINT = 0x00001000, GEARBOX_JOINT = 0x00002000,
  FIXED_JOINT = 0x00004000, SHAPE = 0x00010000, BOX_SHAPE = 0x00020000, CYLINDER_SHAPE = 0x00040000,
  HEIGHTMAP_SHAPE = 0x00080000, MAP_SHAPE = 0x00100000, MULTIRAY_SHAPE = 0x00200000, RAY_SHAPE = 0x00400000,
  PLANE_SHAPE = 0x00800000, SPHERE_SHAPE = 0x01000000, MESH_SHAPE = 0x02000000, POLYLINE_SHAPE = 0x04000000,
  SENSOR_COLLISION = 0x10000000
}
 Unique identifiers for all entity types. More...
 
- Protected Member Functions inherited from gazebo::physics::Base
void ComputeScopedName ()
 Compute the scoped name of this object based on its parents. More...
 
- Protected Attributes inherited from gazebo::physics::Entity
common::PoseAnimationPtr animation
 Current pose animation. More...
 
event::ConnectionPtr animationConnection
 Connection used to update an animation. More...
 
math::Pose animationStartPose
 Start pose of an animation. More...
 
std::vector< event::ConnectionPtrconnections
 All our event connections. More...
 
math::Pose dirtyPose
 The pose set by a physics engine. More...
 
transport::NodePtr node
 Communication node. More...
 
EntityPtr parentEntity
 A helper that prevents numerous dynamic_casts. More...
 
common::Time prevAnimationTime
 Previous time an animation was updated. More...
 
transport::PublisherPtr requestPub
 Request publisher. More...
 
ignition::math::Vector3d scale
 Scale of the entity. More...
 
transport::PublisherPtr visPub
 Visual publisher. More...
 
msgs::Visual * visualMsg
 Visual message container. More...
 
math::Pose worldPose
 World pose of the entity. More...
 
- Protected Attributes inherited from gazebo::physics::Base
Base_V children
 Children of this entity. More...
 
BasePtr parent
 Parent of this entity. More...
 
sdf::ElementPtr sdf
 The SDF values for this object. More...
 
WorldPtr world
 Pointer to the world. More...
 

Detailed Description

ODE Link class.

Constructor & Destructor Documentation

gazebo::physics::ODELink::ODELink ( EntityPtr  _parent)
explicit

Constructor.

Parameters
[in]_parentParent model.
virtual gazebo::physics::ODELink::~ODELink ( )
virtual

Destructor.

Member Function Documentation

virtual void gazebo::physics::ODELink::AddForce ( const math::Vector3 _force)
virtual

Add a force to the body.

Parameters
[in]_forceForce to add.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::AddForceAtRelativePosition ( const math::Vector3 _force,
const math::Vector3 _relPos 
)
virtual

Add a force to the body at position expressed to the body's own frame of reference.

Parameters
[in]_forceForce to add.
[in]_relPosPosition on the link to add the force.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::AddForceAtWorldPosition ( const math::Vector3 _force,
const math::Vector3 _pos 
)
virtual

Add a force to the body using a global position.

Parameters
[in]_forceForce to add.
[in]_posPosition in global coord frame to add the force.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::AddLinkForce ( const math::Vector3 _force,
const math::Vector3 _offset = math::Vector3::Zero 
)
virtual

Add a force expressed in the link frame.

Parameters
[in]_forceDirection 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]_offsetOffset position expressed in the link frame. It defaults to the link origin.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::AddRelativeForce ( const math::Vector3 _force)
virtual

Add a force to the body, components are relative to the body's own frame of reference.

Parameters
[in]_forceForce to add.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::AddRelativeTorque ( const math::Vector3 _torque)
virtual

Add a torque to the body, components are relative to the body's own frame of reference.

Parameters
[in]_torqueTorque value to add.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::AddTorque ( const math::Vector3 _torque)
virtual

Add a torque to the body.

Parameters
[in]_torqueTorque value to add to the link.

Implements gazebo::physics::Link.

static void gazebo::physics::ODELink::DisabledCallback ( dBodyID  _id)
static

Callback when ODE determines a body is disabled.

Parameters
[in]_idId of the body.
virtual void gazebo::physics::ODELink::Fini ( )
virtual

Finalize the body.

Reimplemented from gazebo::physics::Link.

virtual bool gazebo::physics::ODELink::GetEnabled ( ) const
virtual

Get whether this body is enabled in the physics engine.

Returns
True if the link is enabled.

Implements gazebo::physics::Link.

virtual bool gazebo::physics::ODELink::GetGravityMode ( ) const
virtual

Get the gravity mode.

Returns
True if gravity is enabled.

Implements gazebo::physics::Link.

virtual bool gazebo::physics::ODELink::GetKinematic ( ) const
virtual

Implement this function.

Get whether this body is in the kinematic state.

Returns
True if the link is kinematic only.

Reimplemented from gazebo::physics::Link.

dBodyID gazebo::physics::ODELink::GetODEId ( ) const

Return the ID of this link.

Returns
ODE link id
dSpaceID gazebo::physics::ODELink::GetSpaceId ( ) const

Get the ID of the collision space this link is in.

Returns
The collision space ID for the link.
virtual math::Vector3 gazebo::physics::ODELink::GetWorldAngularVel ( ) const
virtual

Get the angular velocity of the entity in the world frame.

Returns
A math::Vector3 for the velocity.

Reimplemented from gazebo::physics::Entity.

virtual math::Vector3 gazebo::physics::ODELink::GetWorldCoGLinearVel ( ) const
virtual

Get the linear velocity at the body's center of gravity in the world frame.

Returns
Linear velocity at the body's center of gravity in the world frame.

Implements gazebo::physics::Link.

virtual math::Vector3 gazebo::physics::ODELink::GetWorldForce ( ) const
virtual

Get the force applied to the body in the world frame.

Returns
Force applied to the body in the world frame.

Implements gazebo::physics::Link.

virtual math::Vector3 gazebo::physics::ODELink::GetWorldLinearVel ( const math::Vector3 _offset) const
virtual

Get the linear velocity of a point on the body in the world frame, using an offset expressed in a body-fixed frame.

If no offset is given, the velocity at the origin of the Link frame will be returned.

Parameters
[in]_offsetOffset of the point from the origin of the Link frame, expressed in the body-fixed frame.
Returns
Linear velocity of the point on the body

Implements gazebo::physics::Link.

virtual math::Vector3 gazebo::physics::ODELink::GetWorldLinearVel ( const math::Vector3 _offset,
const math::Quaternion _q 
) const
virtual

Get the linear velocity of a point on the body in the world frame, using an offset expressed in an arbitrary frame.

Parameters
[in]_offsetOffset from the origin of the link frame expressed in a frame defined by _q.
[in]_qDescribes the rotation of a reference frame relative to the world reference frame.
Returns
Linear velocity of the point on the body in the world frame.

Implements gazebo::physics::Link.

virtual math::Vector3 gazebo::physics::ODELink::GetWorldTorque ( ) const
virtual

Get the torque applied to the body in the world frame.

Returns
Torque applied to the body in the world frame.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::Init ( )
virtual

Initialize the body.

Reimplemented from gazebo::physics::Link.

virtual void gazebo::physics::ODELink::Load ( sdf::ElementPtr  _sdf)
virtual

Load the body based on an SDF element.

Parameters
[in]_sdfSDF parameters.

Reimplemented from gazebo::physics::Link.

static void gazebo::physics::ODELink::MoveCallback ( dBodyID  _id)
static

when ODE updates dynamics bodies, this callback propagates the chagnes in pose back to Gazebo

Parameters
[in]_idId of the body.
virtual void gazebo::physics::ODELink::OnPoseChange ( )
virtual

This function is called when the entity's (or one of its parents) pose of the parent has changed.

Reimplemented from gazebo::physics::Link.

virtual void gazebo::physics::ODELink::SetAngularDamping ( double  _damping)
virtual

Set the angular damping factor.

Parameters
[in]_dampingAngular damping factor.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::SetAngularVel ( const math::Vector3 _vel)
virtual

Set the angular velocity of the body.

Parameters
[in]_velAngular velocity.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::SetAutoDisable ( bool  _disable)
virtual

Allow the link to auto disable.

Parameters
[in]_disableIf true, the link is allowed to auto disable.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::SetEnabled ( bool  _enable) const
virtual

Set whether this body is enabled.

Parameters
[in]_enableTrue to enable the link in the physics engine.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::SetForce ( const math::Vector3 _force)
virtual

Set the force applied to the body.

Parameters
[in]_forceForce value.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::SetGravityMode ( bool  _mode)
virtual

Set whether gravity affects this body.

Parameters
[in]_modeTrue to enable gravity.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::SetKinematic ( const bool &  _kinematic)
virtual

Implement this function.

Set whether this body is in the kinematic state.

Parameters
[in]_kinematicTrue to make the link kinematic only.

Reimplemented from gazebo::physics::Link.

virtual void gazebo::physics::ODELink::SetLinearDamping ( double  _damping)
virtual

Set the linear damping factor.

Parameters
[in]_dampingLinear damping factor.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::SetLinearVel ( const math::Vector3 _vel)
virtual

Set the linear velocity of the body.

Parameters
[in]_velLinear velocity.

Implements gazebo::physics::Link.

virtual void gazebo::physics::ODELink::SetLinkStatic ( bool  _static)
virtual

Freeze link to ground (inertial frame).

Parameters
[in]_staticif true, freeze link to ground. Otherwise unfreeze link.

Implements gazebo::physics::Link.

void gazebo::physics::ODELink::SetSelfCollide ( bool  _collide)
virtual

Set whether this body will collide with others in the model.

See Also
GetSelfCollide
Parameters
[in]_collideTrue to enable collisions.

Implements gazebo::physics::Link.

void gazebo::physics::ODELink::SetSpaceId ( dSpaceID  _spaceid)

Set the ID of the collision space this link is in.

Parameters
[in]_spaceIdThe collision space ID for the link.
virtual void gazebo::physics::ODELink::SetTorque ( const math::Vector3 _torque)
virtual

Set the torque applied to the body.

Parameters
[in]_torqueTorque value.

Implements gazebo::physics::Link.

void gazebo::physics::ODELink::UpdateCollisionOffsets ( )

Update location of collisions relative to center of mass.

This used to be done only in the Init function, but was moved to a separate function to handle dynamic updates to the center of mass.

virtual void gazebo::physics::ODELink::UpdateMass ( )
virtual

Update the mass matrix.

Reimplemented from gazebo::physics::Link.

virtual void gazebo::physics::ODELink::UpdateSurface ( )
virtual

Update surface parameters.

Reimplemented from gazebo::physics::Link.


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