Store state information of a physics::World object. More...
#include <physics/physics.hh>
Public Member Functions | |
WorldState () | |
Default constructor. | |
WorldState (const WorldPtr _world) | |
Constructor. | |
WorldState (const sdf::ElementPtr _sdf) | |
Constructor. | |
virtual | ~WorldState () |
Destructor. | |
void | FillSDF (sdf::ElementPtr _sdf) |
Populate a state SDF element with data from the object. | |
ModelState | GetModelState (unsigned int _index) const |
Get a model state. | |
ModelState | GetModelState (const std::string &_modelName) const |
Get a model state by model name. | |
unsigned int | GetModelStateCount () const |
Get the number of model states. | |
const std::vector< ModelState > & | GetModelStates () const |
Get the model states. | |
bool | HasModelState (const std::string &_modelName) const |
Return true if WorldState has a ModelState with the given name. | |
bool | IsZero () const |
Return true if the values in the state are zero. | |
virtual void | Load (const sdf::ElementPtr _elem) |
Load state from SDF element. | |
WorldState | operator+ (const WorldState &_state) const |
Addition operator. | |
WorldState | operator- (const WorldState &_state) const |
Subtraction operator. | |
WorldState & | operator= (const WorldState &_state) |
Assignment operator. | |
Public Member Functions inherited from gazebo::physics::State | |
State () | |
Default constructor. | |
State (const std::string &_name, const common::Time &_realTime, const common::Time &_simTime) | |
Constructor. | |
virtual | ~State () |
Destructor. | |
std::string | GetName () const |
Get the name associated with this State. | |
common::Time | GetRealTime () const |
Get the real time when this state was generated. | |
common::Time | GetSimTime () const |
Get the sim time when this state was generated. | |
common::Time | GetWallTime () const |
Get the wall time when this state was generated. | |
State | operator- (const State &_state) const |
Subtraction operator. | |
State & | operator= (const State &_state) |
Assignment operator. | |
void | SetName (const std::string &_name) |
Set the name associated with this State. | |
Friends | |
std::ostream & | operator<< (std::ostream &_out, const gazebo::physics::WorldState &_state) |
Stream insertion operator. | |
Additional Inherited Members | |
Protected Attributes inherited from gazebo::physics::State | |
std::string | name |
Name associated with this State. | |
common::Time | realTime |
common::Time | simTime |
common::Time | wallTime |
Times for the state data. | |
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.
gazebo::physics::WorldState::WorldState | ( | ) |
Default constructor.
|
explicit |
Constructor.
Generate a WorldState from an instance of a World.
[in] | _world | Pointer to a world |
|
explicit |
Constructor.
Build a WorldState from SDF data
[in] | _sdf | SDF data to load a world state from. |
|
virtual |
Destructor.
void gazebo::physics::WorldState::FillSDF | ( | sdf::ElementPtr | _sdf | ) |
Populate a state SDF element with data from the object.
[out] | _sdf | SDF element to populate. |
ModelState gazebo::physics::WorldState::GetModelState | ( | unsigned int | _index | ) | const |
Get a model state.
Get the state of a Model based on an index. The min index is and the max is WorldState::GetModelStateCount().
[in] | _index | Index of the model. |
ModelState gazebo::physics::WorldState::GetModelState | ( | const std::string & | _modelName | ) | const |
Get a model state by model name.
[in] | _modelName | Name of the model state to get. |
common::Exception | When 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.
const std::vector<ModelState>& gazebo::physics::WorldState::GetModelStates | ( | ) | const |
Get the model states.
bool gazebo::physics::WorldState::HasModelState | ( | const std::string & | _modelName | ) | const |
Return true if WorldState has a ModelState with the given name.
[in] | _modelName | Name of the model to search for. |
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.
|
virtual |
Load state from SDF element.
Set a WorldState from an SDF element containing WorldState info.
[in] | _elem | Pointer to the WorldState SDF element. |
Reimplemented from gazebo::physics::State.
WorldState gazebo::physics::WorldState::operator+ | ( | const WorldState & | _state | ) | const |
WorldState gazebo::physics::WorldState::operator- | ( | const WorldState & | _state | ) | const |
WorldState& gazebo::physics::WorldState::operator= | ( | const WorldState & | _state | ) |
|
friend |
Stream insertion operator.
[in] | _out | output stream |
[in] | _state | World state to output |