Public Member Functions | Friends | List of all members
gazebo::physics::WorldState Class Reference

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

#include <physics/physics.hh>

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

Public Member Functions

 WorldState ()
 Default constructor. More...
 
 WorldState (const WorldPtr _world)
 Constructor. More...
 
 WorldState (const sdf::ElementPtr _sdf)
 Constructor. More...
 
virtual ~WorldState ()
 Destructor. More...
 
const std::vector< std::string > & Deletions () const
 Get the vector of SDF deletions. More...
 
void FillSDF (sdf::ElementPtr _sdf)
 Populate a state SDF element with data from the object. More...
 
LightState GetLightState (const std::string &_lightName) const
 Get a light state by light name. More...
 
ModelState GetModelState (const std::string &_modelName) const
 Get a model state by model name. More...
 
unsigned int GetModelStateCount () const
 Get the number of model states. More...
 
ModelState_M GetModelStates (const boost::regex &_regex) const
 Get model states based on a regular expression. More...
 
const ModelState_MGetModelStates () const
 Get the model states. More...
 
bool HasLightState (const std::string &_lightName) const
 Return true if WorldState has a LightState with the given name. More...
 
bool HasModelState (const std::string &_modelName) const
 Return true if WorldState has a ModelState with the given name. More...
 
const std::vector< std::string > & Insertions () const
 Get the vector of SDF insertions. More...
 
bool IsZero () const
 Return true if the values in the state are zero. More...
 
unsigned int LightStateCount () const
 Get the number of light states. More...
 
const LightState_MLightStates () const
 Get the light states. More...
 
void Load (const WorldPtr _world)
 Load from a World pointer. More...
 
virtual void Load (const sdf::ElementPtr _elem)
 Load state from SDF element. More...
 
WorldState operator+ (const WorldState &_state) const
 Addition operator. More...
 
WorldState operator- (const WorldState &_state) const
 Subtraction operator. More...
 
WorldStateoperator= (const WorldState &_state)
 Assignment operator. More...
 
void SetDeletions (const std::vector< std::string > &_deletions)
 Set a new vector of SDF deletions. More...
 
void SetInsertions (const std::vector< std::string > &_insertions)
 Set a new vector of SDF insertions. More...
 
virtual void SetIterations (const uint64_t _iterations)
 Set the simulation interations when this state was generated. 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...
 
void SetWorld (const WorldPtr _world)
 Set the world. More...
 
- Public Member Functions inherited from gazebo::physics::State
 State ()
 Default constructor. More...
 
 State (const std::string &_name, const common::Time &_realTime, const common::Time &_simTime, const uint64_t _iterations)
 Constructor. More...
 
virtual ~State ()
 Destructor. 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...
 
State operator- (const State &_state) const
 Subtraction operator. More...
 
Stateoperator= (const State &_state)
 Assignment operator. More...
 
void SetName (const std::string &_name)
 Set the name associated with this State. More...
 

Friends

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

Additional Inherited Members

- Protected Attributes inherited from gazebo::physics::State
uint64_t iterations
 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...
 

Detailed Description

Store state information of a physics::World object.

Instances of this class contain the state of a World at a specific time. World state includes the state of all models, and their children.

Constructor & Destructor Documentation

gazebo::physics::WorldState::WorldState ( )

Default constructor.

gazebo::physics::WorldState::WorldState ( const WorldPtr  _world)
explicit

Constructor.

Generate a WorldState from an instance of a World.

Parameters
[in]_worldPointer to a world
gazebo::physics::WorldState::WorldState ( const sdf::ElementPtr  _sdf)
explicit

Constructor.

Build a WorldState from SDF data

Parameters
[in]_sdfSDF data to load a world state from.
virtual gazebo::physics::WorldState::~WorldState ( )
virtual

Destructor.

Member Function Documentation

const std::vector<std::string>& gazebo::physics::WorldState::Deletions ( ) const

Get the vector of SDF deletions.

Returns
A vector of SDF blocks. Each block contains the SDF of the model to be removed from the simulation.
void gazebo::physics::WorldState::FillSDF ( sdf::ElementPtr  _sdf)

Populate a state SDF element with data from the object.

Parameters
[out]_sdfSDF element to populate.
LightState gazebo::physics::WorldState::GetLightState ( const std::string &  _lightName) const

Get a light state by light name.

Parameters
[in]_lightNameName of the light state to get.
Returns
The light state.
Exceptions
common::ExceptionWhen the _lightName doesn't exist.
ModelState gazebo::physics::WorldState::GetModelState ( const std::string &  _modelName) const

Get a model state by model name.

Parameters
[in]_modelNameName of the model state to get.
Returns
The model state.
Exceptions
common::ExceptionWhen the _modelName doesn't exist.
unsigned int gazebo::physics::WorldState::GetModelStateCount ( ) const

Get the number of model states.

Returns the number of models in this instance.

Returns
Number of models.
ModelState_M gazebo::physics::WorldState::GetModelStates ( const boost::regex &  _regex) const

Get model states based on a regular expression.

Parameters
[in]_regexThe regular expression.
Returns
List of model states whose names match the regular expression.
const ModelState_M& gazebo::physics::WorldState::GetModelStates ( ) const

Get the model states.

Returns
A vector of model states.
bool gazebo::physics::WorldState::HasLightState ( const std::string &  _lightName) const

Return true if WorldState has a LightState with the given name.

Parameters
[in]_lightNameName of the light to search for.
Returns
True if the LightState exists.
bool gazebo::physics::WorldState::HasModelState ( const std::string &  _modelName) const

Return true if WorldState has a ModelState with the given name.

Parameters
[in]_modelNameName of the model to search for.
Returns
True if the ModelState exists.
const std::vector<std::string>& gazebo::physics::WorldState::Insertions ( ) const

Get the vector of SDF insertions.

Returns
A vector of SDF blocks. Each block contains the SDF of the model to be spawned in the simulation.
bool gazebo::physics::WorldState::IsZero ( ) const

Return true if the values in the state are zero.

This will check to see if the all model states are zero.

Returns
True if the values in the state are zero.
unsigned int gazebo::physics::WorldState::LightStateCount ( ) const

Get the number of light states.

Returns the number of lights in this instance.

Returns
Number of lights.
const LightState_M& gazebo::physics::WorldState::LightStates ( ) const

Get the light states.

Returns
A vector of light states.
void gazebo::physics::WorldState::Load ( const WorldPtr  _world)

Load from a World pointer.

Generate a WorldState from an instance of a World.

Parameters
[in]_worldPointer to a world
virtual void gazebo::physics::WorldState::Load ( const sdf::ElementPtr  _elem)
virtual

Load state from SDF element.

Set a WorldState from an SDF element containing WorldState info.

Parameters
[in]_elemPointer to the WorldState SDF element.

Reimplemented from gazebo::physics::State.

WorldState gazebo::physics::WorldState::operator+ ( const WorldState _state) const

Addition operator.

Parameters
[in]_ptA state to add.
Returns
The resulting state.
WorldState gazebo::physics::WorldState::operator- ( const WorldState _state) const

Subtraction operator.

Parameters
[in]_ptA state to substract.
Returns
The resulting state.
WorldState& gazebo::physics::WorldState::operator= ( const WorldState _state)

Assignment operator.

Parameters
[in]_stateState value
Returns
Reference to this
void gazebo::physics::WorldState::SetDeletions ( const std::vector< std::string > &  _deletions)

Set a new vector of SDF deletions.

Parameters
[in]_deletionsVector containing SDF blocks. Each block should contain the SDF of the models removed in the current simulation frame.
void gazebo::physics::WorldState::SetInsertions ( const std::vector< std::string > &  _insertions)

Set a new vector of SDF insertions.

Parameters
[in]_insertionsVector containing SDF blocks. Each block should contain the SDF of the new models spawned in the current simulation frame.
virtual void gazebo::physics::WorldState::SetIterations ( const uint64_t  _iterations)
virtual

Set the simulation interations when this state was generated.

Parameters
[in]_iterationsSimulation iterations when the data was recorded.

Reimplemented from gazebo::physics::State.

virtual void gazebo::physics::WorldState::SetRealTime ( const common::Time _time)
virtual

Set the real time when this state was generated.

Parameters
[in]_timeClock time since simulation was stated.

Reimplemented from gazebo::physics::State.

virtual void gazebo::physics::WorldState::SetSimTime ( const common::Time _time)
virtual

Set the sim time when this state was generated.

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

Reimplemented from gazebo::physics::State.

virtual void gazebo::physics::WorldState::SetWallTime ( const common::Time _time)
virtual

Set the wall time when this state was generated.

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

Reimplemented from gazebo::physics::State.

void gazebo::physics::WorldState::SetWorld ( const WorldPtr  _world)

Set the world.

Parameters
[in]_worldPointer to the world.

Friends And Related Function Documentation

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

Stream insertion operator.

Parameters
[in]_outoutput stream
[in]_stateWorld state to output
Returns
the stream

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