UAV Toolbox support package for PX4 Autopilots- Host target simulation
6 次查看（过去 30 天）
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 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.