From a0d6ed2e73da3d641fa9cd84aaef8b31c05de0bc Mon Sep 17 00:00:00 2001 From: Nicholas Witten Date: Sat, 5 Jul 2025 10:54:12 -0700 Subject: [PATCH 1/3] add image hash fields --- ateam-common-packets/include/extended_telemetry.h | 4 ++-- ateam-common-packets/include/kicker.h | 4 +++- ateam-common-packets/include/radio.h | 4 ++-- ateam-common-packets/include/stspin.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ateam-common-packets/include/extended_telemetry.h b/ateam-common-packets/include/extended_telemetry.h index effb9ac..32d5c6a 100644 --- a/ateam-common-packets/include/extended_telemetry.h +++ b/ateam-common-packets/include/extended_telemetry.h @@ -27,7 +27,7 @@ typedef struct ExtendedTelemetry { // 48 bytes each KickerTelemetry kicker_status; - // 60 bytes + // 64 bytes float imu_gyro[3]; // rad/s float imu_accel[3]; // m/s^2 @@ -43,4 +43,4 @@ typedef struct ExtendedTelemetry { float wheel_velocity_clamped_u[4]; // wheel velocities after control policy clamped for local acceleration limits /// 32 bytes } ExtendedTelemetry; -assert_size(ExtendedTelemetry, 28 + 192 + 60 + 24 + 48 + 32); +assert_size(ExtendedTelemetry, 28 + 192 + 64 + 24 + 48 + 32); diff --git a/ateam-common-packets/include/kicker.h b/ateam-common-packets/include/kicker.h index 0e58bdb..85acbb7 100644 --- a/ateam-common-packets/include/kicker.h +++ b/ateam-common-packets/include/kicker.h @@ -39,6 +39,8 @@ typedef struct KickerTelemetry { float rail_voltage; float battery_voltage; + unsigned char kicker_image_hash[4]; + MotorTelemetry dribbler_motor; } KickerTelemetry; -assert_size(KickerTelemetry, 60); \ No newline at end of file +assert_size(KickerTelemetry, 64); \ No newline at end of file diff --git a/ateam-common-packets/include/radio.h b/ateam-common-packets/include/radio.h index b5e7e48..f03b802 100644 --- a/ateam-common-packets/include/radio.h +++ b/ateam-common-packets/include/radio.h @@ -52,7 +52,7 @@ typedef union RadioData { ExtendedTelemetry extended_telemetry; ParameterCommand robot_parameter_command; } RadioData; -assert_size(RadioData, 384); +assert_size(RadioData, 388); typedef struct RadioPacket { uint32_t crc32; @@ -75,5 +75,5 @@ typedef struct RadioPacket { // I think this should be a valid swap when we clean packet definitions in the future // RadioData data __attribute__((aligned (4))); } RadioPacket; -assert_size(RadioPacket, 396); +assert_size(RadioPacket, 400); static_assert(sizeof(RadioPacket) <= 448); // 512 is the current size limit of an entry in the packet buffer diff --git a/ateam-common-packets/include/stspin.h b/ateam-common-packets/include/stspin.h index 4d00026..9a79e87 100644 --- a/ateam-common-packets/include/stspin.h +++ b/ateam-common-packets/include/stspin.h @@ -113,7 +113,7 @@ typedef struct ParameterMotorResponse { uint16_t cur_clamp; uint16_t _reserved; - unsigned char wheel_img_hash[4]; + unsigned char firmware_img_hash[4]; } __attribute__((packed)) ParameterMotorResponse; assert_size(ParameterMotorResponse, 48); // Note: Same length as MotorResponse_Params_Packet From c24fd92f12cb9570acfcca8c2c4cd78bc0e6afb4 Mon Sep 17 00:00:00 2001 From: Nicholas Witten Date: Wed, 16 Jul 2025 13:24:06 -0300 Subject: [PATCH 2/3] add ErrorTelemetry packet --- .../include/error_telemetry.h | 20 +++++++++++++++++++ ateam-common-packets/include/radio.h | 3 +++ ateam-common-packets/rust-lib/src/radio.rs | 9 +++++++++ 3 files changed, 32 insertions(+) create mode 100644 ateam-common-packets/include/error_telemetry.h diff --git a/ateam-common-packets/include/error_telemetry.h b/ateam-common-packets/include/error_telemetry.h new file mode 100644 index 0000000..38591e0 --- /dev/null +++ b/ateam-common-packets/include/error_telemetry.h @@ -0,0 +1,20 @@ +/** + * @file error_telemetry.h + * @author Nicholas Witten / Joseph Spall + * @brief Simple error messages over radio + * @version 0.1 + * + * @copyright Copyright (c) 2022 + * + */ + +#pragma once + +#include "common.h" + +typedef struct ErrorTelemetry { + uint32_t timestamp; + unsigned char error_message[60]; +} ErrorTelemetry; +assert_size(ErrorTelemetry, 64); + diff --git a/ateam-common-packets/include/radio.h b/ateam-common-packets/include/radio.h index f03b802..aac1791 100644 --- a/ateam-common-packets/include/radio.h +++ b/ateam-common-packets/include/radio.h @@ -14,6 +14,7 @@ #include "hello_data.h" #include "basic_control.h" #include "basic_telemetry.h" +#include "error_telemetry.h" #include "extended_telemetry.h" #include "power.h" #include "robot_parameters.h" @@ -30,6 +31,7 @@ typedef enum CommandCode : uint8_t { CC_TELEMETRY = 102, CC_CONTROL_DEBUG_TELEMETRY = 103, CC_ROBOT_PARAMETER_COMMAND = 104, + CC_ERROR_TELEMETRY = 105, CC_CONTROL = 201, CC_HELLO_RESP = 202, } CommandCode; @@ -69,6 +71,7 @@ typedef struct RadioPacket { BasicControl control; BasicTelemetry telemetry; ExtendedTelemetry control_debug_telemetry; + ErrorTelemetry error_telemetry; ParameterCommand robot_parameter_command; } data __attribute__((aligned (4))); diff --git a/ateam-common-packets/rust-lib/src/radio.rs b/ateam-common-packets/rust-lib/src/radio.rs index 97a7738..cfa80c0 100644 --- a/ateam-common-packets/rust-lib/src/radio.rs +++ b/ateam-common-packets/rust-lib/src/radio.rs @@ -11,4 +11,13 @@ pub enum TelemetryPacket { Basic(crate::bindings::BasicTelemetry), Extended(crate::bindings::ExtendedTelemetry), ParameterCommandResponse(crate::bindings::ParameterCommand), + ErrorTelemetry(crate::bindings::ErrorTelemetry), +} + +#[derive(Copy, Clone)] +pub enum ParameterType { + Basic(crate::bindings::BasicTelemetry), + Extended(crate::bindings::ExtendedTelemetry), + ParameterCommandResponse(crate::bindings::ParameterCommand), + ErrorTelemetry(crate::bindings::ErrorTelemetry), } \ No newline at end of file From 0fc77eee7b20b4113e452816be8dd7bc42609f21 Mon Sep 17 00:00:00 2001 From: Nicholas Witten Date: Wed, 16 Jul 2025 21:36:08 -0300 Subject: [PATCH 3/3] add dribbler_multiplier --- ateam-common-packets/include/basic_control.h | 3 ++- ateam-common-packets/include/kicker.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ateam-common-packets/include/basic_control.h b/ateam-common-packets/include/basic_control.h index df7626f..f51bd26 100644 --- a/ateam-common-packets/include/basic_control.h +++ b/ateam-common-packets/include/basic_control.h @@ -21,7 +21,8 @@ typedef struct BasicControl { uint32_t body_vel_controls_enabled : 1; uint32_t wheel_vel_control_enabled : 1; uint32_t wheel_torque_control_enabled : 1; - uint32_t _reserved : 17; + uint32_t dribbler_multiplier : 8; + uint32_t _reserved : 9; uint32_t play_song : 8; float vel_x_linear; // m/s diff --git a/ateam-common-packets/include/kicker.h b/ateam-common-packets/include/kicker.h index 85acbb7..9583b04 100644 --- a/ateam-common-packets/include/kicker.h +++ b/ateam-common-packets/include/kicker.h @@ -18,7 +18,8 @@ typedef struct KickerControl { uint32_t telemetry_enabled: 1; uint32_t enable_charging: 1; uint32_t request_power_down: 1; - // 29 bits reserved + uint32_t dribbler_mult: 8; + // 21 bits reserved KickRequest kick_request; float kick_speed;