How can I create a module (not a flight controller but runs in parallel with px4_simulink_app) using UAV Toolbox support package for PX4 Autopilots?

5 vues (au cours des 30 derniers jours)
I want to create a module which runs in parallel with the flight controller's app developed through Simulink using the UAV Toolbox support package for PX4 Autopilots. I had successfully developed a flight controller using Simulink and when I click on "build, deploy and start", it creates a module named "px4_simulink_app" which runs at startup since in rcS file the module is started using the "px4_simulink_app start" command. Now I want to create another module which performs some side stuff like only gathers data from any MAVLink supported serial port from Jetson Nano which is performing some image processing on its own and sends the coordinates to Pixhawk Cube Orange plus. The cube recieves this data, do some processing and makes some decision and output the result via MAVLink to ground station. I want this module to be created via Simulink because I am ordered to not go into C/C++ coding. Also this module should run separate from the module created when using the default settings for creating flight controllers i.e px4_simulink_app. If I am wrong at any point please guide me through it. Thanks.

Réponse acceptée

Faseeh Ahmed
Faseeh Ahmed le 20 Déc 2024
I understand that creating multiple apps through Simulink and running them in parallel is not supported by the UAV Toolbox support package for PX4 as of now.
However, It is a task assigned by my supervisor and I had to report him about this scenario. After hours of fiddling with the source files and simulink, I have come to the conclusion that it might be possible to create and run multiple simulink apps in parallel but it is far too impractical and hectic as even a minor change in simulink design will require a complete reboot of the whole process of creating and running those apps.
To answer your question about using Jetson for all the processing, it is not my choice to do that since I am a student and my supervisor give me tasks to explore and perform.
For those who want to know how I created and ran multiple apps here is a shortened process:
1) First create your first app as usual in Simulink and do the Build only operation.
2) Now goto PX4-Autopilot/src/modules and rename the px4_simulink_app folder to your app name.
3) Then create your next app in Simulink and build again. Do the steps from 1 to 3 for all your apps.
4) Then after final app is created, change all the variable names, function names and module names in the respective app folders in PX4-Autopilot/src/modules folder. (This is the impractical part)
5) After all the modifications, use the (make "your autopilot") command in wsl shell in your PX4-Autopilot directory to build the firmware and get .px4 file.
6) Then upload the .px4 file using your ground control application.

Plus de réponses (1)

Arun Mathamkode
Arun Mathamkode le 10 Déc 2024
Creating multiple modules from Simulink and running them parallelly is not supported directly from Simulink as of now. The code generated from Simulink will always be run as a single px4_simulink_app module.
I have few questions with your usecase. If you are already doing some processing in Jetson why dont you do all the processing at Jetson itself and directly send the data to QGC instead of looping through the Cube Orange plus?
There is an example showcasing how to deploy code to Jetson from Simulink and establish connectivity with PX4 autopilot. You can have a look at this example and see if its something useful for your usecase.
  1 commentaire
Faseeh Ahmed
Faseeh Ahmed le 20 Déc 2024
Thank you @Arun Mathamkode for your answer. I understand that creating multiple apps through Simulink and running them in parallel is not supported by the UAV Toolbox support package for PX4 as of now.
However, It is a task assigned by my supervisor and I had to report him about this scenario. After hours of fiddling with the source files and simulink, I have come to the conclusion that it might be possible to create and run multiple simulink apps in parallel but it is far too impractical and hectic as even a minor change in simulink design will require a complete reboot of the whole process of creating and running those apps.
To answer your question about using Jetson for all the processing, it is not my choice to do that since I am a student and my supervisor give me tasks to explore and perform.
For those who want to know how I created and ran multiple apps here is a shortened process:
1) First create your first app as usual in Simulink and do the Build only operation.
2) Now goto PX4-Autopilot/src/modules and rename the px4_simulink_app folder to your app name.
3) Then create your next app in Simulink and build again. Do the steps from 1 to 3 for all your apps.
4) Then after final app is created, change all the variable names, function names and module names in the respective app folders in PX4-Autopilot/src/modules folder. (This is the impractical part)
5) After all the modifications, use the (make "your autopilot") command in wsl shell in your PX4-Autopilot directory to build the firmware and get .px4 file.
6) Then upload the .px4 file using your ground control application.

Connectez-vous pour commenter.

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by