10#include "SDL_FontCache.h"
47 SDL_Window* window =
nullptr;
48 SDL_Renderer* renderer =
nullptr;
49 bool enable_gui =
true;
52 bool show_time =
false;
53 bool show_scale_bar =
false;
54 bool show_comm =
false;
55 bool show_comm_above_all =
false;
56 bool show_lateral_leds =
false;
57 bool show_light_levels =
false;
61 uint16_t window_width = 800;
62 uint16_t window_height = 600;
63 uint16_t sub_step_count = 4;
64 double GUI_speed_up = 1.0;
66 float arena_width = 1000.0;
67 float arena_height = 1000.0;
68 float arena_surface = 1e6;
69 float max_comm_radius = 00.0f;
70 float comm_ignore_occlusions =
false;
74 b2Vec2 domain_min{0.0f, 0.0f};
75 float domain_w = 0.0f;
76 float domain_h = 0.0f;
84 std::map<std::string, std::vector<std::shared_ptr<Object>>> objects;
85 std::vector<std::shared_ptr<Pogowall>> wall_objects;
86 std::vector<std::shared_ptr<PhysicalObject>> phys_objects;
87 std::vector<std::shared_ptr<PogobotObject>> robots;
88 std::vector<std::shared_ptr<Object>> non_robots;
89 std::unique_ptr<LightLevelMap> light_map;
90 std::string initial_formation;
91 float formation_min_space_between_neighbors;
92 float formation_max_space_between_neighbors;
93 float chessboard_distance_between_neighbors;
94 uint32_t formation_attempts_per_point;
95 uint32_t formation_max_restarts;
96 std::string formation_filename;
97 std::pair<float, float> imported_formation_min_coords;
98 std::pair<float, float> imported_formation_max_coords;
101 bool formation_cluster_at_center;
102 float light_map_nb_bin_x;
103 float light_map_nb_bin_y;
105 double last_frame_shown_t = -1.0;
106 double last_frame_saved_t = -1.0;
107 double last_data_saved_t = -1.0;
113 bool dragging_pos_by_mouse =
false;
118 bool enable_data_logging;
119 std::unique_ptr<DataLogger> data_logger;
122 std::unique_ptr<PogobotObject> dummy_global_robot;
Class for managing hierarchical configuration parameters.
Definition configuration.h:64
DataLogger class for writing data to a Feather file using Apache Arrow.
Definition data_logger.h:19
Disk-shaped geometry.
Definition objects_geometry.h:138
A discretized 2D grid representing light intensities over a simulation area.
Definition lights.h:20
Class representing a simulated Pogobot.
Definition robot.h:142
Configuration & get_config()
Retrieves the current configuration.
Definition simulator.cpp:1183
void speed_up()
Speeds up the simulation GUI.
Definition simulator.cpp:661
void speed_down()
Slows down the simulation GUI.
Definition simulator.cpp:667
void compute_neighbors()
Computes neighboring robots.
Definition simulator.cpp:800
void init_SDL()
Initializes SDL and related subsystems.
Definition simulator.cpp:478
Simulation(Configuration &_config)
Constructs a Simulation object.
Definition simulator.cpp:76
void init_config()
Initializes the simulation configuration.
Definition simulator.cpp:427
void init_all()
Initializes the simulation components.
Definition simulator.cpp:96
void main_loop()
Runs the main simulation loop.
Definition simulator.cpp:1025
uint32_t get_nb_robots() const
Returns the number of robots in the simulation.
Definition simulator.h:363
void handle_SDL_events()
Handles SDL events.
Definition simulator.cpp:696
DataLogger * get_data_logger()
Retrieves the data logger.
Definition simulator.cpp:1178
void draw_scale_bar()
Draws a scale bar on the GUI.
Definition simulator.cpp:888
void pause()
Toggles the simulation pause state.
Definition simulator.cpp:673
void create_walls()
Creates arena walls.
Definition simulator.cpp:367
boundary_condition_t const & get_boundary_condition()
Retrieve the arena boundary conditions.
Definition simulator.h:350
void init_data_logger()
Initializes the data logger.
Definition simulator.cpp:840
void help_message()
Displays a help message with GUI keyboard shortcuts.
Definition simulator.cpp:677
void init_box2d()
Initializes the Box2D world.
Definition simulator.cpp:418
void stop_simulation_main_loop()
Stops the main simulation loop.
Definition simulator.cpp:1163
void export_frames()
Exports the current frame to a PNG file.
Definition simulator.cpp:973
void apply_periodic_wrapping()
Wrap objects position to have period boundary conditions.
Definition simulator.cpp:643
virtual ~Simulation()
Destructor.
Definition simulator.cpp:84
void render_all()
Renders all simulation components.
Definition simulator.cpp:913
void init_callbacks()
Initializes simulation callbacks.
Definition simulator.cpp:836
void create_robots()
Creates the robot instances.
Definition simulator.cpp:584
void delete_old_data()
Deletes old data files.
Definition simulator.cpp:1167
void init_console_logger()
Initializes the console logger.
Definition simulator.cpp:876
void create_objects()
Creates objects in the simulation.
Definition simulator.cpp:103
arena_polygons_t const & get_arena_geometry()
Retrieve the arena geometry.
Definition simulator.h:343
void create_arena()
Creates the arena from a CSV file.
Definition simulator.cpp:249
LightLevelMap * get_light_map()
Retrieves the light map.
Definition simulator.cpp:1187
void export_data()
Exports simulation data from the current robot.
Definition simulator.cpp:991
bool current_robot_enable_data_logging
Flag to enable data logging on the current robot.
Definition simulator.h:127
std::vector< std::vector< b2Vec2 > > arena_polygons_t
Definition geometry.h:13
std::unique_ptr< Simulation > simulation
Global simulation instance.
Definition simulator.cpp:74
void set_current_robot(PogobotObject &robot)
Sets the current active robot.
Definition simulator.cpp:32
boundary_condition_t
Definition simulator.h:31
@ periodic
Definition simulator.h:31
@ solid
Definition simulator.h:31
void dummy_global_robot_init()
Definition simulator.cpp:30
int robot_main(void)
Main entry point for the robot code (C linkage).