Px4 Replay without GPS

Hey all.

I’ve flown multiple flights with QGC in position and mission mode, using a drone with GPS. I am trying to replay these flights using Px4 SITL as if they flew without GPS. Specifically, I would like to produce the outputs of the EKF2 and other topics (VehicleAcceleration, VehicleAngularVelocity, VehicleAttitude, etc) as though Px4 did not have access to a GPS source.

As a first step, I want to confirm that I could successfully replay a ulog file with GPS and have the replayed output match the original ulog file. I am trying to identify the list of input topics that the replay module should be able to publish in the restrict_topics section of the orb_publisher.rules file. For example, topics like sensor_combined, sensor_accel, sensor_mag, sensor_baro, sensor_gps, etc should published by the replay module, as they serve as inputs to the EKF and other modules that estimate output states of the drone (e.g. VehicleAttitude, VehicleAngularVelocity). I’ve also included topics like vehicle_command, and vehicle_land_detected which are inputs to the EKF. I’ve tried many different combinations of these inputs, however, whenever I replay my flight, I can’t get my replayed flight to look like the original flight, even when I allow sensor_gps as an input. Please advise how I can reproduce the flight from the sensors and other inputs from my ulog file for the ultimate purpose of replaying a flight without GPS inputs.

Here are the erroneous outputs for my vehicle_local_position.

I attached the pdf of my flight review below. It was replayed with the following orb_publisher.rules file

restrict_topics: vehicle_command_ack,vehicle_command,vehicle_control_mode,vehicle_constraints,vehicle_status,battery_status,manual_control_setpoints,
vehicle_air_data,vehicle_land_detected,sensor_combined,sensor_accel,sensor_mag,sensor_correction,sensor_baro,sensor_gps,sensor_gyro,sensor_selection

module: replay

ignore_others: true

and the following replay_params.txt file

EKF2_MULTI_IMU 0
EKF2_MULTI_MAG 0
SENS_IMU_MODE 1
SENS_MAG_MODE 1

Flight Review - Quadrotor.pdf (2.7 MB)

I am also pasting the output of the ulog_info command of my original flight, which shows the list of topics in the original log (before replay):

Logging start time: 0:46:36, duration: 0:05:20
No Dropouts
Info Messages:
 metadata_events_sha256: 8800bfc717b6f8413409767d451746a5753f9052a98215f659bdd583fac4ce90
 sys_mcu: STM32H7[4|5]xxx, rev. V
 sys_name: PX4
 sys_os_name: NuttX
 sys_os_ver: 6fdb755a5d776de3017aa874a5e204dd1903054e
 sys_os_ver_release: 184549631
 sys_toolchain: GNU GCC
 sys_toolchain_ver: 9.3.1 20200408 (release)
 sys_uuid: 000600000000303138333430510e0035001a
 time_ref_utc: 0
 ver_data_format: 2
ver_hw: CUBEPILOT_CUBEORANGE
 ver_sw: f03c26b922c52ef7d90927570878cfe9c3b075fe
 ver_sw_branch: main
 ver_sw_release: 17694720
Info Multiple Messages: [boot_console_output: 1], [excluded_optional_topics: 35], [metadata_events: 1], [perf_counter_postflight: 1], [perf_counter_preflight: 1], [perf_top_postflight: 1], [perf_top_preflight: 1]

Name (multi id, message size in bytes)    number of data points, total bytes
 actuator_armed (0, 15)                       639       9585
 actuator_controls_status_0 (0, 20)           641      12820
 actuator_motors (0, 66)                    80175    5291550
 actuator_outputs (0, 76)                    3209     243884
 battery_status (0, 167)                     1605     268035
 config_overrides (0, 14)                     638       8932
 control_allocator_status (0, 52)           52433    2726516
 cpuload (0, 16)                              643      10288
 estimator_attitude (0, 49)                 16037     785813
 estimator_attitude (1, 49)                 16037     785813
 estimator_baro_bias (0, 40)                  641      25640
 estimator_baro_bias (1, 40)                  641      25640
 estimator_event_flags (0, 53)                319      16907
 estimator_event_flags (1, 53)                320      16960
 estimator_global_position (0, 60)            320      19200
 estimator_global_position (1, 60)            320      19200
 estimator_gps_status (0, 39)                 320      12480
 estimator_gps_status (1, 39)                 320      12480
 estimator_innovation_test_ratios (0, 148)     641      94868
 estimator_innovation_test_ratios (1, 148)     641      94868
 estimator_innovation_variances (0, 148)      641      94868
 estimator_innovation_variances (1, 148)      641      94868
 estimator_innovations (0, 148)               641      94868
 estimator_innovations (1, 148)               641      94868
 estimator_local_position (0, 179)          16037    2870623
 estimator_local_position (1, 179)          16037    2870623
 estimator_selector_status (0, 153)           327      50031
 estimator_sensor_bias (0, 118)               566      66788
 estimator_sensor_bias (1, 118)               572      67496
 estimator_states (0, 205)                    320      65600
 estimator_states (1, 205)                    320      65600
 estimator_status (0, 130)                   1605     208650
 estimator_status (1, 130)                   1605     208650
 estimator_status_flags (0, 95)               405      38475
 estimator_status_flags (1, 95)               415      39425
 estimator_wind (0, 48)                       320      15360
 estimator_wind (1, 48)                       320      15360
 event (0, 40)                                 18        720
 failsafe_flags (0, 85)                       584      49640
 failure_detector_status (0, 22)              639      14058
 home_position (0, 52)                          4        208
 hover_thrust_estimate (0, 41)               3149     129109
 input_rc (0, 71)                             641      45511
 landing_gear (0, 9)                            2         18
 magnetometer_bias_estimate (0, 64)             7        448
 manual_control_setpoint (0, 63)             1605     101115
 manual_control_switches (0, 31)              319       9889
 mission_result (0, 38)                         9        342
 navigator_mission_item (0, 51)                 8        408
 parameter_update (0, 34)                       1         34
 position_setpoint_triplet (0, 248)            17       4216
 rate_ctrl_status (0, 24)                   80175    1924200
 rtl_time_estimate (0, 17)                    236       4012
 sensor_accel (0, 44)                         320      14080
 sensor_accel (1, 44)                         320      14080
 sensor_baro (0, 32)                          320      10240
 sensor_combined (0, 48)                    67344    3232512
 sensor_gps (0, 142)                          320      45440
 sensor_gyro (0, 44)                          320      14080
 sensor_gyro (1, 44)                          320      14080
 sensor_mag (0, 40)                           320      12800
 sensor_selection (0, 16)                       1         16
 sensors_status_imu (0, 96)                  1605     154080
 takeoff_status (0, 13)                        10        130
 telemetry_status (0, 86)                     320      27520
 telemetry_status (1, 86)                     320      27520
 trajectory_setpoint (0, 64)                 1605     102720
 vehicle_acceleration (0, 28)                6416     179648
 vehicle_air_data (0, 41)                    1605      65805
 vehicle_angular_velocity (0, 40)           91624    3664960
 vehicle_attitude (0, 49)                    6416     314384
 vehicle_attitude_setpoint (0, 54)           6416     346464
 vehicle_command (0, 55)                        9        495
 vehicle_command_ack (0, 22)                    3         66
 vehicle_constraints (0, 17)                  320       5440
 vehicle_control_mode (0, 23)                 639      14697
 vehicle_global_position (0, 60)             1605      96300
 vehicle_gps_position (0, 142)               3206     455252
 vehicle_imu (0, 56)                          641      35896
 vehicle_imu (1, 56)                          641      35896
 vehicle_imu_status (0, 132)                  320      42240
 vehicle_imu_status (1, 132)                  320      42240
 vehicle_land_detected (0, 20)                327       6540
 vehicle_local_position (0, 179)            16037    2870623
 vehicle_local_position_setpoint (0, 64)     3209     205376
 vehicle_magnetometer (0, 33)                 641      21153
 vehicle_rates_setpoint (0, 33)             67333    2221989
 vehicle_status (0, 76)                       639      48564
 vehicle_thrust_setpoint (0, 28)            80175    2244900
 vehicle_torque_setpoint (0, 28)            80175    2244900
 wind (0, 48)                                 320      15360
 yaw_estimator_status (0, 105)                320      33600
 yaw_estimator_status (1, 105)                320      33600

Thanks for your help, I really appreciate it.

Probably would be good if you can upload the logfile to logs.px4.io and link it here.

Also, I’m pinging @bresch, he might have more to say.

I figured it out.

I enabled full rate logging for all sensor_* topics in logged_topics.cpp and logged the ekf2_timestamps as well.

Posting this for future readers who are struggling with a same or similar problem.

3 Likes