Browse Source

Replay: added --no-params option

mission-4.1.18
Andrew Tridgell 9 years ago
parent
commit
4116f80901
  1. 8
      Tools/Replay/LR_MsgHandler.cpp
  2. 7
      Tools/Replay/LogReader.h
  3. 11
      Tools/Replay/Replay.cpp

8
Tools/Replay/LR_MsgHandler.cpp

@ -1,4 +1,5 @@
#include "LR_MsgHandler.h" #include "LR_MsgHandler.h"
#include "LogReader.h"
extern const AP_HAL::HAL& hal; 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); 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);
}
} }

7
Tools/Replay/LogReader.h

@ -79,3 +79,10 @@ private:
bool save_message_type(const char *name); 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;

11
Tools/Replay/Replay.cpp

@ -102,6 +102,8 @@ private:
ReplayVehicle replayvehicle; 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 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 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} } #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--nottypes list of msg types not to output, comma separated\n");
::printf("\t--downsample downsampling rate for output\n"); ::printf("\t--downsample downsampling rate for output\n");
::printf("\t--logmatch match logging rate to source\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_TOLERANCE_VEL,
OPT_NOTTYPES, OPT_NOTTYPES,
OPT_DOWNSAMPLE, OPT_DOWNSAMPLE,
OPT_LOGMATCH OPT_LOGMATCH,
OPT_NOPARAMS,
}; };
void Replay::flush_dataflash(void) { 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}, {"nottypes", true, 0, OPT_NOTTYPES},
{"downsample", true, 0, OPT_DOWNSAMPLE}, {"downsample", true, 0, OPT_DOWNSAMPLE},
{"logmatch", false, 0, OPT_LOGMATCH}, {"logmatch", false, 0, OPT_LOGMATCH},
{"no-params", false, 0, OPT_NOPARAMS},
{0, false, 0, 0} {0, false, 0, 0}
}; };
@ -460,6 +465,10 @@ void Replay::_parse_command_line(uint8_t argc, char * const argv[])
logmatch = true; logmatch = true;
break; break;
case OPT_NOPARAMS:
globals.no_params = true;
break;
case 'h': case 'h':
default: default:
usage(); usage();

Loading…
Cancel
Save