30 #include <boost/enable_shared_from_this.hpp>
31 #include <boost/shared_ptr.hpp>
50 class recursive_mutex;
68 class World :
public boost::enable_shared_from_this<World>
74 public:
explicit World(
const std::string &_name =
"");
89 public:
void Save(
const std::string &_filename);
112 public:
void Clear();
116 public: std::string
GetName()
const;
151 public:
void Reset();
257 public: std::string
StripWorldName(
const std::string &_name)
const;
279 public:
void LoadPlugin(
const std::string &_filename,
280 const std::string &_name,
290 {
return this->setWorldPoseMutex;}
295 {
return this->enablePhysicsEngine;}
300 {this->enablePhysicsEngine = _enable;}
323 private:
ModelPtr GetModelById(
unsigned int _id);
329 private:
void LoadPlugins();
355 private:
void RunLoop();
358 private:
void Step();
361 private:
void LogStep();
364 private:
void Update();
368 private:
void OnPause(
bool _p);
371 private:
void OnStep();
375 private:
void OnControl(ConstWorldControlPtr &_data);
379 private:
void OnLogControl(ConstLogControlPtr &_data);
383 private:
void OnRequest(ConstRequestPtr &_msg);
387 private:
void SetSelectedEntityCB(
const std::string &_name);
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();
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 PublishLogStatus();
460 private: boost::thread *thread;
469 private: std::vector<google::protobuf::Message> messages;
472 private: std::string name;
487 private:
int stepInc;
541 private: msgs::WorldStatistics worldStatsMsg;
544 private: msgs::Scene sceneMsg;
547 private: void (
World::*modelUpdateFunc)();
562 private: boost::recursive_mutex *receiveMutex;
565 private: boost::mutex *loadModelMutex;
571 private: boost::mutex *setWorldPoseMutex;
579 private: boost::recursive_mutex *worldUpdateMutex;
585 private: std::vector<WorldPluginPtr> plugins;
588 private: std::list<std::string> deleteEntity;
596 private: std::list<msgs::Request> requestMsgs;
599 private: std::list<msgs::Factory> factoryMsgs;
602 private: std::list<msgs::Model> modelMsgs;
605 private:
bool needsReset;
608 private:
bool resetAll;
611 private:
bool resetTimeOnly;
614 private:
bool resetModelOnly;
617 private:
bool initialized;
620 private:
bool loaded;
623 private:
bool enablePhysicsEngine;
629 private:
bool pluginsLoaded;
641 private: std::deque<WorldState> states;
643 private:
int stateToggle;
653 private: std::set<std::string> publishModelPoses;
659 private: uint64_t iterations;