How to customize the control input of sitl

After an actual flight, I obtained the control command signal of rc from the SD card. How to apply this control signal to the sitl simulation of px4? I want to compare the difference between simulation and actual flight

1 Like

If you have the ulog available you can replay the mission in simulation https://docs.px4.io/master/en/debug/system_wide_replay.html

You can also upload the log to PX4 Flight Review
https://logs.px4.io/

If you want to control the vehicle trough code your best option is to use the MAVSDK

My idea is to compare simulation and actual flight output (such as output attitude angle) under the same input (such as the reference Euler angle in attitude mode). So, after an actual flight test, I got the flight log from the SD card. I want to use the control command (such as rc signal) in the sitl to test how close the gazebo simulation is to the real system. Can MAVSDK help me achieve this? That is to say, use the attitude command of the log file to control the aircraft.

I really don’t understand why you want to replicate the in simulation and compare to the real test flight, and also don’t understand why you want to use RC inputs.

The MAVSDK allows you to control the drone in Offboard mode, you can use velocity controls which are way better than RC inputs

I may not express my question clearly. I built my own aircraft model in sitl_gazebo, a ductedfan UAV, and ran SITL very well. In fact, I also built a similar aircraft and used pixhawk 4 to fly, everything is ok. Now I have changed the parameters of the SITL gazebo model to be the same as the actual aircraft. I want to further compare the difference with the actual. I really need a more accurate model to work. My first thought was to collect roll, pitch, yaw setpoint and Z setpoint in actual flight, and then use these setpoints as the input of SITL to control the aircraft and observe its output. This allows me to roughly know whether my model is close to reality.

Now I don’t know much about replay of PX4, and I find that there are relatively few related documents. For example, how to set the ORB publisher rules file, I have not been very clear. Can you give some guidance? It seems that ekf2 replay can run very well, but I don’t know how the other modules of replay are effective. I followed the development guide, but the results were not very satisfactory. Both the stable branch and the master branch have problems. I submitted the issue to https://github.com/PX4/PX4-Autopilot/issues/17021 and now I am helpless.can you help me ?

1 Like