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