logger: Add mode for thermal calibration logging

Logs the IMU and baro data at 10Hz
This commit is contained in:
Paul Riseborough
2017-01-21 11:48:02 +01:00
committed by Lorenz Meier
parent 27abc4fe6b
commit 3a029e58c7
3 changed files with 32 additions and 3 deletions
+24 -2
View File
@@ -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()
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()
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
View File
@@ -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:
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
+2 -1
View File
@@ -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
*/