17 #ifndef _GAZEBO_WORLD_HH_
18 #define _GAZEBO_WORLD_HH_
31 #include <boost/thread.hpp>
32 #include <boost/enable_shared_from_this.hpp>
33 #include <boost/shared_ptr.hpp>
69 public boost::enable_shared_from_this<World>
74 public:
explicit World(
const std::string &_name =
"");
82 public:
void Load(sdf::ElementPtr _sdf);
87 public:
void Save(
const std::string &_filename);
97 public:
void Run(
unsigned int _iterations = 0);
101 public:
bool GetRunning()
const;
114 public:
void Clear();
118 public: std::string GetName()
const;
135 public:
unsigned int GetModelCount()
const;
142 public:
ModelPtr GetModel(
unsigned int _index)
const;
146 public:
Model_V GetModels()
const;
155 public:
void ResetTime();
158 public:
void Reset();
162 public:
void PrintEntityTree();
187 public:
bool IsPaused()
const;
191 public:
void SetPaused(
bool _p);
198 public:
BasePtr GetByName(
const std::string &_name);
205 public:
ModelPtr GetModel(
const std::string &_name);
212 public:
EntityPtr GetEntity(
const std::string &_name);
232 public:
void SetState(
const WorldState &_state);
237 public:
void InsertModelFile(
const std::string &_sdfFilename);
242 public:
void InsertModelString(
const std::string &_sdfString);
247 public:
void InsertModelSDF(
const sdf::SDF &_sdf);
252 public: std::string StripWorldName(
const std::string &_name)
const;
257 public:
void EnableAllModels();
262 public:
void DisableAllModels();
266 public:
void Step(
unsigned int _steps);
272 public:
void LoadPlugin(
const std::string &_filename,
273 const std::string &_name,
274 sdf::ElementPtr _sdf);
278 public:
void RemovePlugin(
const std::string &_name);
282 public: boost::mutex *GetSetWorldPoseMutex()
const;
286 public:
bool GetEnablePhysicsEngine();
290 public:
void EnablePhysicsEngine(
bool _enable);
293 public:
void UpdateStateSDF();
297 public:
bool IsLoaded()
const;
301 public:
void ClearModels();
311 public: uint32_t GetIterations()
const;
315 public: msgs::Scene GetSceneMsg()
const;
321 public:
void RunBlocking(
unsigned int _iterations = 0);
327 public:
void RemoveModel(
ModelPtr _model);
333 public:
void RemoveModel(
const std::string &_name);
341 public:
void _AddDirty(
Entity *_entity);
350 private:
ModelPtr GetModelById(
unsigned int _id);
356 private:
void LoadPlugins();
361 private:
void LoadEntities(sdf::ElementPtr _sdf,
BasePtr _parent);
382 private:
void RunLoop();
385 private:
void Step();
388 private:
void LogStep();
391 private:
void Update();
395 private:
void OnPause(
bool _p);
398 private:
void OnStep();
402 private:
void OnControl(ConstWorldControlPtr &_data);
406 private:
void OnPlaybackControl(ConstLogPlaybackControlPtr &_data);
410 private:
void OnRequest(ConstRequestPtr &_msg);
416 private:
void BuildSceneMsg(msgs::Scene &_scene,
BasePtr _entity);
420 private:
void JointLog(ConstJointPtr &_msg);
424 private:
void OnFactoryMsg(ConstFactoryPtr &_data);
428 private:
void OnModelMsg(ConstModelPtr &_msg);
431 private:
void ModelUpdateTBB();
434 private:
void ModelUpdateSingleLoop();
438 private:
void LoadPlugin(sdf::ElementPtr _sdf);
443 private:
void FillModelMsg(msgs::Model &_msg,
ModelPtr _model);
447 private:
void ProcessEntityMsgs();
451 private:
void ProcessRequestMsgs();
455 private:
void ProcessFactoryMsgs();
459 private:
void ProcessModelMsgs();
462 private:
bool OnLog(std::ostringstream &_stream);
465 private:
void ProcessMessages();
468 private:
void PublishWorldStats();
471 private:
void LogWorker();
475 private:
void OnLightMsg(ConstLightPtr &_msg);
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:68
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:84
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:318
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
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:108
The world provides access to all other object within a simulated environment.
Definition: World.hh:68
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:76
Simbody physics engine.
Definition: SimbodyPhysics.hh:42
Base class for all physics objects in Gazebo.
Definition: Entity.hh:56
EntityType
Unique identifiers for all entity types.
Definition: Base.hh:84
boost::shared_ptr< Actor > ActorPtr
Definition: PhysicsTypes.hh:88
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
std::vector< ModelPtr > Model_V
Definition: PhysicsTypes.hh:180
Store state information of a physics::World object.
Definition: WorldState.hh:46
boost::shared_ptr< SphericalCoordinates > SphericalCoordinatesPtr
Definition: CommonTypes.hh:138
Base type.
Definition: Base.hh:86
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:39
boost::shared_ptr< Road > RoadPtr
Definition: PhysicsTypes.hh:136
boost::shared_ptr< PresetManager > PresetManagerPtr
Definition: PhysicsTypes.hh:112
DART Link class.
Definition: DARTLink.hh:42