UAV Toolbox support package for PX4 Autopilots- Host target simulation

2 次查看(过去 30 天)
hello.
I started to peform simulations with PX4 host target, and as a target a simulink model.
I'm able to run the example Px4DemoHostTargetWithSimulinkPlantStart, and it works. But now i want to build my controller, with my simulink model. I tried to perform some simulation and i saw that my simulink model don't recevie all the commads that my controller send via mavlink message HIL_ACTUATOR_CONTROL.
I can explai better with an example:
-Controller model send 1000 1100 1200 1300, via Pwm block for PX4, with a fixed sample time of 0.01
-The Plant Model recevied 1000 1000 1000 1300, via Mavlink messsage HIL_ACTUATOR_CONTROL. alway with a fixed sample time of 0.01
So basically i have that my desired command that my controller compute, isn't recevied perfectly by my model.
My first thought is that there was some delay in reading or in sending, or some problem due to computational effrot. So i'm asking if anyone know how the two sysyems interact each other, i mean is a synchronous communication or not, the simulator plant must have a sample time smaller with respect the controller one.
thanks in advance

采纳的回答

Arun Mathamkode
Arun Mathamkode 2023-7-12
The controller and plant are in lock step simulation by default. What this means is that PX4 controller and the plant wait on each other for sensor and actuator messages, rather than running at their own speeds. Please refer thsi PX4 doc for more details.
  1 个评论
Edorado Baldacci
Edorado Baldacci 2023-7-12
Thanks for your reply, i undestood thins poit.
But now, this comunication at what frequency is done?
I mean to simulate the PX4 board, matlab compile the controller model into C++ code, and run it on the Pc. Now PX4 have a max frequency of Work (400 Hz). So once the model is compile it run at this frequency or lower?
Thanks

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by