47 #ifndef FLATLAND_SERVER_WORLD_H 48 #define FLATLAND_SERVER_WORLD_H 50 #include <Box2D/Box2D.h> 51 #include <flatland_server/collision_filter_registry.h> 52 #include <flatland_server/interactive_marker_manager.h> 53 #include <flatland_server/layer.h> 54 #include <flatland_server/model.h> 55 #include <flatland_server/plugin_manager.h> 56 #include <flatland_server/timekeeper.h> 69 class World :
public b2ContactListener {
74 std::map<std::vector<std::string>,
Layer *>
121 void PreSolve(b2Contact *contact,
const b2Manifold *oldManifold);
128 void PostSolve(b2Contact *contact,
const b2ContactImpulse *impulse);
157 void LoadModel(
const std::string &model_yaml_path,
const std::string &ns,
158 const std::string &name,
const Pose &pose);
210 #endif // FLATLAND_SERVER_WORLD_H World()
Constructor for the world class. All data required for initialization should be passed in here...
Definition: world.cpp:61
std::map< std::vector< std::string >, Layer * > layers_name_map_
map of all layers and thier name
Definition: world.h:75
Definition: collision_filter_registry.h:63
void Update(Timekeeper &timekeeper)
trigger world update include all physics and plugins
Definition: world.cpp:101
void PreSolve(b2Contact *contact, const b2Manifold *oldManifold)
Box2D inherited presolve.
Definition: world.cpp:120
boost::filesystem::path world_yaml_dir_
directory containing world file
Definition: world.h:71
static World * MakeWorld(const std::string &yaml_path)
factory method to create a instance of the world class. Cleans all the inputs before instantiation of...
Definition: world.cpp:128
bool IsPaused()
returns true if service_paused_ is true or an interactive marker is currently being dragged ...
Definition: world.cpp:339
void Pause()
set the paused state of the simulation to true
Definition: world.cpp:333
std::vector< Layer * > layers_
list of layers
Definition: world.h:76
PluginManager plugin_manager_
for loading and updating plugins
Definition: world.h:79
b2World * physics_world_
Box2D physics world.
Definition: world.h:72
bool service_paused_
Definition: world.h:80
void BeginContact(b2Contact *contact) override
Box2D inherited begin contact.
Definition: world.cpp:112
std::vector< Model * > models_
list of models
Definition: world.h:77
void DebugVisualize(bool update_layers=true)
Publish debug visualizations for everything.
Definition: world.cpp:343
void LoadModel(const std::string &model_yaml_path, const std::string &ns, const std::string &name, const Pose &pose)
load models into the world. Throws YAMLException.
Definition: world.cpp:244
void EndContact(b2Contact *contact) override
Box2D inherited end contact.
Definition: world.cpp:116
void PostSolve(b2Contact *contact, const b2ContactImpulse *impulse)
Box2D inherited pre solve.
Definition: world.cpp:124
void DeleteModel(const std::string &name)
remove model with a given name
Definition: world.cpp:292
~World()
Destructor for the world class.
Definition: world.cpp:69
void LoadModels(YamlReader &models_reader)
load models into the world. Throws YAMLException.
Definition: world.cpp:219
void Resume()
set the paused state of the simulation to false
Definition: world.cpp:335
void TogglePaused()
toggle the paused state of the simulation
Definition: world.cpp:337
int physics_velocity_iterations_
Box2D solver param.
Definition: world.h:85
Definition: interactive_marker_manager.h:14
b2Vec2 gravity_
Box2D world gravity, always (0, 0)
Definition: world.h:73
void MoveModel(const std::string &name, const Pose &pose)
move model with a given name
Definition: world.cpp:314
InteractiveMarkerManager int_marker_manager_
for dynamically moving models from Rviz
Definition: world.h:83
Definition: plugin_manager.h:64
Definition: timekeeper.h:55
CollisionFilterRegistry cfr_
collision registry for layers and models
Definition: world.h:78
Definition: yaml_reader.h:76
int physics_position_iterations_
Box2D solver param.
Definition: world.h:84
void LoadLayers(YamlReader &layers_reader)
load layers into the world. Throws YAMLException.
Definition: world.cpp:167