JointState Class Reference

keeps track of state of a physics::Joint More...

#include <physics/physics.hh>

Inherits State.

Public Member Functions

 JointState ()
 Default constructor. More...
 
 JointState (JointPtr _joint, const common::Time &_realTime, const common::Time &_simTime, const uint64_t _iterations)
 Constructor. More...
 
 JointState (JointPtr _joint)
 Constructor. More...
 
 JointState (const sdf::ElementPtr _sdf)
 Constructor. More...
 
virtual ~JointState ()
 Destructor. More...
 
void FillSDF (sdf::ElementPtr _sdf)
 Populate a state SDF element with data from the object. More...
 
math::Angle GetAngle (unsigned int _axis) const GAZEBO_DEPRECATED(8.0)
 Get the joint angle. More...
 
unsigned int GetAngleCount () const
 Get the number of angles. More...
 
const std::vector< math::AngleGetAngles () const GAZEBO_DEPRECATED(8.0)
 Get the angles. More...
 
uint64_t GetIterations () const
 Get the iterations when this state was generated. More...
 
std::string GetName () const
 Get the name associated with this State. More...
 
common::Time GetRealTime () const
 Get the real time when this state was generated. More...
 
common::Time GetSimTime () const
 Get the sim time when this state was generated. More...
 
common::Time GetWallTime () const
 Get the wall time when this state was generated. More...
 
bool IsZero () const
 Return true if the values in the state are zero. More...
 
void Load (JointPtr _joint, const common::Time &_realTime, const common::Time &_simTime)
 Load. More...
 
virtual void Load (const sdf::ElementPtr _elem)
 Load state from SDF element. More...
 
JointState operator+ (const JointState &_state) const
 Addition operator. More...
 
State operator- (const State &_state) const
 Subtraction operator. More...
 
JointState operator- (const JointState &_state) const
 Subtraction operator. More...
 
JointStateoperator= (const JointState &_state)
 Assignment operator. More...
 
double Position (const unsigned int _axis=0) const
 Get the joint position. More...
 
const std::vector< double > & Positions () const
 Get the joint positions. More...
 
virtual void SetIterations (const uint64_t _iterations)
 Set the iterations when this state was generated. More...
 
void SetName (const std::string &_name)
 Set the name associated with this State. More...
 
virtual void SetRealTime (const common::Time &_time)
 Set the real time when this state was generated. More...
 
virtual void SetSimTime (const common::Time &_time)
 Set the sim time when this state was generated. More...
 
virtual void SetWallTime (const common::Time &_time)
 Set the wall time when this state was generated. More...
 

Protected Attributes

uint64_t iterations = 0
 The number of simulation iterations when this state was generated. More...
 
std::string name
 Name associated with this State. More...
 
common::Time realTime
 
common::Time simTime
 
common::Time wallTime
 Times for the state data. More...
 

Friends

std::ostream & operator<< (std::ostream &_out, const gazebo::physics::JointState &_state)
 Stream insertion operator. More...
 

Detailed Description

keeps track of state of a physics::Joint

Constructor & Destructor Documentation

Default constructor.

JointState ( JointPtr  _joint,
const common::Time _realTime,
const common::Time _simTime,
const uint64_t  _iterations 
)

Constructor.

Parameters
[in]_jointJoint to get the state of.
[in]_realTimeReal time stamp.
[in]_simTimeSim time stamp.
[in]_iterationsSimulation iterations.
JointState ( JointPtr  _joint)
explicit

Constructor.

Parameters
[in]_jointJoint to get the state of.
JointState ( const sdf::ElementPtr  _sdf)
explicit

Constructor.

Build a JointState from SDF data

Parameters
[in]_sdfSDF data to load a joint state from.
virtual ~JointState ( )
virtual

Destructor.

Member Function Documentation

void FillSDF ( sdf::ElementPtr  _sdf)

Populate a state SDF element with data from the object.

Parameters
[out]_sdfSDF element to populate.
math::Angle GetAngle ( unsigned int  _axis) const

Get the joint angle.

Parameters
[in]_axisThe axis index.
Returns
Angle of the axis.
Exceptions
common::ExceptionWhen _axis is invalid.
Deprecated:
See Position()
unsigned int GetAngleCount ( ) const

Get the number of angles.

Returns
The number of angles.
const std::vector<math::Angle> GetAngles ( ) const

Get the angles.

Returns
Vector of angles.
Deprecated:
See Positions()
uint64_t GetIterations ( ) const
inherited

Get the iterations when this state was generated.

Returns
Iterations when the data was recorded
std::string GetName ( ) const
inherited

Get the name associated with this State.

Returns
Name associated with this state information. Typically a name of an Entity.
common::Time GetRealTime ( ) const
inherited

Get the real time when this state was generated.

Returns
Clock time since simulation was stated.
common::Time GetSimTime ( ) const
inherited

Get the sim time when this state was generated.

Returns
Simulation time when the data was recorded.
common::Time GetWallTime ( ) const
inherited

Get the wall time when this state was generated.

Returns
The absolute clock time when the State data was recorded.
bool IsZero ( ) const

Return true if the values in the state are zero.

Returns
True if the values in the state are zero.
void Load ( JointPtr  _joint,
const common::Time _realTime,
const common::Time _simTime 
)

Load.

Parameters
[in]_jointJoint to get the state of.
[in]_realTimeReal time stamp.
[in]_simTimeSim time stamp.
virtual void Load ( const sdf::ElementPtr  _elem)
virtual

Load state from SDF element.

Parameters
[in]_elemSDf values to load from.

Reimplemented from State.

JointState operator+ ( const JointState _state) const

Addition operator.

Parameters
[in]_ptA state to add.
Returns
The resulting state.
State operator- ( const State _state) const
inherited

Subtraction operator.

Parameters
[in]_ptA state to substract.
Returns
The resulting state.
JointState operator- ( const JointState _state) const

Subtraction operator.

Parameters
[in]_ptA state to substract.
Returns
The resulting state.
JointState& operator= ( const JointState _state)

Assignment operator.

Parameters
[in]_stateState value
Returns
this
double Position ( const unsigned int  _axis = 0) const

Get the joint position.

For rotational axes, the value is in radians. For prismatic axes, it is in meters.

It returns ignition::math::NAN_D in case the position can't be obtained. For instance, if the index is invalid.

Parameters
[in]_indexIndex of the axis, defaults to 0.
Returns
Position of the axis.
Exceptions
common::ExceptionWhen _axis is invalid.
const std::vector<double>& Positions ( ) const

Get the joint positions.

For rotational axes, the value is in radians. For prismatic axes, it is in meters.

Returns
Vector of joint positions.
virtual void SetIterations ( const uint64_t  _iterations)
virtualinherited

Set the iterations when this state was generated.

Parameters
[in]_iterationsIterations when the data was recorded.

Reimplemented in ModelState, WorldState, and LinkState.

void SetName ( const std::string &  _name)
inherited

Set the name associated with this State.

Parameters
[in]_nameName associated with this state information. Typically the name of an Entity.
virtual void SetRealTime ( const common::Time _time)
virtualinherited

Set the real time when this state was generated.

Parameters
[in]_timeClock time since simulation was stated.

Reimplemented in ModelState, WorldState, and LinkState.

virtual void SetSimTime ( const common::Time _time)
virtualinherited

Set the sim time when this state was generated.

Parameters
[in]_timeSimulation time when the data was recorded.

Reimplemented in ModelState, WorldState, and LinkState.

virtual void SetWallTime ( const common::Time _time)
virtualinherited

Set the wall time when this state was generated.

Parameters
[in]_timeThe absolute clock time when the State data was recorded.

Reimplemented in ModelState, WorldState, and LinkState.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  _out,
const gazebo::physics::JointState _state 
)
friend

Stream insertion operator.

Parameters
[in]_outoutput stream.
[in]_stateJoint state to output.
Returns
The stream.

Member Data Documentation

uint64_t iterations = 0
protectedinherited

The number of simulation iterations when this state was generated.

std::string name
protectedinherited

Name associated with this State.

common::Time realTime
protectedinherited
common::Time simTime
protectedinherited
common::Time wallTime
protectedinherited

Times for the state data.


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