Formula Student Electronics & Software
The code for the embedded software
|
Class that contains definitions of typical messages to send via CAN It serves only as an example of the usage of the strategy pattern, where the communicator is the strategy. More...
#include <communicator.hpp>
Public Member Functions | |
Communicator (SystemData *systemdata) | |
Constructor for the Communicator class Initializes the Communicator with the given system data instance. | |
void | init () |
Initializes the CAN bus. | |
Static Public Member Functions | |
static void | parse_message (const CAN_message_t &msg) |
Parses the message received from the CAN bus. | |
template<std::size_t N> | |
static int | send_message (unsigned len, const std::array< uint8_t, N > &buffer, unsigned id) |
Sends a message to the CAN bus. | |
static void | pc_callback (const uint8_t *buf) |
Callback for message from AS CU. | |
static void | res_state_callback (const uint8_t *buf) |
Callback RES default callback. | |
static void | res_ready_callback () |
Callback for RES activation. | |
static void | bamocar_callback (const uint8_t *buf) |
Callback from inversor, for alive signal and data. | |
static void | steering_callback () |
Callback for steering actuator information. | |
static void | dash_callback (const uint8_t *buf) |
Callback for dashboard. | |
static void | bms_callback (const uint8_t *buf) |
Callback for BMS messages. | |
static int | publish_state (int state_id) |
Publish AS State to CAN. | |
static int | publish_ebs_states (uint8_t ebs_state, bool is_redundancy=false) |
Publish EBS States to CAN. | |
static int | publish_mission (int mission_id) |
Publish AS Mission to CAN. | |
static int | publish_soc (uint8_t soc) |
Publish SOC to CAN. | |
static int | publish_asms_on (bool asms_on) |
Publish ASMS state to CAN. | |
static int | publish_debug_morning_log (const SystemData &system_data, uint8_t sate, uint8_t state_checkup) |
Publish AS Mission to CAN. | |
static int | publish_rpm () |
Publish rl wheel rpm to CAN. | |
Static Public Attributes | |
static SystemData * | _systemData = nullptr |
Class that contains definitions of typical messages to send via CAN It serves only as an example of the usage of the strategy pattern, where the communicator is the strategy.
Definition at line 42 of file communicator.hpp.
|
inlineexplicit |
Constructor for the Communicator class Initializes the Communicator with the given system data instance.
system_data | Pointer to the SystemData instance. |
Definition at line 146 of file communicator.hpp.
|
inlinestatic |
Callback from inversor, for alive signal and data.
Definition at line 199 of file communicator.hpp.
|
inlinestatic |
Callback for BMS messages.
Definition at line 250 of file communicator.hpp.
|
inlinestatic |
Callback for dashboard.
Definition at line 245 of file communicator.hpp.
void Communicator::init | ( | ) |
Initializes the CAN bus.
Definition at line 148 of file communicator.hpp.
|
inlinestatic |
Parses the message received from the CAN bus.
Definition at line 254 of file communicator.hpp.
|
inlinestatic |
Callback for message from AS CU.
Definition at line 229 of file communicator.hpp.
|
inlinestatic |
Publish ASMS state to CAN.
Definition at line 307 of file communicator.hpp.
|
inlinestatic |
Publish AS Mission to CAN.
Definition at line 292 of file communicator.hpp.
|
inlinestatic |
Publish EBS States to CAN.
Definition at line 337 of file communicator.hpp.
|
inlinestatic |
Publish AS Mission to CAN.
Definition at line 286 of file communicator.hpp.
|
inlinestatic |
Publish rl wheel rpm to CAN.
Definition at line 313 of file communicator.hpp.
|
inlinestatic |
Publish SOC to CAN.
Definition at line 301 of file communicator.hpp.
|
inlinestatic |
Publish AS State to CAN.
Definition at line 280 of file communicator.hpp.
|
inlinestatic |
Callback for RES activation.
Definition at line 192 of file communicator.hpp.
|
inlinestatic |
Callback RES default callback.
Definition at line 165 of file communicator.hpp.
|
inlinestatic |
Sends a message to the CAN bus.
len | Length of the message |
buffer | Buffer containing the message |
id | ID of the message |
Definition at line 355 of file communicator.hpp.
|
inlinestatic |
Callback for steering actuator information.
Definition at line 241 of file communicator.hpp.
|
inlinestatic |
Definition at line 49 of file communicator.hpp.