UAV Toolbox Support Package for PX4 Autopilots - px4_simulink_app module

14 次查看(过去 30 天)
I have successfully built and deployed the px4 controller on pixhawk4 via simulink. Also added rc.txt to SD Card's etc folder.
When I tried to connect Pixhawk4 to QGroundControl without any additional work, it was disconnected and unable to connect.
For reference, I added the following two lines to the end of rc.txt, so I was able to connect Pixhawk4 to QGroundControl.
mavlink start -d /dev/ttyACM0 -m config –x
mavlink boot_complete
At this point, I had my doubts. I know that if the rc.txt file is added to the SD card and the Simulink controller is built and deployed, the px4_simulink_app module, not the mc_attitude_control and mc_position_control modules, is executed without any additional work. But how can I make sure that it activates px4_simulink_app when linked to QGroundControl?

采纳的回答

Ankur Bose
Ankur Bose 2023-2-3
编辑:Ankur Bose 2023-2-3
Before I answer your question, let me clarify that the "PX4 default startup script rcS" is the recommended option for booting up modules compared to custom startup script rc.txt option from R2020b release. The custom startup script option is difficult to scale for functionalities with other modules.
Now coming to your question, I guess your question is how to ensure Pixhawk connects to QGC after deploying to Simulink. You dont need to add any mavlink specific line in rc.txt like you did. You can follow the below documentation to enable MAVLink communication before deploying the controller.
Basically, the selection "Enable MAVLink over USB" ensures that px4_simulink_app is generated with MAVLink communication enabled and hence it will connect to QGC after deployment.
Note that this option will not work with External Mode simulation as both are trying to connect over "/dev/tyACM0". If you need External Mode option, you need to disable this checkbox

更多回答(2 个)

Arun Mathamkode
Arun Mathamkode 2023-2-3
The modules you are adding to the rc.txt will be started after the board bootup, irrespective of whether you have connected QGroundControl or not. So if you have the px4_simulink_app start command added in the rc.txt, px4_simulink_app will be started after the bootup. It is not very clear to me what you meant by 'activates', if you are referring to making sure the module is running you can verify it through the System Console or MAVLink NSH Console in QgroundControl. Use the px4_simulink_app status command for this.

Jae Won Han
Jae Won Han 2023-2-6
All this progress is running on Ubuntu 20.04.
I'm reading UAV Toolbox Support Package for PX4 Autopilots User's Guide again.
They said px4_simulink_app module is added to rcS, but I don't know how to check that px4_simulink_app module is added to rcS after I built Simulink.
How can I check the px4_simulink_app module in rcS?
  2 个评论
Arun Mathamkode
Arun Mathamkode 2023-2-7
The 'px4_simulink_app' will be added in '<px4_firmware_root>\Firmware\boards\px4\fmu-v4\init\rc.board_extras' file. You can open this file and check. The rcS file will be referring to rc.board_extras. The rcS file is located at '<px4_firmware_root>\ROMFS\px4fmu_common\init.d\rcS'. To make sure the px4_simulink_app module is running in the board, you can use System Console or MAVLink NSH Console in QgroundControl. Use the px4_simulink_app status command for this.

请先登录,再进行评论。

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by