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;
144 public:
const std::vector<std::string> &Insertions()
const;
150 public:
void SetInsertions(
const std::vector<std::string> &_insertions);
155 public:
const std::vector<std::string> &Deletions()
const;
160 public:
void SetDeletions(
const std::vector<std::string> &_deletions);
166 public:
bool IsZero()
const;
170 public:
void FillSDF(sdf::ElementPtr _sdf);
175 public:
virtual void SetWallTime(
const common::Time &_time);
179 public:
virtual void SetRealTime(
const common::Time &_time);
183 public:
virtual void SetSimTime(
const common::Time &_time);
188 public:
virtual void SetIterations(
const uint64_t _iterations);
209 public:
inline friend std::ostream &
operator<<(std::ostream &_out,
212 _out <<
"<state world_name='" << _state.
name <<
"'>"
213 <<
"<sim_time>" << _state.
simTime <<
"</sim_time>"
214 <<
"<wall_time>" << _state.
wallTime <<
"</wall_time>"
215 <<
"<real_time>" << _state.
realTime <<
"</real_time>"
216 <<
"<iterations>" << _state.
iterations <<
"</iterations>";
219 if (_state.insertions.size() > 0)
221 _out <<
"<insertions>";
222 for (std::vector<std::string>::const_iterator iter =
223 _state.insertions.begin();
224 iter != _state.insertions.end(); ++iter)
228 _out <<
"</insertions>";
232 if (_state.deletions.size() > 0)
234 _out <<
"<deletions>";
235 for (std::vector<std::string>::const_iterator iter =
236 _state.deletions.begin();
237 iter != _state.deletions.end(); ++iter)
239 _out <<
"<name>" << (*iter) <<
"</name>";
241 _out <<
"</deletions>";
245 for (
const auto &model : _state.modelStates)
247 _out << model.second;
251 for (
const auto &light : _state.lightStates)
253 _out << light.second;
269 private: std::vector<std::string> insertions;
273 private: std::vector<std::string> deletions;
friend std::ostream & operator<<(std::ostream &_out, const gazebo::physics::WorldState &_state)
Stream insertion operator.
Definition: WorldState.hh:209
uint64_t iterations
The number of simulation iterations when this state was generated.
Definition: State.hh:137
std::string name
Name associated with this State.
Definition: State.hh:130
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
std::map< std::string, ModelState > ModelState_M
Definition: PhysicsTypes.hh:233
common::Time wallTime
Times for the state data.
Definition: State.hh:133
common::Time realTime
Definition: State.hh:133
State of an entity.
Definition: State.hh:49
Store state information of a Light object.
Definition: LightState.hh:38
std::map< std::string, LightState > LightState_M
Definition: PhysicsTypes.hh:237
common::Time simTime
Definition: State.hh:133
Store state information of a physics::Model object.
Definition: ModelState.hh:49
Store state information of a physics::World object.
Definition: WorldState.hh:47
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44