Browse Source

logger: Add mode for thermal calibration logging

Logs the IMU and baro data at 10Hz
sbg
Paul Riseborough 8 years ago committed by Lorenz Meier
parent
commit
3a029e58c7
  1. 26
      src/modules/logger/logger.cpp
  2. 6
      src/modules/logger/logger.h
  3. 3
      src/modules/logger/params.c

26
src/modules/logger/logger.cpp

@ -383,9 +383,11 @@ Logger::Logger(LogWriter::Backend backend, size_t buffer_size, uint32_t log_inte @@ -383,9 +383,11 @@ Logger::Logger(LogWriter::Backend backend, size_t buffer_size, uint32_t log_inte
_log_until_shutdown(log_until_shutdown),
_log_name_timestamp(log_name_timestamp),
_writer(backend, buffer_size, queue_size),
_log_interval(log_interval)
_log_interval(log_interval),
_sdlog_mode(0)
{
_log_utc_offset = param_find("SDLOG_UTC_OFFSET");
_sdlog_mode_handle = param_find("SDLOG_MODE");
}
Logger::~Logger()
@ -565,6 +567,15 @@ void Logger::add_default_topics() @@ -565,6 +567,15 @@ void Logger::add_default_topics()
add_topic("vehicle_land_detected");
}
void Logger::add_calibration_topics()
{
// Note: try to avoid setting the interval where possible, as it increases RAM usage
add_topic("sensor_gyro", 100);
add_topic("sensor_accel", 100);
add_topic("sensor_baro", 100);
}
int Logger::add_topics_from_file(const char *fname)
{
FILE *fp;
@ -671,7 +682,18 @@ void Logger::run() @@ -671,7 +682,18 @@ void Logger::run()
PX4_INFO("logging %d topics from logger_topics.txt", ntopics);
} else {
add_default_topics();
/* get the logging mode */
if (_sdlog_mode_handle != PARAM_INVALID) {
param_get(_sdlog_mode_handle, &_sdlog_mode);
}
if (_sdlog_mode == 3) {
add_calibration_topics();
} else {
add_default_topics();
}
}
int vehicle_command_sub = -1;

6
src/modules/logger/logger.h

@ -216,6 +216,7 @@ private: @@ -216,6 +216,7 @@ private:
int add_topics_from_file(const char *fname);
void add_default_topics();
void add_calibration_topics();
void ack_vehicle_command(orb_advert_t &vehicle_command_ack_pub, uint16_t command, uint32_t result);
@ -255,6 +256,11 @@ private: @@ -255,6 +256,11 @@ private:
orb_advert_t _mavlink_log_pub = nullptr;
uint16_t _next_topic_id = 0; ///< id of next subscribed ulog topic
char *_replay_file_name = nullptr;
// control
param_t _sdlog_mode_handle;
int32_t _sdlog_mode;
};
} //namespace logger

3
src/modules/logger/params.c

@ -60,9 +60,10 @@ PARAM_DEFINE_INT32(SDLOG_UTC_OFFSET, 0); @@ -60,9 +60,10 @@ PARAM_DEFINE_INT32(SDLOG_UTC_OFFSET, 0);
* @value 0 when armed until disarm (default)
* @value 1 from boot until disarm
* @value 2 from boot until shutdown
* @value 3 from boot until shutdown - IMU and Baro data only (used for thermal calibration)
*
* @min 0
* @max 2
* @max 3
* @reboot_required true
* @group SD Logging
*/

Loading…
Cancel
Save