#include <World.h>
Classes | |
struct | TGUI_Options |
struct | TGUIKeyEvent |
struct | TUpdateGUIParams |
struct | VehicleVisitorBase |
struct | WorldElementVisitorBase |
Public Types | |
Public types | |
typedef std::multimap< std::string, VehicleBase * > | TListVehicles |
typedef std::list< WorldElementBase * > | TListWorldElements |
getListOfVehicles() More... | |
typedef std::multimap< std::string, Block * > | TListBlocks |
Public Member Functions | |
Initialization, simulation set-up | |
World () | |
Default ctor: inits an empty world. More... | |
~World () | |
Dtor. More... | |
void | clear_all (bool acquire_mt_lock=true) |
void | load_from_XML (const std::string &xml_text, const std::string &fileNameForPath=std::string(".")) |
Simulation execution | |
double | get_simul_time () const |
Simulation wall-clock time. More... | |
double | get_simul_timestep () const |
Simulation fixed-time interval for numerical integration. More... | |
void | set_simul_timestep (double timestep) |
Simulation fixed-time interval for numerical integration. More... | |
double | get_gravity () const |
void | set_gravity (double accel) |
void | run_simulation (double dt) |
void | update_GUI (TUpdateGUIParams *params=NULL) |
bool | is_GUI_open () const |
Forces closing the GUI window, if any. More... | |
void | close_GUI () |
a previous call to update_GUI() More... | |
Access inner working objects | |
b2World * | getBox2DWorld () |
const b2World * | getBox2DWorld () const |
b2Body * | getBox2DGroundBody () |
const TListVehicles & | getListOfVehicles () const |
TListVehicles & | getListOfVehicles () |
const TListBlocks & | getListOfBlocks () const |
TListBlocks & | getListOfBlocks () |
const TListWorldElements & | getListOfWorldElements () const |
CTimeLogger & | getTimeLogger () |
std::string | resolvePath (const std::string &in_path) const |
Visitors API | |
void | runVisitorOnVehicles (VehicleVisitorBase &v) |
void | runVisitorOnWorldElements (WorldElementVisitorBase &v) |
Optional user hooks | |
virtual void | onNewObservation (const VehicleBase &veh, const mrpt::slam::CObservation *obs) |
Private Member Functions | |
void | internal_one_timestep (double dt) |
Private Attributes | |
b2Body * | m_b2_ground_body |
Used to declare friction between vehicles-ground. More... | |
int | m_b2d_pos_iters |
Velocity and position iteration count (Box2D) More... | |
int | m_b2d_vel_iters |
integration. More... | |
std::string | m_base_path |
Path from which to take relative directories. More... | |
TListBlocks | m_blocks |
b2World * | m_box2d_world |
objects from multithreading access. More... | |
double | m_gravity |
TGUI_Options | m_gui_options |
mrpt::gui::CDisplayWindow3D::Ptr | m_gui_win |
double | m_simul_time |
evaluate weights for friction, etc. More... | |
double | m_simul_timestep |
CTicTac | m_timer_iteration |
CTimeLogger | m_timlogger |
TListVehicles | m_vehicles |
std::mutex | m_world_cs |
first time the GUI window is created. More... | |
TListWorldElements | m_world_elements |
Friends | |
class | Block |
class | VehicleBase |
Simulation happens inside a World object. This is the central class for usage from user code, running the simulation, loading XML models, managing GUI visualization, etc. The ROS node acts as a bridge between this class and the ROS subsystem.
typedef std::multimap<std::string, Block*> mvsim::World::TListBlocks |
typedef std::multimap<std::string, VehicleBase*> mvsim::World::TListVehicles |
typedef std::list<WorldElementBase*> mvsim::World::TListWorldElements |
void World::clear_all | ( | bool | acquire_mt_lock = true | ) |
void World::close_GUI | ( | ) |
a previous call to update_GUI()
Forces closing the GUI window, if any.
Definition at line 63 of file World_gui.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
bool World::is_GUI_open | ( | ) | const |
Forces closing the GUI window, if any.
Return true if the GUI window is open, after
Definition at line 61 of file World_gui.cpp.
void World::load_from_XML | ( | const std::string & | xml_text, |
const std::string & | fileNameForPath = std::string(".") |
||
) |
simulation environment to an empty world. acquire_mt_lock determines whether to lock the multithreading semaphore before (set to false only if it's already acquired). Load an entire world description into this object from a specification in XML format.
[in] | fileNameForPath | Optionally, provide the full path to an XML file from which to take relative paths. |
std::exception | On any error, with what() giving a descriptive error message |
Load an entire world description into this object from a specification in XML format.
std::exception | On any error, with what() giving a descriptive error message |
Definition at line 38 of file World_load_xml.cpp.
|
inlinevirtual |
std::string World::resolvePath | ( | const std::string & | s_in | ) | const |
void World::run_simulation | ( | double | dt | ) |
Runs the simulation for a given time interval (in seconds)
Runs the simulation for a given time interval (in seconds)
void World::runVisitorOnVehicles | ( | VehicleVisitorBase & | v | ) |
void World::runVisitorOnWorldElements | ( | WorldElementVisitorBase & | v | ) |
|
inline |
|
inline |
void World::update_GUI | ( | TUpdateGUIParams * | guiparams = NULL | ) |
Updates (or sets-up upon first call) the GUI visualization of the scene.
[in,out] | params | Optional inputs/outputs to the GUI update process. See struct for details. |
Updates (or sets-up upon first call) the GUI visualization of the scene.
Definition at line 68 of file World_gui.cpp.
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |