UAVCAN: format uORB docu, disable not needed features, clean-up

This commit is contained in:
Alexander Lerach
2026-01-27 11:26:37 +01:00
parent 59b4b777e5
commit 50ae022a80
5 changed files with 61 additions and 60 deletions
+22 -15
View File
@@ -1,25 +1,32 @@
uint64 timestamp # time since system start (microseconds)
uint8 servo_actuator_id # actuator id of current servo (in most cases 1-8)
uint8 servo_node_id # Node ID of device on CAN bus
float32 servo_position # meter or radian
float32 servo_force # Newton or Newton metre
float32 servo_speed # meter per second or radian per second
uint8 servo_power_rating_pct # 0 - unloaded, 100 - full load
# Servo report
#
# Contains information about a specific servo (position, force, speed, load).
# Also contains auxiliary power data (voltage, current) and temperature.
uint8 servo_function # servo output function
uint64 timestamp # [us] Time since system start
uint16 servo_temperature_counter # Incremented when new temperature data is stored
float32 servo_temperature # in kelvin
uint8 servo_temperature_error_flags
uint8 actuator_id # [-] DroneCAN actuator id of servo. Set to 0 for non DroneCAN servos
uint8 node_id # [-] DroneCAN node id of servo. Set to 0 for non DroneCAN servos
float32 position # meter or radian
float32 force # Newton or Newton metre
float32 speed # meter per second or radian per second
float32 power_rating_pct # [%] [@range 0, 100] Servo load
uint8 function # [-] Servo output function
uint16 temperature_counter # [-] Incremented when temperature data got updated
float32 temperature # [degC] Servo temperature.
uint8 temperature_error_flags # [@enum ERROR_FLAG] Temperature error flags
uint8 ERROR_FLAG_OVERHEATING = 1
uint8 ERROR_FLAG_OVERCOOLING = 2
uint16 servo_power_counter # Incremented when new power data is stored
float32 servo_voltage # Volts
float32 servo_current # Amps
uint8 servo_power_error_flags
uint16 power_counter # [-] Incremented when power data got updated
float32 voltage # [V] Servo voltage
float32 current # [A] Servo current draw
uint8 power_error_flags # [@enum ERROR_FLAG] Power error flags
uint8 ERROR_FLAG_OVERVOLTAGE = 1
uint8 ERROR_FLAG_UNDERVOLTAGE = 2
uint8 ERROR_FLAG_OVERCURRENT = 4
+16 -21
View File
@@ -1,26 +1,21 @@
uint64 timestamp # time since system start (microseconds)
uint8 CONNECTED_SERVO_MAX = 8 # The number of SERVOs supported via UAVCAN
# Servo status
#
# Overview message that contains general information about all servos.
# In addition it contains the reports of all individual servos.
uint8 SERVO_CONNECTION_TYPE_PPM = 0 # Traditional PPM SERVO
uint8 SERVO_CONNECTION_TYPE_SERIAL = 1 # Serial Bus connected SERVO
uint8 SERVO_CONNECTION_TYPE_ONESHOT = 2 # One Shot PPM
uint8 SERVO_CONNECTION_TYPE_I2C = 3 # I2C
uint8 SERVO_CONNECTION_TYPE_CAN = 4 # CAN-Bus
uint8 SERVO_CONNECTION_TYPE_DSHOT = 5 # DShot
uint64 timestamp # [us] Time since system start
uint16 counter # incremented by the writing thread everytime new data is stored
uint8 servo_count # number of connected servo's
uint8 count # [-] Number of connected servos
uint8 CONNECTED_SERVO_MAX = 8
uint8 servo_connectiontype # how SERVOs connected to the system. Currently only CAN supports servo telemtry
uint8 servo_online_flags # Bitmask indicating which SERVO is online/offline
# servo_online_flags bit 0 : Set to 1 if SERVO0 is online
# servo_online_flags bit 1 : Set to 1 if SERVO1 is online
# servo_online_flags bit 2 : Set to 1 if SERVO2 is online
# servo_online_flags bit 3 : Set to 1 if SERVO3 is online
# servo_online_flags bit 4 : Set to 1 if SERVO4 is online
# servo_online_flags bit 5 : Set to 1 if SERVO5 is online
# servo_online_flags bit 6 : Set to 1 if SERVO6 is online
# servo_online_flags bit 7 : Set to 1 if SERVO7 is online
uint8 online_flags # [-] Bitmask indicating which servo is online/offline
# online_flags bit 0 : Set to 1 if SERVO0 is online
# online_flags bit 1 : Set to 1 if SERVO1 is online
# online_flags bit 2 : Set to 1 if SERVO2 is online
# online_flags bit 3 : Set to 1 if SERVO3 is online
# online_flags bit 4 : Set to 1 if SERVO4 is online
# online_flags bit 5 : Set to 1 if SERVO5 is online
# online_flags bit 6 : Set to 1 if SERVO6 is online
# online_flags bit 7 : Set to 1 if SERVO7 is online
ServoReport[8] servo
+21 -22
View File
@@ -34,6 +34,7 @@
#include "servo.hpp"
#include <systemlib/err.h>
#include <drivers/drv_hrt.h>
#include <lib/atmosphere/atmosphere.h>
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
@@ -131,12 +132,12 @@ UavcanServoController::servo_temperature_sub_cb(const
for (int i = 0; i < servo_status_s::CONNECTED_SERVO_MAX; i++) {
auto &ref = _servo_status.servo[i];
const bool is_servo_online = _servo_status.servo_online_flags & (1 << i);
const bool is_servo_matching = ref.servo_node_id == msg.getSrcNodeID().get();
const bool is_servo_online = _servo_status.online_flags & (1 << i);
const bool is_servo_matching = ref.node_id == msg.getSrcNodeID().get();
if (is_servo_online && is_servo_matching) {
_servo_temperature_counter[i] += 1;
_last_temperature[i] = msg.temperature;
_last_temperature[i] = msg.temperature + atmosphere::kAbsoluteNullCelsius; // Kelvin to Celsius;
_last_temperature_error_flag[i] = msg.error_flags;
break;
}
@@ -151,8 +152,8 @@ UavcanServoController::servo_circuit_status_sub_cb(const
for (int i = 0; i < servo_status_s::CONNECTED_SERVO_MAX; i++) {
auto &ref = _servo_status.servo[i];
const bool is_servo_online = _servo_status.servo_online_flags & (1 << i);
const bool is_servo_matching = ref.servo_node_id == msg.getSrcNodeID().get();
const bool is_servo_online = _servo_status.online_flags & (1 << i);
const bool is_servo_matching = ref.node_id == msg.getSrcNodeID().get();
if (is_servo_online && is_servo_matching) {
_servo_power_counter[i] += 1;
@@ -172,28 +173,26 @@ UavcanServoController::servo_status_sub_cb(const uavcan::ReceivedDataStructure<u
auto &ref = _servo_status.servo[msg.actuator_id];
ref.timestamp = hrt_absolute_time();
ref.servo_node_id = msg.getSrcNodeID().get();
ref.servo_actuator_id = msg.actuator_id;
ref.servo_position = msg.position;
ref.servo_force = msg.force;
ref.servo_speed = msg.speed;
ref.servo_power_rating_pct = msg.power_rating_pct;
ref.node_id = msg.getSrcNodeID().get();
ref.actuator_id = msg.actuator_id;
ref.position = msg.position;
ref.force = msg.force;
ref.speed = msg.speed;
ref.power_rating_pct = msg.power_rating_pct;
// Add servo temperature data
ref.servo_temperature_counter = _servo_temperature_counter[msg.actuator_id];
ref.servo_temperature = _last_temperature[msg.actuator_id];
ref.servo_temperature_error_flags = _last_temperature_error_flag[msg.actuator_id];
ref.temperature_counter = _servo_temperature_counter[msg.actuator_id];
ref.temperature = _last_temperature[msg.actuator_id];
ref.temperature_error_flags = _last_temperature_error_flag[msg.actuator_id];
// Add servo power data
ref.servo_power_counter = _servo_power_counter[msg.actuator_id];
ref.servo_voltage = _last_voltage[msg.actuator_id];
ref.servo_current = _last_current[msg.actuator_id];
ref.servo_power_error_flags = _last_power_error_flag[msg.actuator_id];
ref.power_counter = _servo_power_counter[msg.actuator_id];
ref.voltage = _last_voltage[msg.actuator_id];
ref.current = _last_current[msg.actuator_id];
ref.power_error_flags = _last_power_error_flag[msg.actuator_id];
_servo_status.counter += 1;
_servo_status.servo_count = _servo_count;
_servo_status.servo_connectiontype = servo_status_s::SERVO_CONNECTION_TYPE_CAN;
_servo_status.servo_online_flags = check_servos_status();
_servo_status.count = _servo_count;
_servo_status.online_flags = check_servos_status();
_servo_status.timestamp = hrt_absolute_time();
_servo_status_pub.publish(_servo_status);
}
+1 -1
View File
@@ -1154,7 +1154,7 @@ void UavcanMixingInterfaceServo::mixerChanged()
servo_count += _mixing_output.isFunctionSet(i);
if (i < servo_status_s::CONNECTED_SERVO_MAX) {
_servo_controller.servo_status().servo[i].servo_function = (uint8_t)_mixing_output.outputFunction(i);
_servo_controller.servo_status().servo[i].function = (uint8_t)_mixing_output.outputFunction(i);
}
}
+1 -1
View File
@@ -126,7 +126,7 @@ void LoggedTopics::add_default_topics()
add_topic("sensor_selection");
add_topic("sensors_status_imu", 200);
add_optional_topic("spoilers_setpoint", 1000);
add_optional_topic("servo_status", 10);
add_optional_topic("servo_status", 100);
add_topic("system_power", 500);
add_optional_topic("takeoff_status", 1000);
add_optional_topic("tecs_status", 200);