#include <iostream>#include <thread>#include <chrono>#include <cstdarg>#include <sstream>#include <string>#include <cstring>#include <cstdlib>#include <cstdint>#include "SDL2_gfxPrimitives.h"#include "spogobot.h"#include "robot.h"#include "pogosim.h"#include "simulator.h"#include "version.h"Functions | |
| uint64_t | get_current_time_microseconds () |
| Retrieves the current time in microseconds. | |
| std::string | log_current_robot () |
| Returns a log string for the current robot. | |
| void | pogobot_init () |
| void | pogobot_infrared_ll_init (void) |
| void | pogobot_infrared_update (void) |
| int | pogobot_infrared_message_available (void) |
| void | pogobot_infrared_recover_next_message (message_t *mes) |
| void | pogobot_infrared_clear_message_queue (void) |
| void | pogobot_infrared_set_power (uint8_t power) |
| uint32_t | pogobot_infrared_sendRawLongMessage (message_t *const message) |
| uint32_t | pogobot_infrared_sendRawShortMessage (ir_direction dir, short_message_t *const message) |
| uint32_t | pogobot_infrared_sendLongMessage_uniSpe (ir_direction dir, uint8_t *message, uint16_t message_size) |
| uint32_t | pogobot_infrared_sendLongMessage_omniGen (uint8_t *message, uint16_t message_size) |
| uint32_t | pogobot_infrared_sendLongMessage_omniSpe (uint8_t *message, uint16_t message_size) |
| uint32_t | pogobot_infrared_sendShortMessage_uni (ir_direction dir, uint8_t *message, uint16_t message_size) |
| uint32_t | pogobot_infrared_sendShortMessage_omni (uint8_t *message, uint16_t message_size) |
| void | pogobot_infrared_get_receiver_error_counter (slip_error_counter_s *error_counter, uint8_t ir_index) |
| void | pogobot_infrared_reset_receiver_error_counter (void) |
| void | pogobot_led_setColor (const uint8_t r, const uint8_t g, const uint8_t b) |
| void | pogobot_led_setColors (const uint8_t r, const uint8_t g, const uint8_t b, uint8_t id) |
| int16_t | pogobot_photosensors_read (uint8_t sensor_number) |
| void | pogobot_imu_read (float *acc, float *gyro) |
| float | pogobot_imu_readTemp (void) |
| int16_t | pogobot_battery_voltage_read (void) |
| void | pogobot_motor_power_set (motor_id motor, uint16_t value) |
| void | pogobot_motor_set (motor_id motor, uint16_t value) |
| uint32_t | pogobot_motor_dir_current_status (void) |
| int8_t | pogobot_motor_dir_mem_get (uint8_t *p_directions) |
| int8_t | pogobot_motor_dir_mem_set (uint8_t *p_directions) |
| void | pogobot_motor_dir_set (motor_id motor, uint8_t value) |
| uint8_t | pogobot_motor_power_mem_get (uint16_t *p_powers) |
| uint8_t | pogobot_motor_power_mem_set (uint16_t *p_powers) |
| uint16_t | pogobot_helper_getid (void) |
| int16_t | pogobot_helper_getRandSeed (void) |
| void | pogobot_helper_print_version (void) |
| void | pli_timer_sleep_stopwatch_init (void) |
| void | pogobot_stopwatch_reset (time_reference_t *stopwatch) |
| int32_t | pogobot_stopwatch_lap (time_reference_t *stopwatch) |
| int32_t | pogobot_stopwatch_get_elapsed_microseconds (time_reference_t *stopwatch) |
| void | pogobot_stopwatch_offset_origin_microseconds (time_reference_t *stopwatch, int32_t microseconds_offset) |
| void | pogobot_timer_init (time_reference_t *timer, int32_t microseconds_to_go) |
| int32_t | pogobot_timer_get_remaining_microseconds (time_reference_t *timer) |
| bool | pogobot_timer_has_expired (time_reference_t *timer) |
| void | pogobot_timer_wait_for_expiry (time_reference_t *timer) |
| void | pogobot_timer_offset_origin_microseconds (time_reference_t *timer, int32_t microseconds_offset) |
| void | msleep (int milliseconds) |
| std::string | _format_args_to_string (const char *format, va_list args) |
| void | pogosim_printf (const char *format,...) |
| int | pogosim_putchar (int ch) |
| uint32_t | get_nb_robots (void) |
| void | stop_simulation (void) |
| void | enable_data_export (void) |
| void | disable_data_export (void) |
| void | data_add_column_int8 (char const *name) |
| void | data_add_column_int16 (char const *name) |
| void | data_add_column_int32 (char const *name) |
| void | data_add_column_int64 (char const *name) |
| void | data_add_column_double (char const *name) |
| void | data_add_column_string (char const *name) |
| void | data_add_column_bool (char const *name) |
| void | data_add_column_float16 (char const *name) |
| void | data_set_value_int8 (char const *name, int8_t value) |
| void | data_set_value_int16 (char const *name, int16_t value) |
| void | data_set_value_int32 (char const *name, int32_t value) |
| void | data_set_value_int64 (char const *name, int64_t value) |
| void | data_set_value_double (char const *name, double value) |
| void | data_set_value_string (char const *name, char const *value) |
| void | data_set_value_bool (char const *name, bool value) |
| void | data_set_value_float16 (char const *name, float value) |
| void | init_bool_from_configuration (bool *var, char const *name, bool const default_value) |
| void | init_double_from_configuration (double *var, char const *name, double const default_value) |
| void | init_float_from_configuration (float *var, char const *name, float const default_value) |
| void | init_int32_from_configuration (int32_t *var, char const *name, int32_t const default_value) |
| void | init_uint32_from_configuration (uint32_t *var, char const *name, uint32_t const default_value) |
| void | init_int16_from_configuration (int16_t *var, char const *name, int16_t const default_value) |
| void | init_uint16_from_configuration (uint16_t *var, char const *name, uint16_t const default_value) |
| void | init_int8_from_configuration (int8_t *var, char const *name, int8_t const default_value) |
| void | init_uint8_from_configuration (uint8_t *var, char const *name, uint8_t const default_value) |
| void | init_string_from_configuration (char *var, char const *name, std::size_t size) |
| void | init_float_array_from_configuration (float *var, char const *name, size_t const size) |
| void | init_double_array_from_configuration (double *var, char const *name, size_t const size) |
Variables | |
| uint8_t const | _selected_power = 1 |
| slip_error_counter_s | _slip_error_counter = {0, 0, 0} |
| std::string _format_args_to_string | ( | const char * | format, |
| va_list | args ) |
| void data_add_column_bool | ( | char const * | name | ) |
| void data_add_column_double | ( | char const * | name | ) |
| void data_add_column_float16 | ( | char const * | name | ) |
| void data_add_column_int16 | ( | char const * | name | ) |
| void data_add_column_int32 | ( | char const * | name | ) |
| void data_add_column_int64 | ( | char const * | name | ) |
| void data_add_column_int8 | ( | char const * | name | ) |
| void data_add_column_string | ( | char const * | name | ) |
| void data_set_value_bool | ( | char const * | name, |
| bool | value ) |
| void data_set_value_double | ( | char const * | name, |
| double | value ) |
| void data_set_value_float16 | ( | char const * | name, |
| float | value ) |
| void data_set_value_int16 | ( | char const * | name, |
| int16_t | value ) |
| void data_set_value_int32 | ( | char const * | name, |
| int32_t | value ) |
| void data_set_value_int64 | ( | char const * | name, |
| int64_t | value ) |
| void data_set_value_int8 | ( | char const * | name, |
| int8_t | value ) |
| void data_set_value_string | ( | char const * | name, |
| char const * | value ) |
| void disable_data_export | ( | void | ) |
| void enable_data_export | ( | void | ) |
| uint64_t get_current_time_microseconds | ( | ) |
Retrieves the current time in microseconds.
Computes and returns the current simulation time in microseconds.
| uint32_t get_nb_robots | ( | void | ) |
| void init_bool_from_configuration | ( | bool * | var, |
| char const * | name, | ||
| bool const | default_value ) |
| void init_double_array_from_configuration | ( | double * | var, |
| char const * | name, | ||
| size_t const | size ) |
| void init_double_from_configuration | ( | double * | var, |
| char const * | name, | ||
| double const | default_value ) |
| void init_float_array_from_configuration | ( | float * | var, |
| char const * | name, | ||
| size_t const | size ) |
| void init_float_from_configuration | ( | float * | var, |
| char const * | name, | ||
| float const | default_value ) |
| void init_int16_from_configuration | ( | int16_t * | var, |
| char const * | name, | ||
| int16_t const | default_value ) |
| void init_int32_from_configuration | ( | int32_t * | var, |
| char const * | name, | ||
| int32_t const | default_value ) |
| void init_int8_from_configuration | ( | int8_t * | var, |
| char const * | name, | ||
| int8_t const | default_value ) |
| void init_string_from_configuration | ( | char * | var, |
| char const * | name, | ||
| std::size_t | size ) |
Initialise a fixed-size C string from the configuration.
| var | Destination buffer supplied by the caller. |
| name | Parameter name (same token the macro turns into a string). |
| size | Capacity of var in bytes (including the final '\0'). |
The current contents of var are treated as the default value, so callers can write char run_law[128] = "levy"; and get an automatic fallback when the key is absent or invalid.
The result is always NUL-terminated, even when the configured value is longer than the buffer.
| void init_uint16_from_configuration | ( | uint16_t * | var, |
| char const * | name, | ||
| uint16_t const | default_value ) |
| void init_uint32_from_configuration | ( | uint32_t * | var, |
| char const * | name, | ||
| uint32_t const | default_value ) |
| void init_uint8_from_configuration | ( | uint8_t * | var, |
| char const * | name, | ||
| uint8_t const | default_value ) |
| std::string log_current_robot | ( | ) |
Returns a log string for the current robot.
This function gathers and returns a string containing relevant log information for the currently active robot.
| void msleep | ( | int | milliseconds | ) |
| int16_t pogobot_helper_getRandSeed | ( | void | ) |
| void pogobot_helper_print_version | ( | void | ) |
| float pogobot_imu_readTemp | ( | void | ) |
| void pogobot_infrared_clear_message_queue | ( | void | ) |
| void pogobot_infrared_get_receiver_error_counter | ( | slip_error_counter_s * | error_counter, |
| uint8_t | ir_index ) |
(pogobot_infrared_get_receiver_error_counter) Get the receiver error counter value
| int pogobot_infrared_message_available | ( | void | ) |
| void pogobot_infrared_recover_next_message | ( | message_t * | mes | ) |
(pogobot_infrared_recover_next_message) Recover the next message inside the message queue
| void pogobot_infrared_reset_receiver_error_counter | ( | void | ) |
| uint32_t pogobot_infrared_sendLongMessage_omniGen | ( | uint8_t * | message, |
| uint16_t | message_size ) |
(pogobot_infrared_sendLongMessage_omniGen) Send the same message in all direction at defined power Use pogobot_infrared_sendRawLongMessage Their no infrared sender ID
| uint32_t pogobot_infrared_sendLongMessage_omniSpe | ( | uint8_t * | message, |
| uint16_t | message_size ) |
(pogobot_infrared_sendLongMessage_omniSpe) Send successively the same message with the origin infrared ID on each Infrared It is 4 times slower that without ID Use pogobot_infrared_sendRawLongMessage
| uint32_t pogobot_infrared_sendLongMessage_uniSpe | ( | ir_direction | dir, |
| uint8_t * | message, | ||
| uint16_t | message_size ) |
(pogobot_infrared_sendLongMessage_uniSpe) Send a message in only direction at defined power Use pogobot_infrared_sendRawLongMessage
| uint32_t pogobot_infrared_sendRawLongMessage | ( | message_t *const | message | ) |
(pogobot_infrared_sendRawLongMessage) Prepare and send one packet, with the specified emitters and powers, to the recipient, containing the specified message.
| uint32_t pogobot_infrared_sendRawShortMessage | ( | ir_direction | dir, |
| short_message_t *const | message ) |
(pogobot_infrared_sendRawShortMessage) Prepare and send one packet, with a short header containing the specified message.
| uint32_t pogobot_infrared_sendShortMessage_omni | ( | uint8_t * | message, |
| uint16_t | message_size ) |
| uint32_t pogobot_infrared_sendShortMessage_uni | ( | ir_direction | dir, |
| uint8_t * | message, | ||
| uint16_t | message_size ) |
(pogobot_infrared_sendShortMessage_uni) Send a short header message in only direction at defined power Use pogobot_infrared_sendRawShortMessage
| void pogobot_infrared_set_power | ( | uint8_t | power | ) |
| void pogobot_infrared_update | ( | void | ) |
| void pogobot_init | ( | void | ) |
| void pogobot_led_setColors | ( | const uint8_t | r, |
| const uint8_t | g, | ||
| const uint8_t | b, | ||
| uint8_t | id ) |
(pogobot_led_setColors) Set the value of red, green and blue of the led with the number (ID) in static mode each value goes from 0 to 255 to determine the intensity. (only available with a belly with multiple LEDs)
| uint32_t pogobot_motor_dir_current_status | ( | void | ) |
| int8_t pogobot_motor_dir_mem_get | ( | uint8_t * | p_directions | ) |
| int8_t pogobot_motor_dir_mem_set | ( | uint8_t * | p_directions | ) |
| void pogobot_motor_dir_set | ( | motor_id | motor, |
| uint8_t | value ) |
| uint8_t pogobot_motor_power_mem_get | ( | uint16_t * | p_powers | ) |
| uint8_t pogobot_motor_power_mem_set | ( | uint16_t * | p_powers | ) |
| void pogobot_motor_power_set | ( | motor_id | motor, |
| uint16_t | value ) |
| void pogobot_motor_set | ( | motor_id | motor, |
| uint16_t | value ) |
| int32_t pogobot_stopwatch_get_elapsed_microseconds | ( | time_reference_t * | stopwatch | ) |
(pogobot_stopwatch_get_elapsed_microseconds) provides the current number of elapsed microseconds without otherwise interfering with the stopwatch state.
Returns the number of microseconds elapsed on 32 bits (which may be negative if you offset the origin to the future)
| int32_t pogobot_stopwatch_lap | ( | time_reference_t * | stopwatch | ) |
(pogobot_stopwatch_lap) measures time elapsed from origin and offsets so that origin is zero at this point in time.
Returns the number of microseconds elapsed on 32 bits (which may be negative if you offset the origin to the future)
| void pogobot_stopwatch_offset_origin_microseconds | ( | time_reference_t * | stopwatch, |
| int32_t | microseconds_offset ) |
(pogobot_stopwatch_offset_origin_microseconds) offsets the origin of the stopwatch by the specified number of microseconds.
| void pogobot_stopwatch_reset | ( | time_reference_t * | stopwatch | ) |
(pogobot_stopwatch_reset) reset a time_reference structure. To use a time_reference_t as a stopwatch you must reset it using pogobot_stopwatch_reset()
| int32_t pogobot_timer_get_remaining_microseconds | ( | time_reference_t * | timer | ) |
(pogobot_timer_get_remaining_microseconds) provides the current of microseconds until the timer has expired, without otherwise interfering with the timer state.
Returns the number of microseconds elapsed on 32 bits. The result is a signed number, positive when the timer has not expired yet, negative when the timer has expired.
| bool pogobot_timer_has_expired | ( | time_reference_t * | timer | ) |
(pogobot_timer_has_expired) Returns true when the timer has expired, false when the timer has not expired yet.
Returns a bool depending on the status (True: if expired, False: if not expired)
| void pogobot_timer_init | ( | time_reference_t * | timer, |
| int32_t | microseconds_to_go ) |
(pogobot_timer_init) set a timer that will expire in the defined number of microseconds in the future.
| void pogobot_timer_offset_origin_microseconds | ( | time_reference_t * | timer, |
| int32_t | microseconds_offset ) |
(pogobot_timer_offset_origin_microseconds) offsets the origin of the timer by the specified number of microseconds.
| void pogobot_timer_wait_for_expiry | ( | time_reference_t * | timer | ) |
(pogobot_timer_wait_for_expiry) waits until the timer has expired.
| void pogosim_printf | ( | const char * | format, |
| ... ) |
| int pogosim_putchar | ( | int | ch | ) |
| void stop_simulation | ( | void | ) |
(stop_simulation) Stops the simulation
| uint8_t const _selected_power = 1 |
| slip_error_counter_s _slip_error_counter = {0, 0, 0} |