PX4 Firmware
PX4 Autopilot Software http://px4.io
px4::ReplayEkf2 Class Reference

replay specialization for Ekf2 replay More...

#include <ReplayEkf2.hpp>

Inheritance diagram for px4::ReplayEkf2:
Collaboration diagram for px4::ReplayEkf2:

Protected Member Functions

void onEnterMainLoop () override
 called when entering the main replay loop More...
 
void onExitMainLoop () override
 called when exiting the main replay loop More...
 
uint64_t handleTopicDelay (uint64_t next_file_time, uint64_t timestamp_offset) override
 handle delay until topic can be published. More...
 
bool handleTopicUpdate (Subscription &sub, void *data, std::ifstream &replay_file) override
 handle ekf2 topic publication in ekf2 replay mode More...
 
void onSubscriptionAdded (Subscription &sub, uint16_t msg_id) override
 called when a new subscription is added More...
 
- Protected Member Functions inherited from px4::Replay
bool publishTopic (Subscription &sub, void *data)
 publish an orb topic More...
 
void readTopicDataToBuffer (const Subscription &sub, std::ifstream &replay_file)
 read a topic from the file (offset given by the subscription) into _read_buffer More...
 
bool nextDataMessage (std::ifstream &file, Subscription &subscription, int msg_id)
 Find next data message for this subscription, starting with the stored file offset. More...
 

Private Member Functions

bool publishEkf2Topics (const ekf2_timestamps_s &ekf2_timestamps, std::ifstream &replay_file)
 
bool findTimestampAndPublish (uint64_t timestamp, uint16_t msg_id, std::ifstream &replay_file)
 find the next message for a subscription that matches a given timestamp and publish it More...
 

Private Attributes

int _vehicle_attitude_sub = -1
 
uint16_t _airspeed_msg_id = msg_id_invalid
 
uint16_t _distance_sensor_msg_id = msg_id_invalid
 
uint16_t _gps_msg_id = msg_id_invalid
 
uint16_t _optical_flow_msg_id = msg_id_invalid
 
uint16_t _sensor_combined_msg_id = msg_id_invalid
 
uint16_t _vehicle_air_data_msg_id = msg_id_invalid
 
uint16_t _vehicle_magnetometer_msg_id = msg_id_invalid
 
uint16_t _vehicle_visual_odometry_msg_id = msg_id_invalid
 
int _topic_counter = 0
 

Static Private Attributes

static constexpr uint16_t msg_id_invalid = 0xffff
 

Additional Inherited Members

- Public Member Functions inherited from px4::Replay
 Replay ()=default
 
virtual ~Replay ()
 
void run () override
 
- Static Public Member Functions inherited from px4::Replay
static int task_spawn (int argc, char *argv[])
 
static Replayinstantiate (int argc, char *argv[])
 
static int custom_command (int argc, char *argv[])
 
static int print_usage (const char *reason=nullptr)
 
static int applyParams (bool quiet)
 Apply the parameters from the log. More...
 
static void setupReplayFile (const char *file_name)
 Tell the replay module that we want to use replay mode. More...
 
static bool isSetup ()
 
- Static Protected Member Functions inherited from px4::Replay
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. More...
 
- Protected Attributes inherited from px4::Replay
std::vector< Subscription * > _subscriptions
 
std::vector< uint8_t > _read_buffer
 

Detailed Description

replay specialization for Ekf2 replay

Definition at line 45 of file ReplayEkf2.hpp.

Member Function Documentation

◆ findTimestampAndPublish()

bool px4::ReplayEkf2::findTimestampAndPublish ( uint64_t  timestamp,
uint16_t  msg_id,
std::ifstream &  replay_file 
)
private

find the next message for a subscription that matches a given timestamp and publish it

Parameters
timestampin 0.1 ms
msg_id
replay_filefile currently replayed (file seek position should be considered arbitrary after this call)
Returns
true if timestamp found and published

Definition at line 182 of file ReplayEkf2.cpp.

References px4::Replay::_read_buffer, px4::Replay::_subscriptions, px4::Replay::Subscription::error_counter, msg_id_invalid, px4::Replay::Subscription::next_timestamp, px4::Replay::nextDataMessage(), orb_metadata::o_name, px4::Replay::Subscription::orb_meta, px4::Replay::publishTopic(), and px4::Replay::readTopicDataToBuffer().

Referenced by publishEkf2Topics().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTopicDelay()

uint64_t px4::ReplayEkf2::handleTopicDelay ( uint64_t  next_file_time,
uint64_t  timestamp_offset 
)
overrideprotectedvirtual

handle delay until topic can be published.

Parameters
next_file_timestamptimestamp of next message to publish
timestamp_offsetoffset between file start time and replay start time
Returns
timestamp that the message to publish should have

Reimplemented from px4::Replay.

Definition at line 249 of file ReplayEkf2.cpp.

◆ handleTopicUpdate()

bool px4::ReplayEkf2::handleTopicUpdate ( Subscription sub,
void *  data,
std::ifstream &  replay_file 
)
overrideprotectedvirtual

handle ekf2 topic publication in ekf2 replay mode

Parameters
sub
data
replay_filefile currently replayed (file seek position should be considered arbitrary after this call)
Returns
true if published, false otherwise

Reimplemented from px4::Replay.

Definition at line 59 of file ReplayEkf2.cpp.

References _topic_counter, _vehicle_attitude_sub, orb_metadata::o_size, orb_copy(), ORB_ID, px4::Replay::Subscription::orb_meta, publishEkf2Topics(), px4::Replay::publishTopic(), and px4_poll().

Here is the call graph for this function:

◆ onEnterMainLoop()

void px4::ReplayEkf2::onEnterMainLoop ( )
overrideprotectedvirtual

called when entering the main replay loop

Reimplemented from px4::Replay.

Definition at line 213 of file ReplayEkf2.cpp.

References _vehicle_attitude_sub, ORB_ID, and orb_subscribe().

Here is the call graph for this function:

◆ onExitMainLoop()

void px4::ReplayEkf2::onExitMainLoop ( )
overrideprotectedvirtual

called when exiting the main replay loop

Reimplemented from px4::Replay.

Definition at line 219 of file ReplayEkf2.cpp.

References _airspeed_msg_id, _distance_sensor_msg_id, _gps_msg_id, _optical_flow_msg_id, _sensor_combined_msg_id, px4::Replay::_subscriptions, _vehicle_air_data_msg_id, _vehicle_attitude_sub, _vehicle_magnetometer_msg_id, _vehicle_visual_odometry_msg_id, px4::Replay::Subscription::error_counter, msg_id_invalid, name, orb_unsubscribe(), and px4::Replay::Subscription::publication_counter.

Here is the call graph for this function:

◆ onSubscriptionAdded()

void px4::ReplayEkf2::onSubscriptionAdded ( Subscription sub,
uint16_t  msg_id 
)
overrideprotectedvirtual

◆ publishEkf2Topics()

bool px4::ReplayEkf2::publishEkf2Topics ( const ekf2_timestamps_s ekf2_timestamps,
std::ifstream &  replay_file 
)
private

Member Data Documentation

◆ _airspeed_msg_id

uint16_t px4::ReplayEkf2::_airspeed_msg_id = msg_id_invalid
private

Definition at line 83 of file ReplayEkf2.hpp.

Referenced by onExitMainLoop(), onSubscriptionAdded(), and publishEkf2Topics().

◆ _distance_sensor_msg_id

uint16_t px4::ReplayEkf2::_distance_sensor_msg_id = msg_id_invalid
private

Definition at line 84 of file ReplayEkf2.hpp.

Referenced by onExitMainLoop(), onSubscriptionAdded(), and publishEkf2Topics().

◆ _gps_msg_id

uint16_t px4::ReplayEkf2::_gps_msg_id = msg_id_invalid
private

Definition at line 85 of file ReplayEkf2.hpp.

Referenced by onExitMainLoop(), onSubscriptionAdded(), and publishEkf2Topics().

◆ _optical_flow_msg_id

uint16_t px4::ReplayEkf2::_optical_flow_msg_id = msg_id_invalid
private

Definition at line 86 of file ReplayEkf2.hpp.

Referenced by onExitMainLoop(), onSubscriptionAdded(), and publishEkf2Topics().

◆ _sensor_combined_msg_id

uint16_t px4::ReplayEkf2::_sensor_combined_msg_id = msg_id_invalid
private

Definition at line 87 of file ReplayEkf2.hpp.

Referenced by onExitMainLoop(), onSubscriptionAdded(), and publishEkf2Topics().

◆ _topic_counter

int px4::ReplayEkf2::_topic_counter = 0
private

Definition at line 92 of file ReplayEkf2.hpp.

Referenced by handleTopicUpdate().

◆ _vehicle_air_data_msg_id

uint16_t px4::ReplayEkf2::_vehicle_air_data_msg_id = msg_id_invalid
private

Definition at line 88 of file ReplayEkf2.hpp.

Referenced by onExitMainLoop(), onSubscriptionAdded(), and publishEkf2Topics().

◆ _vehicle_attitude_sub

int px4::ReplayEkf2::_vehicle_attitude_sub = -1
private

Definition at line 79 of file ReplayEkf2.hpp.

Referenced by handleTopicUpdate(), onEnterMainLoop(), and onExitMainLoop().

◆ _vehicle_magnetometer_msg_id

uint16_t px4::ReplayEkf2::_vehicle_magnetometer_msg_id = msg_id_invalid
private

Definition at line 89 of file ReplayEkf2.hpp.

Referenced by onExitMainLoop(), onSubscriptionAdded(), and publishEkf2Topics().

◆ _vehicle_visual_odometry_msg_id

uint16_t px4::ReplayEkf2::_vehicle_visual_odometry_msg_id = msg_id_invalid
private

Definition at line 90 of file ReplayEkf2.hpp.

Referenced by onExitMainLoop(), onSubscriptionAdded(), and publishEkf2Topics().

◆ msg_id_invalid

constexpr uint16_t px4::ReplayEkf2::msg_id_invalid = 0xffff
staticprivate

Definition at line 81 of file ReplayEkf2.hpp.

Referenced by findTimestampAndPublish(), onExitMainLoop(), and publishEkf2Topics().


The documentation for this class was generated from the following files: