Add logging profiles to logger module.

This commit is contained in:
James Goppert 2017-06-29 07:32:30 -04:00 committed by Lorenz Meier
parent 2092770361
commit d10a491243
5 changed files with 76 additions and 15 deletions

View File

@ -871,7 +871,8 @@ then
if ver hwcmp PX4FMU_V5
then
set LOGGER_BUF 64
param set SDLOG_MODE 3
param set SDLOG_MODE 2
param set SDLOG_PROFILE 2
fi
if param compare SDLOG_MODE 1
then
@ -881,10 +882,6 @@ then
then
set LOGGER_ARGS "-f"
fi
if param compare SDLOG_MODE 3
then
set LOGGER_ARGS "-f"
fi
if ver hwcmp AEROFC_V1
then
set LOGGER_ARGS "-m mavlink"

View File

@ -16,7 +16,7 @@ Data can be gathered using the following sequence:
1) Power up the board and set the TC_A_ENABLE, TC_B_ENABLE and TC_G_ENABLE parameters to 1
2) Set all CAL_GYR and CAL_ACC parameters to defaults
3) Set the SYS_LOGGER parameter to 1 to use the new system logger
4) Set the SDLOG_MODE parameter to 3 to enable logging of sensor data for calibration and power off
4) Set the SDLOG_MODE parameter to 2, and SDLOG_PROFILE parameter to 2 to enable logging of sensor data for calibration and power off
5) Cold soak the board for 30 minutes
6) Move to a warm dry, still air, constant pressure environment.
7) Apply power for 45 minutes, keeping the board still.

View File

@ -397,11 +397,13 @@ Logger::Logger(LogWriter::Backend backend, size_t buffer_size, uint32_t log_inte
_log_name_timestamp(log_name_timestamp),
_writer(backend, buffer_size, queue_size),
_log_interval(log_interval),
_sdlog_mode(0)
_sdlog_mode(SDLOG_MODE_ARM_UNTIL_DISARM),
_sdlog_profile(SDLOG_PROFILE_DEFAULT)
{
_log_utc_offset = param_find("SDLOG_UTC_OFFSET");
_log_dirs_max = param_find("SDLOG_DIRS_MAX");
_sdlog_mode_handle = param_find("SDLOG_MODE");
_sdlog_profile_handle = param_find("SDLOG_PROFILE");
if (poll_topic_name) {
const orb_metadata **topics = orb_get_topics();
@ -598,8 +600,11 @@ void Logger::add_default_topics()
add_topic("gps_dump"); //this will only be published if GPS_DUMP_COMM is set
add_topic("sensor_preflight", 50);
add_topic("task_stack_info");
}
/* for estimator replay (need to be at full rate) */
void Logger::add_estimator_replay_topics()
{
// for estimator replay (need to be at full rate)
add_topic("airspeed");
add_topic("distance_sensor");
add_topic("ekf2_timestamps");
@ -609,15 +614,23 @@ void Logger::add_default_topics()
add_topic("vehicle_status");
}
void Logger::add_calibration_topics()
void Logger::add_thermal_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);
}
void Logger::add_system_identification_topics()
{
// for system id need to log imu and controls at full rate
add_topic("sensor_gyro");
add_topic("sensor_accel");
add_topic("actuator_controls_0");
add_topic("actuator_controls_1");
}
int Logger::add_topics_from_file(const char *fname)
{
FILE *fp;
@ -730,11 +743,27 @@ void Logger::run()
param_get(_sdlog_mode_handle, &_sdlog_mode);
}
if (_sdlog_mode == 3) {
add_calibration_topics();
if (_sdlog_profile_handle != PARAM_INVALID) {
param_get(_sdlog_profile_handle, &_sdlog_profile);
}
if (_sdlog_profile == SDLOG_PROFILE_DEFAULT) {
add_default_topics();
} else if (_sdlog_profile == SDLOG_PROFILE_ESTIMATOR_REPLAY) {
add_default_topics();
add_estimator_replay_topics();
} else if (_sdlog_profile == SDLOG_PROFILE_THERMAL_CALIBRATION) {
add_thermal_calibration_topics();
} else if (_sdlog_profile == SDLOG_PROFILE_SYSTEM_IDENTIFICATION) {
add_default_topics();
add_system_identification_topics();
} else {
add_default_topics();
add_estimator_replay_topics();
}
}

View File

@ -58,6 +58,19 @@ namespace px4
namespace logger
{
enum {
SDLOG_MODE_ARM_UNTIL_DISARM = 0,
SDLOG_MODE_BOOT_UNTIL_DISARM = 1,
SDLOG_MODE_BOOT_UNTIL_SHUTDOWN = 2
};
enum {
SDLOG_PROFILE_DEFAULT = 0,
SDLOG_PROFILE_ESTIMATOR_REPLAY = 1,
SDLOG_PROFILE_THERMAL_CALIBRATION = 2,
SDLOG_PROFILE_SYSTEM_IDENTIFICATION = 3
};
struct LoggerSubscription {
int fd[ORB_MULTI_MAX_INSTANCES];
uint16_t msg_ids[ORB_MULTI_MAX_INSTANCES];
@ -246,7 +259,9 @@ private:
int add_topics_from_file(const char *fname);
void add_default_topics();
void add_calibration_topics();
void add_estimator_replay_topics();
void add_thermal_calibration_topics();
void add_system_identification_topics();
void ack_vehicle_command(orb_advert_t &vehicle_command_ack_pub, uint16_t command, uint32_t result);
@ -306,7 +321,9 @@ private:
// control
param_t _sdlog_mode_handle;
param_t _sdlog_profile_handle;
int32_t _sdlog_mode;
int32_t _sdlog_profile;
};

View File

@ -60,14 +60,32 @@ 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
* @reboot_required true
* @group SD Logging
*/
PARAM_DEFINE_INT32(SDLOG_MODE, 0);
/**
* Logging Topic Profile
*
* Selects a set of topics appropriate for specific tasks.
*
* This parameter is only for the new logger (SYS_LOGGER=1).
*
* @value 0 default
* @value 1 estimator replay
* @value 2 thermal calibration
* @value 3 system identification
*
* @min 0
* @max 3
* @reboot_required true
* @group SD Logging
*/
PARAM_DEFINE_INT32(SDLOG_MODE, 0);
PARAM_DEFINE_INT32(SDLOG_PROFILE, 0);
/**
* Maximum number of log directories to keep