mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 11:23:34 +08:00
Allow changing parameters during replay (#22071)
* replay: add scheduled parameter changes * replay: store scheduled parameter change events as structs
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@@ -220,6 +221,23 @@ protected:
|
||||
|
||||
private:
|
||||
std::set<std::string> _overridden_params;
|
||||
|
||||
struct ParameterChangeEvent {
|
||||
uint64_t timestamp;
|
||||
std::string parameter_name;
|
||||
double parameter_value;
|
||||
|
||||
// Comparison operator such that sorting is done by timestamp
|
||||
bool operator<(const ParameterChangeEvent &other) const
|
||||
{
|
||||
return timestamp < other.timestamp;
|
||||
}
|
||||
};
|
||||
|
||||
std::set<std::string> _dynamic_parameters;
|
||||
std::vector<ParameterChangeEvent> _dynamic_parameter_schedule;
|
||||
size_t _next_param_change;
|
||||
|
||||
std::map<std::string, std::string> _file_formats; ///< all formats we read from the file
|
||||
|
||||
uint64_t _file_start_time;
|
||||
@@ -275,7 +293,9 @@ private:
|
||||
/** get the size of a type that can be an array */
|
||||
static size_t sizeOfFullType(const std::string &type_name_full);
|
||||
|
||||
void setParameter(const std::string ¶meter_name, const double parameter_value);
|
||||
void setUserParams(const char *filename);
|
||||
void readDynamicParams(const char *filename);
|
||||
|
||||
std::string parseOrbFields(const std::string &fields);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user