44 #include <px4_platform_common/module.h> 58 class Replay :
public ModuleBase<Replay>
75 static int print_usage(
const char *reason =
nullptr);
118 int accelerometer_integral_dt_offset_log,
int accelerometer_integral_dt_offset_intern);
135 bool ignored =
false;
143 int error_counter = 0;
144 int publication_counter = 0;
155 static bool findFieldOffset(
const std::string &format,
const std::string &field_name,
int &offset,
int &field_size);
186 virtual uint64_t
handleTopicDelay(uint64_t next_file_time, uint64_t timestamp_offset);
235 bool readFormat(std::ifstream &file, uint16_t msg_size);
237 bool readFlagBits(std::ifstream &file, uint16_t msg_size);
253 bool readDropout(std::ifstream &file, uint16_t msg_size);
259 static std::string
extractArraySize(
const std::string &type_name_full,
int &array_size);
262 static size_t sizeOfType(
const std::string &type_name);
int _accelerometer_integral_dt_offset_log
virtual void * apply(void *data)=0
apply compatibility to a topic
int _accelerometer_integral_dt_offset_intern
void readTopicDataToBuffer(const Subscription &sub, std::ifstream &replay_file)
read a topic from the file (offset given by the subscription) into _read_buffer
static int applyParams(bool quiet)
Apply the parameters from the log.
static Replay * instantiate(int argc, char *argv[])
bool nextDataMessage(std::ifstream &file, Subscription &subscription, int msg_id)
Find next data message for this subscription, starting with the stored file offset.
std::streampos _subscription_file_pos
keep track of file position to avoid adding a subscription multiple times.
int _gyro_integral_dt_offset_log
bool readAndHandleAdditionalMessages(std::ifstream &file, std::streampos end_position)
Read and handle additional messages starting at current file position, while position < end_position...
std::vector< uint8_t > _read_buffer
std::map< std::string, std::string > _file_formats
all formats we read from the file
Parses an ULog file and replays it in 'real-time'.
bool readAndApplyParameter(std::ifstream &file, uint16_t msg_size)
virtual void onExitMainLoop()
called when exiting the main replay loop
static char * _replay_file
bool readFlagBits(std::ifstream &file, uint16_t msg_size)
bool readAndAddSubscription(std::ifstream &file, uint16_t msg_size)
virtual uint64_t handleTopicDelay(uint64_t next_file_time, uint64_t timestamp_offset)
handle delay until topic can be published.
std::vector< Subscription * > _subscriptions
int timestamp_offset
marks the field of the timestamp
static int print_usage(const char *reason=nullptr)
uint64_t _file_start_time
int64_t _read_until_file_position
read limit if log contains appended data
virtual ~CompatBase()=default
static int custom_command(int argc, char *argv[])
static std::string extractArraySize(const std::string &type_name_full, int &array_size)
get the array size from a type.
std::streampos next_read_pos
virtual void onEnterMainLoop()
called when entering the main replay loop
static bool findFieldOffset(const std::string &format, const std::string &field_name, int &offset, int &field_size)
Find the offset & field size in bytes for a given field name.
virtual void onSubscriptionAdded(Subscription &sub, uint16_t msg_id)
called when a new subscription is added
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
bool readDropout(std::ifstream &file, uint16_t msg_size)
bool readFileDefinitions(std::ifstream &file)
Read definitions section: check formats, apply parameters and store the start of the data section...
uint64_t _replay_start_time
static int task_spawn(int argc, char *argv[])
bool publishTopic(Subscription &sub, void *data)
publish an orb topic
std::streampos _data_section_start
first ADD_LOGGED_MSG message
int _gyro_integral_dt_offset_intern
struct @83::@85::@87 file
std::set< std::string > _overridden_params
uint64_t next_timestamp
timestamp of the file
static const orb_metadata * findTopic(const std::string &name)
static size_t sizeOfFullType(const std::string &type_name_full)
get the size of a type that can be an array
static size_t sizeOfType(const std::string &type_name)
get the size of a type that is not an array
bool readFileHeader(std::ifstream &file)
bool readDefinitionsAndApplyParams(std::ifstream &file)
Read the file header and definitions sections.
static void setupReplayFile(const char *file_name)
Tell the replay module that we want to use replay mode.
void setUserParams(const char *filename)
bool readFormat(std::ifstream &file, uint16_t msg_size)
file parsing methods. They return false, when further parsing should be aborted.
virtual bool handleTopicUpdate(Subscription &sub, void *data, std::ifstream &replay_file)
handle the publication of a topic update