17 #ifndef _GAZEBO_WORLD_HH_
18 #define _GAZEBO_WORLD_HH_
25 #include <boost/thread.hpp>
26 #include <boost/enable_shared_from_this.hpp>
27 #include <boost/shared_ptr.hpp>
67 public:
explicit World(
const std::string &_name =
"");
75 public:
void Load(sdf::ElementPtr _sdf);
80 public:
void Save(
const std::string &_filename);
90 public:
void Run(
unsigned int _iterations = 0);
94 public:
bool GetRunning()
const;
107 public:
void Clear();
111 public: std::string GetName()
const;
124 public:
unsigned int GetModelCount()
const;
131 public:
ModelPtr GetModel(
unsigned int _index)
const;
135 public:
Model_V GetModels()
const;
144 public:
void ResetTime();
147 public:
void Reset();
151 public:
void PrintEntityTree();
176 public:
bool IsPaused()
const;
180 public:
void SetPaused(
bool _p);
187 public:
BasePtr GetByName(
const std::string &_name);
194 public:
ModelPtr GetModel(
const std::string &_name);
201 public:
EntityPtr GetEntity(
const std::string &_name);
221 public:
void SetState(
const WorldState &_state);
226 public:
void InsertModelFile(
const std::string &_sdfFilename);
231 public:
void InsertModelString(
const std::string &_sdfString);
236 public:
void InsertModelSDF(
const sdf::SDF &_sdf);
241 public: std::string StripWorldName(
const std::string &_name)
const;
246 public:
void EnableAllModels();
251 public:
void DisableAllModels();
255 public:
void Step(
unsigned int _steps);
261 public:
void LoadPlugin(
const std::string &_filename,
262 const std::string &_name,
263 sdf::ElementPtr _sdf);
267 public:
void RemovePlugin(
const std::string &_name);
271 public: boost::mutex *GetSetWorldPoseMutex()
const;
275 public:
bool GetEnablePhysicsEngine();
279 public:
void EnablePhysicsEngine(
bool _enable);
282 public:
void UpdateStateSDF();
286 public:
bool IsLoaded()
const;
290 public:
void ClearModels();
300 public: uint32_t GetIterations()
const;
304 public: msgs::Scene GetSceneMsg()
const;
310 public:
void RunBlocking(
unsigned int _iterations = 0);
316 public:
void RemoveModel(
ModelPtr _model);
322 public:
void RemoveModel(
const std::string &_name);
331 private:
ModelPtr GetModelById(
unsigned int _id);
337 private:
void LoadPlugins();
342 private:
void LoadEntities(sdf::ElementPtr _sdf,
BasePtr _parent);
363 private:
void RunLoop();
366 private:
void Step();
369 private:
void LogStep();
372 private:
void Update();
376 private:
void OnPause(
bool _p);
379 private:
void OnStep();
383 private:
void OnControl(ConstWorldControlPtr &_data);
387 private:
void OnRequest(ConstRequestPtr &_msg);
393 private:
void BuildSceneMsg(msgs::Scene &_scene,
BasePtr _entity);
397 private:
void JointLog(ConstJointPtr &_msg);
401 private:
void OnFactoryMsg(ConstFactoryPtr &_data);
405 private:
void OnModelMsg(ConstModelPtr &_msg);
408 private:
void ModelUpdateTBB();
411 private:
void ModelUpdateSingleLoop();
415 private:
void LoadPlugin(sdf::ElementPtr _sdf);
420 private:
void FillModelMsg(msgs::Model &_msg,
ModelPtr _model);
424 private:
void ProcessEntityMsgs();
428 private:
void ProcessRequestMsgs();
432 private:
void ProcessFactoryMsgs();
436 private:
void ProcessModelMsgs();
439 private:
bool OnLog(std::ostringstream &_stream);
442 private:
void ProcessMessages();
445 private:
void PublishWorldStats();
448 private:
void LogWorker();
452 private:
void OnLightMsg(ConstLightPtr &_msg);
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:66
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:82
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
Forward declarations for transport.
default namespace for gazebo
Private data class for World.
Definition: WorldPrivate.hh:43
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:106
The world provides access to all other object within a simulated environment.
Definition: World.hh:62
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:74
Simbody physics engine.
Definition: SimbodyPhysics.hh:42
ODE Link class.
Definition: ODELink.hh:34
EntityType
Unique identifiers for all entity types.
Definition: Base.hh:78
boost::shared_ptr< Actor > ActorPtr
Definition: PhysicsTypes.hh:86
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
std::vector< ModelPtr > Model_V
Definition: PhysicsTypes.hh:170
Store state information of a physics::World object.
Definition: WorldState.hh:46
boost::shared_ptr< SphericalCoordinates > SphericalCoordinatesPtr
Definition: CommonTypes.hh:135
Base type.
Definition: Base.hh:80
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:43
boost::shared_ptr< Road > RoadPtr
Definition: PhysicsTypes.hh:130
DART Link class.
Definition: DARTLink.hh:39