##

LinkState Class Reference
Physics

Store state information of a physics::Link object. More...

`#include <physics/physics.hh>`

Inherits State.

## Public Member Functions

| LinkState ()
| Default constructor. More...
| LinkState (const LinkPtr _link)
| Constructor. More...
| LinkState (const LinkPtr _link, const common::Time &_realTime, const common::Time &_simTime, const uint64_t _iterations)
| Constructor. More...
| LinkState (const sdf::ElementPtr _sdf)
| Constructor. More...
virtual | ~LinkState ()
| Destructor. More...
const ignition::math::Pose3d & | Acceleration () const
| Get the link acceleration. More...
void | FillSDF (sdf::ElementPtr _sdf)
| Populate a state SDF element with data from the object. More...
CollisionState | GetCollisionState (const std::string &_collisionName) const
| Get a link state by link name. More...
CollisionState | GetCollisionState (unsigned int _index) const
| Get a collision state. More...
unsigned int | GetCollisionStateCount () const
| Get the number of link states. More...
const std::vector< CollisionState > & | GetCollisionStates () const
| Get the collision states. 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 (const LinkPtr _link, const common::Time &_realTime, const common::Time &_simTime, const uint64_t _iterations)
| Load a LinkState from a Link pointer. More...
virtual void | Load (const sdf::ElementPtr _elem)
| Load state from SDF element. More...
LinkState | operator+ (const LinkState &_state) const
| Addition operator. More...
LinkState | operator- (const LinkState &_state) const
| Subtraction operator. More...
State | operator- (const State &_state) const
| Subtraction operator. More...
LinkState & | operator= (const LinkState &_state)
| Assignment operator. More...
const ignition::math::Pose3d & | Pose () const
| Get the link pose. More...
bool | RecordVelocity () const
| Get whether link velocity is recorded. More...
virtual void | SetIterations (const uint64_t _iterations)
| Set the simulation 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...
void | SetRecordVelocity (const bool _record)
| Set whether to record link velocity. 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...
const ignition::math::Pose3d & | Velocity () const
| Get the link velocity. More...
const ignition::math::Pose3d & | Wrench () const
| Get the force and torque applied to the Link. 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::LinkState &_state)
| Stream insertion operator. More...

## Detailed Description

Store state information of a physics::Link object.

This class captures the entire state of a Link at one specific time during a simulation run.

State of a Link includes the state of itself all its child Collision entities.

## Constructor & Destructor Documentation

## LinkState() [1/4]

LinkState | ( |  | ) |

Default constructor.

## LinkState() [2/4]

LinkState | ( | const LinkPtr | _link,
|  | const common::Time & | _realTime,
|  | const common::Time & | _simTime,
|  | const uint64_t | _iterations
| ) |  |

Constructor.

Build a LinkState from an existing Link.

Parameters

  [in] | _model | Pointer to the Link from which to gather state info.
  [in] | _realTime | Real time stamp.
  [in] | _simTime | Sim time stamp
  [in] | _iterations | Simulation iterations.

## LinkState() [3/4]

LinkState | ( | const LinkPtr | _link | ) |

explicit

Constructor.

Build a LinkState from an existing Link.

Parameters

  [in] | _model | Pointer to the Link from which to gather state info.

## LinkState() [4/4]

LinkState | ( | const sdf::ElementPtr | _sdf | ) |

explicit

Constructor.

Build a LinkState from SDF data

Parameters

  [in] | _sdf | SDF data to load a link state from.

## ~LinkState()

virtual ~LinkState | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## Acceleration()

const ignition::math::Pose3d& Acceleration | ( |  | ) | const

Get the link acceleration.

Returns
  The acceleration represented as a ignition::math::Pose3d.

## FillSDF()

void FillSDF | ( | sdf::ElementPtr | _sdf | ) |

Populate a state SDF element with data from the object.

Parameters

  [out] | _sdf | SDF element to populate.

## GetCollisionState() [1/2]

CollisionState GetCollisionState | ( | const std::string & | _collisionName | ) | const

Get a link state by link name.

Searches through all CollisionStates. Returns the CollisionState with the matching name, if any.

Parameters

  [in] | _collisionName | Name of the CollisionState

Returns
  State of the Collision.

Exceptions

  common::Exception | When _collisionName is invalid

## GetCollisionState() [2/2]

CollisionState GetCollisionState | ( | unsigned int | _index | ) | const

Get a collision state.

Get a Collision State based on an index, where index is in the range of 0...LinkState::GetCollisionStateCount.

Parameters

  [in] | _index | Index of the CollisionState.

Returns
  State of the Collision.

Exceptions

  common::Exception | When _index is invalid.

## GetCollisionStateCount()

unsigned int GetCollisionStateCount | ( |  | ) | const

Get the number of link states.

This returns the number of Collisions recorded.

Returns
  Number of CollisionState recorded.

## GetCollisionStates()

const std::vector<CollisionState>& GetCollisionStates | ( |  | ) | const

Get the collision states.

Returns
  A vector of collision states.

## GetIterations()

uint64_t GetIterations | ( |  | ) | const

inherited

Get the iterations when this state was generated.

Returns
  Iterations when the data was recorded

## GetName()

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.

## GetRealTime()

common::Time GetRealTime | ( |  | ) | const

inherited

Get the real time when this state was generated.

Returns
  Clock time since simulation was stated.

## GetSimTime()

common::Time GetSimTime | ( |  | ) | const

inherited

Get the sim time when this state was generated.

Returns
  Simulation time when the data was recorded.

## GetWallTime()

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.

## IsZero()

bool IsZero | ( |  | ) | const

Return true if the values in the state are zero.

Returns
  True if the values in the state are zero.

## Load() [1/2]

void Load | ( | const LinkPtr | _link,
|  | const common::Time & | _realTime,
|  | const common::Time & | _simTime,
|  | const uint64_t | _iterations
| ) |  |

Load a LinkState from a Link pointer.

Build a LinkState from an existing Link.

Parameters

  [in] | _model | Pointer to the Link from which to gather state info.
  [in] | _realTime | Real time stamp.
  [in] | _simTime | Sim time stamp.
  [in] | _iterations | Simulation iterations.

## Load() [2/2]

virtual void Load | ( | const sdf::ElementPtr | _elem | ) |

virtual

Load state from SDF element.

Load LinkState information from stored data in and SDF::Element.

Parameters

  [in] | _elem | Pointer to the SDF::Element containing state info.

Reimplemented from State.

## operator+()

LinkState operator+ | ( | const LinkState & | _state | ) | const

Addition operator.

Parameters

  [in] | _pt | A state to add.

Returns
  The resulting state.

## operator-() [1/2]

LinkState operator- | ( | const LinkState & | _state | ) | const

Subtraction operator.

Parameters

  [in] | _pt | A state to substract.

Returns
  The resulting state.

## operator-() [2/2]

State operator- | ( | const State & | _state | ) | const

inherited

Subtraction operator.

Parameters

  [in] | _pt | A state to substract.

Returns
  The resulting state.

## operator=()

LinkState& operator= | ( | const LinkState & | _state | ) |

Assignment operator.

Parameters

  [in] | _state | State value

Returns
  this

## Pose()

const ignition::math::Pose3d& Pose | ( |  | ) | const

Get the link pose.

Returns
  The ignition::math::Pose3d of the Link.

## RecordVelocity()

bool RecordVelocity | ( |  | ) | const

Get whether link velocity is recorded.

Returns
  True if link velocity is recorded

## SetIterations()

virtual void SetIterations | ( | const uint64_t | _iterations | ) |

virtual

Set the simulation iterations when this state was generated.

Parameters

  [in] | _iterations | Simulation iterations when the data was recorded.

Reimplemented from State.

## SetName()

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

inherited

Set the name associated with this State.

Parameters

  [in] | _name | Name associated with this state information. Typically the name of an Entity.

## SetRealTime()

virtual void SetRealTime | ( | const common::Time & | _time | ) |

virtual

Set the real time when this state was generated.

Parameters

  [in] | _time | Clock time since simulation was stated.

Reimplemented from State.

## SetRecordVelocity()

void SetRecordVelocity | ( | const bool | _record | ) |

Set whether to record link velocity.

Parameters

  [in] | _record | True to record link velocity, false to leave it out of the log

## SetSimTime()

virtual void SetSimTime | ( | const common::Time & | _time | ) |

virtual

Set the sim time when this state was generated.

Parameters

  [in] | _time | Simulation time when the data was recorded.

Reimplemented from State.

## SetWallTime()

virtual void SetWallTime | ( | const common::Time & | _time | ) |

virtual

Set the wall time when this state was generated.

Parameters

  [in] | _time | The absolute clock time when the State data was recorded.

Reimplemented from State.

## Velocity()

const ignition::math::Pose3d& Velocity | ( |  | ) | const

Get the link velocity.

Returns
  The velocity represented as a ignition::math::Pose3d.

## Wrench()

const ignition::math::Pose3d& Wrench | ( |  | ) | const

Get the force and torque applied to the Link.

Returns
  The wrench represented as an ignition::math::Pose3d.

## Friends And Related Function Documentation

## operator<<

std::ostream& operator<< | ( | std::ostream & | _out,
|  | const gazebo::physics::LinkState & | _state
| ) |  |

friend

Stream insertion operator.

Parameters

  [in] | _out | output stream
  [in] | _state | Link state to output

Returns
  the stream

Disabling this for efficiency.

Disabling this for efficiency.

## Member Data Documentation

## iterations

uint64_t iterations = 0

protected inherited

The number of simulation iterations when this state was generated.

## name

std::string name

protected inherited

Name associated with this State.

## realTime

common::Time realTime

protected inherited

## simTime

common::Time simTime

protected inherited

## wallTime

common::Time wallTime

protected inherited

Times for the state data.

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

- LinkState.hh