![]() |
Galaxis Codebase
1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
|
#include <stdint.h>#include <stddef.h>#include <stdbool.h>#include "quadrature_counter.h"#include <util/firmware_settings.h>

Go to the source code of this file.
Macros | |
| #define | PACKET_ID_COMPUTER (0U) |
| #define | PACKET_ID_SETTINGS (1U) |
Typedefs | |
| typedef uint8_t | PacketId_t |
Functions | |
| struct | __attribute__ ((packed)) |
Variables | |
| SettingsPacket | |
| union { | |
| char wrong_offset_preamble [(offsetof(SettingsPacket, preamble)==0) ? 1 :-1] | |
| char wrong_offset_packet_id [(offsetof(SettingsPacket, packet_id)==8) ? 1 :-1] | |
| char wrong_offset_firmware [(offsetof(SettingsPacket, firmware)==8+1) ? 1 :-1] | |
| char wrong_offset_crc [(offsetof(SettingsPacket, crc)==8+1+32+3) ? 1 :-1] | |
| char wrong_sizeof_packet [((sizeof(SettingsPacket) > 4) &&(sizeof(SettingsPacket) % sizeof(uint32_t)==0)) ? 1 :-1] | |
| } | SettingsPacketTest |
| ComputerPacket | |
| union { | |
| char wrong_offset_preamble [(offsetof(ComputerPacket, preamble)==0) ? 1 :-1] | |
| char wrong_offset_packet_id [(offsetof(ComputerPacket, packet_id)==8) ? 1 :-1] | |
| char wrong_offset_motor_erpm [(offsetof(ComputerPacket, motor_erpm)==8+1) ? 1 :-1] | |
| char wrong_offset_motor_current [(offsetof(ComputerPacket, motor_current)==8+1+4) ? 1 :-1] | |
| char wrong_offset_servo_front [(offsetof(ComputerPacket, servo_front)==8+1+4+4) ? 1 :-1] | |
| char wrong_offset_servo_rear [(offsetof(ComputerPacket, servo_rear)==8+1+4+4+1) ? 1 :-1] | |
| char wrong_offset_lightState [(offsetof(ComputerPacket, lightState)==8+1+4+4+1+1) ? 1 :-1] | |
| char wrong_offset_brake [(offsetof(ComputerPacket, brake)==8+1+4+4+1+1+2) ? 1 :-1] | |
| char wrong_offset_padding [(offsetof(ComputerPacket, padding)==8+1+4+4+1+1+2+1) ? 1 :-1] | |
| char wrong_offset_crc [(offsetof(ComputerPacket, crc)==8+1+4+4+1+1+2+1+2) ? 1 :-1] | |
| char wrong_sizeof_packet [((sizeof(ComputerPacket) > 4) &&(sizeof(ComputerPacket) % sizeof(uint32_t)==0)) ? 1 :-1] | |
| } | ComputerPacketTest |
| EcuPacket | |
| union { | |
| char wrong_offset_preamble [(offsetof(EcuPacket, preamble)==0) ? 1 :-1] | |
| char wrong_offset_rc_active [(offsetof(EcuPacket, rc_active)==8) ? 1 :-1] | |
| char wrong_offset_motor_erpm [(offsetof(EcuPacket, motor_erpm)==8+1) ? 1 :-1] | |
| char wrong_offset_tof_right [(offsetof(EcuPacket, tof_right)==8+1+4) ? 1 :-1] | |
| char wrong_offset_tof_rear [(offsetof(EcuPacket, tof_rear)==8+1+4+2) ? 1 :-1] | |
| char wrong_offset_orientation [(offsetof(EcuPacket, orientation)==8+1+4+4) ? 1 :-1] | |
| char wrong_offset_linear_acceleration_x [(offsetof(EcuPacket, linear_acceleration_x)==8+1+4+4+4) ? 1 :-1] | |
| char wrong_offset_linear_acceleration_y [(offsetof(EcuPacket, linear_acceleration_y)==8+1+4+4+4+4) ? 1 :-1] | |
| char wrong_offset_linear_acceleration_z [(offsetof(EcuPacket, linear_acceleration_z)==8+1+4+4+4+4+4) ? 1 :-1] | |
| char wrong_offset_gyro_x [(offsetof(EcuPacket, gyro_x)==8+1+4+4+4+12) ? 1 :-1] | |
| char wrong_offset_buttonState [(offsetof(EcuPacket, buttonState)==8+1+4+4+4+12+4) ? 1 :-1] | |
| char wrong_offset_batteryLevel [(offsetof(EcuPacket, batteryLevel)==8+1+4+4+4+12+4+1) ? 1 :-1] | |
| char wrong_offset_batteryCellLevel [(offsetof(EcuPacket, batteryCellLevel)==8+1+4+4+4+12+4+1+2) ? 1 :-1] | |
| char wrong_offset_applied_servo_front [(offsetof(EcuPacket, applied_servo_front)==8+1+4+4+4+12+4+3+6) ? 1 :-1] | |
| char wrong_offset_applied_servo_rear [(offsetof(EcuPacket, applied_servo_rear)==8+1+4+4+4+12+4+3+6+1) ? 1 :-1] | |
| char wrong_offset_motor_duty_cycle [(offsetof(EcuPacket, motor_duty_cycle)==8+1+4+4+4+12+4+1+2+6+2) ? 1 :-1] | |
| char wrong_offset_applied_motor_current [(offsetof(EcuPacket, applied_motor_current)==8+1+4+4+4+12+4+1+2+6+2+4) ? 1 :-1] | |
| char wrong_offset_applied_motor_erpm [(offsetof(EcuPacket, applied_motor_erpm)==8+1+4+4+4+12+4+1+2+6+2+4+4) ? 1 :-1] | |
| char wrong_offset_applied_motor_brake [(offsetof(EcuPacket, applied_motor_brake)==8+1+4+4+4+12+4+1+2+6+2+4+4+4) ? 1 :-1] | |
| char wrong_offset_padding [(offsetof(EcuPacket, padding)==8+1+4+4+4+12+4+1+2+6+2+4+4+4+1) ? 1 :-1] | |
| char wrong_offset_crc [(offsetof(EcuPacket, crc)==8+1+4+4+4+12+4+1+2+6+2+4+4+4+4) ? 1 :-1] | |
| char wrong_sizeof_packet [((sizeof(EcuPacket) > 4) &&(sizeof(EcuPacket) % sizeof(uint32_t)==0)) ? 1 :-1] | |
| char wrong_sizeof_float [(sizeof(float)==4) ? 1 :-1] | |
| } | EcuPacketTest |
| #define PACKET_ID_COMPUTER (0U) |
Definition at line 12 of file Packets.hpp.
| #define PACKET_ID_SETTINGS (1U) |
Definition at line 13 of file Packets.hpp.
| typedef uint8_t PacketId_t |
Definition at line 11 of file Packets.hpp.
| struct __attribute__ | ( | (packed) | ) |
Speed value for the motor
This variable usually would be used for system identification
The motor current in Ampere
Servo values are between [-100,100]
Stores the states for car lights and scenario settings
There are 2 bits for the following states The order is the following: Bits: [13,12|11,10|9,8|7,6|5,4|3,2|1,0] [scenario3,scenario2,scenario1,brakes,blinkerRight,blinkerLeft,headlight]
Enable/Disable Brakes (1 for enable, 0 for disable, otherwise undefined)
the values of the quadrature counters
applied value at front servo
is in range of [-100,100]
applied value at rear servo
is in range of [-100,100]
The current duty Cycle for the motor
The current that is really applied to the motor.
Can come from the remote control or the computer settings depending on which one is active
the applied ERPM which overrides the motor current if != 0
boolean value which is 1 if brakes got applied
Definition at line 15 of file Packets.hpp.
References FirmwareSetup_t.
| ComputerPacket |
Definition at line 103 of file Packets.hpp.
Referenced by ECUHandler::calculateChecksum(), ECUNode::motion_callback(), and ECUHandler::TransmitPacket().
| union { ... } ComputerPacketTest |
| EcuPacket |
Definition at line 242 of file Packets.hpp.
Referenced by ECUHandler::ReceiveHandler().
| union { ... } EcuPacketTest |
| SettingsPacket |
Definition at line 31 of file Packets.hpp.
Referenced by ECUHandler::calculateChecksum(), ECUNode::settingsvalues_callback(), and ECUHandler::TransmitPacket().
| union { ... } SettingsPacketTest |
| char wrong_offset_applied_motor_brake[(offsetof(EcuPacket, applied_motor_brake)==8+1+4+4+4+12+4+1+2+6+2+4+4+4) ? 1 :-1] |
Definition at line 281 of file Packets.hpp.
| char wrong_offset_applied_motor_current[(offsetof(EcuPacket, applied_motor_current)==8+1+4+4+4+12+4+1+2+6+2+4) ? 1 :-1] |
Definition at line 277 of file Packets.hpp.
| char wrong_offset_applied_motor_erpm[(offsetof(EcuPacket, applied_motor_erpm)==8+1+4+4+4+12+4+1+2+6+2+4+4) ? 1 :-1] |
Definition at line 279 of file Packets.hpp.
| char wrong_offset_applied_servo_front[(offsetof(EcuPacket, applied_servo_front)==8+1+4+4+4+12+4+3+6) ? 1 :-1] |
Definition at line 272 of file Packets.hpp.
| char wrong_offset_applied_servo_rear[(offsetof(EcuPacket, applied_servo_rear)==8+1+4+4+4+12+4+3+6+1) ? 1 :-1] |
Definition at line 273 of file Packets.hpp.
| char wrong_offset_batteryCellLevel[(offsetof(EcuPacket, batteryCellLevel)==8+1+4+4+4+12+4+1+2) ? 1 :-1] |
Definition at line 270 of file Packets.hpp.
| char wrong_offset_batteryLevel[(offsetof(EcuPacket, batteryLevel)==8+1+4+4+4+12+4+1) ? 1 :-1] |
Definition at line 269 of file Packets.hpp.
| char wrong_offset_brake[(offsetof(ComputerPacket, brake)==8+1+4+4+1+1+2) ? 1 :-1] |
Definition at line 125 of file Packets.hpp.
| char wrong_offset_buttonState[(offsetof(EcuPacket, buttonState)==8+1+4+4+4+12+4) ? 1 :-1] |
Definition at line 267 of file Packets.hpp.
| char wrong_offset_crc[(offsetof(EcuPacket, crc)==8+1+4+4+4+12+4+1+2+6+2+4+4+4+4) ? 1 :-1] |
Definition at line 46 of file Packets.hpp.
| char wrong_offset_firmware[(offsetof(SettingsPacket, firmware)==8+1) ? 1 :-1] |
Definition at line 44 of file Packets.hpp.
| char wrong_offset_gyro_x[(offsetof(EcuPacket, gyro_x)==8+1+4+4+4+12) ? 1 :-1] |
Definition at line 265 of file Packets.hpp.
| char wrong_offset_lightState[(offsetof(ComputerPacket, lightState)==8+1+4+4+1+1) ? 1 :-1] |
Definition at line 123 of file Packets.hpp.
| char wrong_offset_linear_acceleration_x[(offsetof(EcuPacket, linear_acceleration_x)==8+1+4+4+4) ? 1 :-1] |
Definition at line 261 of file Packets.hpp.
| char wrong_offset_linear_acceleration_y[(offsetof(EcuPacket, linear_acceleration_y)==8+1+4+4+4+4) ? 1 :-1] |
Definition at line 262 of file Packets.hpp.
| char wrong_offset_linear_acceleration_z[(offsetof(EcuPacket, linear_acceleration_z)==8+1+4+4+4+4+4) ? 1 :-1] |
Definition at line 263 of file Packets.hpp.
| char wrong_offset_motor_current[(offsetof(ComputerPacket, motor_current)==8+1+4) ? 1 :-1] |
Definition at line 118 of file Packets.hpp.
| char wrong_offset_motor_duty_cycle[(offsetof(EcuPacket, motor_duty_cycle)==8+1+4+4+4+12+4+1+2+6+2) ? 1 :-1] |
Definition at line 275 of file Packets.hpp.
| char wrong_offset_motor_erpm[(offsetof(EcuPacket, motor_erpm)==8+1) ? 1 :-1] |
Definition at line 117 of file Packets.hpp.
| char wrong_offset_orientation[(offsetof(EcuPacket, orientation)==8+1+4+4) ? 1 :-1] |
Definition at line 259 of file Packets.hpp.
| char wrong_offset_packet_id[(offsetof(ComputerPacket, packet_id)==8) ? 1 :-1] |
Definition at line 42 of file Packets.hpp.
| char wrong_offset_padding[(offsetof(EcuPacket, padding)==8+1+4+4+4+12+4+1+2+6+2+4+4+4+1) ? 1 :-1] |
Definition at line 127 of file Packets.hpp.
| char wrong_offset_preamble[(offsetof(EcuPacket, preamble)==0) ? 1 :-1] |
Definition at line 40 of file Packets.hpp.
| char wrong_offset_rc_active[(offsetof(EcuPacket, rc_active)==8) ? 1 :-1] |
Definition at line 253 of file Packets.hpp.
| char wrong_offset_servo_front[(offsetof(ComputerPacket, servo_front)==8+1+4+4) ? 1 :-1] |
Definition at line 120 of file Packets.hpp.
| char wrong_offset_servo_rear[(offsetof(ComputerPacket, servo_rear)==8+1+4+4+1) ? 1 :-1] |
Definition at line 121 of file Packets.hpp.
| char wrong_offset_tof_rear[(offsetof(EcuPacket, tof_rear)==8+1+4+2) ? 1 :-1] |
Definition at line 257 of file Packets.hpp.
| char wrong_offset_tof_right[(offsetof(EcuPacket, tof_right)==8+1+4) ? 1 :-1] |
Definition at line 256 of file Packets.hpp.
| char wrong_sizeof_float[(sizeof(float)==4) ? 1 :-1] |
Definition at line 291 of file Packets.hpp.
| char wrong_sizeof_packet[((sizeof(EcuPacket) > 4) &&(sizeof(EcuPacket) % sizeof(uint32_t)==0)) ? 1 : -1] |
Definition at line 52 of file Packets.hpp.