Go to the documentation of this file.
21 #ifndef GAZEBO_PHYSICS_WORLDSTATE_HH_
22 #define GAZEBO_PHYSICS_WORLDSTATE_HH_
62 public:
explicit WorldState(
const sdf::ElementPtr _sdf);
71 public:
void Load(
const WorldPtr _world);
78 public:
void LoadWithFilter(
const WorldPtr _world,
79 const std::string &_filter);
85 public:
virtual void Load(
const sdf::ElementPtr _elem);
89 public:
void SetWorld(
const WorldPtr _world);
95 public:
ModelState_M GetModelStates(
const boost::regex &_regex)
const;
109 public:
unsigned int GetModelStateCount()
const;
115 public:
unsigned int LightStateCount()
const;
121 public:
ModelState GetModelState(
const std::string &_modelName)
const;
127 public:
LightState GetLightState(
const std::string &_lightName)
const;
133 public:
bool HasModelState(
const std::string &_modelName)
const;
139 public:
bool HasLightState(
const std::string &_lightName)
const;
145 public:
const std::vector<std::string> &Insertions()
const;
152 public:
void SetInsertions(
const std::vector<std::string> &_insertions);
157 public:
const std::vector<std::string> &Deletions()
const;
162 public:
void SetDeletions(
const std::vector<std::string> &_deletions);
168 public:
bool IsZero()
const;
172 public:
void FillSDF(sdf::ElementPtr _sdf);
177 public:
virtual void SetWallTime(
const common::Time &_time);
181 public:
virtual void SetRealTime(
const common::Time &_time);
185 public:
virtual void SetSimTime(
const common::Time &_time);
190 public:
virtual void SetIterations(
const uint64_t _iterations);
211 public:
inline friend std::ostream &
operator<<(std::ostream &_out,
214 _out <<
"<state world_name='" << _state.
name <<
"'>"
215 <<
"<sim_time>" << _state.
simTime <<
"</sim_time>"
216 <<
"<wall_time>" << _state.
wallTime <<
"</wall_time>"
217 <<
"<real_time>" << _state.
realTime <<
"</real_time>"
218 <<
"<iterations>" << _state.
iterations <<
"</iterations>";
221 if (_state.insertions.size() > 0)
223 _out <<
"<insertions>";
224 for (std::vector<std::string>::const_iterator iter =
225 _state.insertions.begin();
226 iter != _state.insertions.end(); ++iter)
230 _out <<
"</insertions>";
234 if (_state.deletions.size() > 0)
236 _out <<
"<deletions>";
237 for (std::vector<std::string>::const_iterator iter =
238 _state.deletions.begin();
239 iter != _state.deletions.end(); ++iter)
241 _out <<
"<name>" << (*iter) <<
"</name>";
243 _out <<
"</deletions>";
247 for (
const auto &model : _state.modelStates)
249 _out << model.second;
253 for (
const auto &light : _state.lightStates)
255 _out << light.second;
271 private: std::vector<std::string> insertions;
275 private: std::vector<std::string> deletions;
unsigned int LightStateCount() const
Get the number of light states.
common::Time wallTime
Times for the state data.
Definition: State.hh:133
uint64_t iterations
The number of simulation iterations when this state was generated.
Definition: State.hh:137
const LightState_M & LightStates() const
Get the light states.
virtual void SetSimTime(const common::Time &_time)
Set the sim time when this state was generated.
std::map< std::string, ModelState > ModelState_M
Definition: PhysicsTypes.hh:233
Forward declarations for the common classes.
Definition: Animation.hh:26
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:44
virtual void SetWallTime(const common::Time &_time)
Set the wall time when this state was generated.
void SetDeletions(const std::vector< std::string > &_deletions)
Set a new vector of SDF deletions.
virtual void SetIterations(const uint64_t _iterations)
Set the simulation interations when this state was generated.
const std::vector< std::string > & Insertions() const
Get the vector of SDF insertions.
friend std::ostream & operator<<(std::ostream &_out, const gazebo::physics::WorldState &_state)
Stream insertion operator.
Definition: WorldState.hh:211
const std::vector< std::string > & Deletions() const
Get the vector of SDF deletions.
bool HasModelState(const std::string &_modelName) const
Return true if WorldState has a ModelState with the given name.
common::Time realTime
Definition: State.hh:133
WorldState operator-(const WorldState &_state) const
Subtraction operator.
void SetWorld(const WorldPtr _world)
Set the world.
Store state information of a Light object.
Definition: LightState.hh:38
LightState GetLightState(const std::string &_lightName) const
Get a light state by light name.
unsigned int GetModelStateCount() const
Get the number of model states.
void Load(const WorldPtr _world)
Load from a World pointer.
Store state information of a physics::Model object.
Definition: ModelState.hh:48
common::Time simTime
Definition: State.hh:133
ModelState GetModelState(const std::string &_modelName) const
Get a model state by model name.
State of an entity.
Definition: State.hh:49
std::map< std::string, LightState > LightState_M
Definition: PhysicsTypes.hh:237
virtual void SetRealTime(const common::Time &_time)
Set the real time when this state was generated.
WorldState & operator=(const WorldState &_state)
Assignment operator.
bool IsZero() const
Return true if the values in the state are zero.
Store state information of a physics::World object.
Definition: WorldState.hh:47
std::string name
Name associated with this State.
Definition: State.hh:130
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
void FillSDF(sdf::ElementPtr _sdf)
Populate a state SDF element with data from the object.
WorldState operator+(const WorldState &_state) const
Addition operator.
void SetInsertions(const std::vector< std::string > &_insertions)
Set a new vector of SDF insertions.
const ModelState_M & GetModelStates() const
Get the model states.
bool HasLightState(const std::string &_lightName) const
Return true if WorldState has a LightState with the given name.
void LoadWithFilter(const WorldPtr _world, const std::string &_filter)
Load from a World pointer.
WorldState()
Default constructor.
virtual ~WorldState()
Destructor.