mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 23:33:57 -04:00
Replay: added --no-params option
This commit is contained in:
parent
8ec0e687db
commit
4116f80901
@ -1,4 +1,5 @@
|
||||
#include "LR_MsgHandler.h"
|
||||
#include "LogReader.h"
|
||||
|
||||
extern const AP_HAL::HAL& hal;
|
||||
|
||||
@ -435,7 +436,12 @@ void LR_MsgHandler_PARM::process_message(uint8_t *msg)
|
||||
|
||||
require_field(msg, "Name", parameter_name, parameter_name_len);
|
||||
|
||||
set_parameter(parameter_name, require_field_float(msg, "Value"));
|
||||
float value = require_field_float(msg, "Value");
|
||||
if (globals.no_params) {
|
||||
printf("Not changing %s to %f\n", parameter_name, value);
|
||||
} else {
|
||||
set_parameter(parameter_name, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,3 +79,10 @@ private:
|
||||
|
||||
bool save_message_type(const char *name);
|
||||
};
|
||||
|
||||
// some vars are difficult to get through the layers
|
||||
struct globals {
|
||||
bool no_params;
|
||||
};
|
||||
|
||||
extern struct globals globals;
|
||||
|
@ -102,6 +102,8 @@ private:
|
||||
|
||||
ReplayVehicle replayvehicle;
|
||||
|
||||
struct globals globals;
|
||||
|
||||
#define GSCALAR(v, name, def) { replayvehicle.g.v.vtype, name, Parameters::k_param_ ## v, &replayvehicle.g.v, {def_value : def} }
|
||||
#define GOBJECT(v, name, class) { AP_PARAM_GROUP, name, Parameters::k_param_ ## v, &replayvehicle.v, {group_info : class::var_info} }
|
||||
#define GOBJECTN(v, pname, name, class) { AP_PARAM_GROUP, name, Parameters::k_param_ ## pname, &replayvehicle.v, {group_info : class::var_info} }
|
||||
@ -322,6 +324,7 @@ void Replay::usage(void)
|
||||
::printf("\t--nottypes list of msg types not to output, comma separated\n");
|
||||
::printf("\t--downsample downsampling rate for output\n");
|
||||
::printf("\t--logmatch match logging rate to source\n");
|
||||
::printf("\t--no-params don't use parameters from the log\n");
|
||||
}
|
||||
|
||||
|
||||
@ -333,7 +336,8 @@ enum {
|
||||
OPT_TOLERANCE_VEL,
|
||||
OPT_NOTTYPES,
|
||||
OPT_DOWNSAMPLE,
|
||||
OPT_LOGMATCH
|
||||
OPT_LOGMATCH,
|
||||
OPT_NOPARAMS,
|
||||
};
|
||||
|
||||
void Replay::flush_dataflash(void) {
|
||||
@ -386,6 +390,7 @@ void Replay::_parse_command_line(uint8_t argc, char * const argv[])
|
||||
{"nottypes", true, 0, OPT_NOTTYPES},
|
||||
{"downsample", true, 0, OPT_DOWNSAMPLE},
|
||||
{"logmatch", false, 0, OPT_LOGMATCH},
|
||||
{"no-params", false, 0, OPT_NOPARAMS},
|
||||
{0, false, 0, 0}
|
||||
};
|
||||
|
||||
@ -459,6 +464,10 @@ void Replay::_parse_command_line(uint8_t argc, char * const argv[])
|
||||
case OPT_LOGMATCH:
|
||||
logmatch = true;
|
||||
break;
|
||||
|
||||
case OPT_NOPARAMS:
|
||||
globals.no_params = true;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user