Monitor and Tune PX4 Host Target Flight Controller with Simulink-Based Plant Model

3 views (last 30 days)
There's a question regarding the following figure on this documentation page: https://www.mathworks.com/help/supportpkg/px4/ref/simulator-plant-model-example.html
As stated in the documentation, "the Quad_Plant_top model and px4Demo_FlightController_top model run in lockstep with each other", however, why's the simulation time of the left model (plant) two times that of the right model (controller)?
This simulation time doubling can also be observed, if you try the example yourself.

Accepted Answer

Abhishek GS
Abhishek GS on 11 Nov 2020
Hi Yingao,
This is a good question. Yes, the the Quad_Plant_top model and px4Demo_FlightController_top model run in lockstep with each other. However, the TCP Read from Host Target block in Quad_Plant_top model, is set to read 50 bytes of data at each sample time. This is not enough to read all the data sent from the controller model. Hence, the plant model has to run 2 times to get all required HIL* messages from the controller and then respond.
Playing around with the TCP Read from Host Target block should ensure the time matches in both the controller and plant model. But rest assured that they are in lockstep. This can be noticed while pausing the using the step through functionality in the plant model.
Thanks,
Abhishek
  1 Comment
Yingao Zhang
Yingao Zhang on 12 Nov 2020
Thank you so much for your accurate reply, Abhishek. I'm looking forward to the correction of this problem in upcoming MATLAB releases.

Sign in to comment.

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!