From be6079bc52fac0b3423094f7f377325662f55201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Sat, 14 Oct 2017 09:21:34 +0200 Subject: [PATCH] logger: add high rate & debug profiles --- src/modules/logger/logger.cpp | 28 +++++++++++++++++++++++++++- src/modules/logger/logger.h | 4 ++++ src/modules/logger/params.c | 4 +++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/modules/logger/logger.cpp b/src/modules/logger/logger.cpp index cecde36781..fb26609902 100644 --- a/src/modules/logger/logger.cpp +++ b/src/modules/logger/logger.cpp @@ -580,6 +580,24 @@ void Logger::add_common_topics() add_topic("wind_estimate", 200); } +void Logger::add_high_rate_topics() +{ + // maximum rate to analyze fast maneuvers (e.g. for racing) + add_topic("actuator_controls_0"); + add_topic("actuator_outputs"); + add_topic("manual_control_setpoint"); + add_topic("vehicle_attitude"); + add_topic("vehicle_attitude_setpoint"); + add_topic("vehicle_rates_setpoint"); +} + +void Logger::add_debug_topics() +{ + add_topic("debug_key_value"); + add_topic("debug_value"); + add_topic("debug_vect"); +} + void Logger::add_estimator_replay_topics() { // for estimator replay (need to be at full rate) @@ -601,7 +619,6 @@ void Logger::add_estimator_replay_topics() void Logger::add_thermal_calibration_topics() { - // Note: try to avoid setting the interval where possible, as it increases RAM usage add_topic("sensor_accel", 100); add_topic("sensor_baro", 100); add_topic("sensor_gyro", 100); @@ -741,6 +758,15 @@ void Logger::run() add_common_topics(); add_system_identification_topics(); + } else if (sdlog_profile == SDLogProfile::HIGH_RATE) { + add_common_topics(); + add_estimator_replay_topics(); + add_high_rate_topics(); + + } else if (sdlog_profile == SDLogProfile::DEBUG_TOPICS) { + add_common_topics(); + add_debug_topics(); + } else { add_common_topics(); add_estimator_replay_topics(); diff --git a/src/modules/logger/logger.h b/src/modules/logger/logger.h index e1d7b0e70a..b87ad542e3 100644 --- a/src/modules/logger/logger.h +++ b/src/modules/logger/logger.h @@ -65,6 +65,8 @@ enum class SDLogProfile : int32_t { DEFAULT = 0, THERMAL_CALIBRATION, SYSTEM_IDENTIFICATION, + HIGH_RATE, + DEBUG_TOPICS, N_PROFILES }; @@ -270,6 +272,8 @@ private: void add_estimator_replay_topics(); void add_thermal_calibration_topics(); void add_system_identification_topics(); + void add_high_rate_topics(); + void add_debug_topics(); void ack_vehicle_command(orb_advert_t &vehicle_command_ack_pub, vehicle_command_s *cmd, uint32_t result); diff --git a/src/modules/logger/params.c b/src/modules/logger/params.c index 58a5cdefb0..6f5e274c09 100644 --- a/src/modules/logger/params.c +++ b/src/modules/logger/params.c @@ -78,9 +78,11 @@ PARAM_DEFINE_INT32(SDLOG_MODE, 0); * @value 0 default * @value 1 thermal calibration * @value 2 system identification + * @value 3 high rate + * @value 4 debug topics * * @min 0 - * @max 2 + * @max 4 * @reboot_required true * @group SD Logging */