How can replace default controller parts of PX4 with custom algorithms controller?

45 visualizaciones (últimos 30 días)
I want to change controller algorithms of PX4.
So I am learning 'UAV Toolbox Support Package for PX4 Autopilots'
I want replace controller parts of px4 firmware(default : 'mc_att_control' and 'mc_pos_control)' with custom controller.
Path following flight is performed simply by connecting PX4 to the drone and simply giving a mission with QGC.(Before using UAV Toolbox Support Package for PX4 Autopilots)
if I want to change only the controller of PX4 using the UAV Toolbox Support Package for PX4 Autopilots, I wonder if I can design and build only the controller. Or, I wonder if I should design all the processes (connecting to QGC, transmitting and receiving msg, etc.) from the beginning with simulink. There is no example for this, so it is difficult to proceed.
P.S.
It would be very helpful if there was an example of flying a real drone by building a custom algorithm in PX4. (not simulation)

Respuesta aceptada

Jianxin Sun
Jianxin Sun el 15 de Feb. de 2022
Hi SeungWoo,
You can use the support package to replace the PX4 controller only. Please refer to the "integration with general PX4 architecture" doc page for details. You will also need to enable the mavlink module if you want to enable communication with QGC.
The following examples show how to replace multirotor position controller in PX4:
Jianxin
  6 comentarios
Jonah Whitt
Jonah Whitt el 17 de Oct. de 2023
Hi Jianxin. In "integration with general PX4 architecture", it would appear that you can replace the "Position Controller" and "Attitude & Rate Controller" modules.
However, in all the examples you have provided, it appears the "Output Driver" block is also being replaced (a custom "To Actuator" block is present in all of the examples).
How can I set up the build to only replace the Position, Attitude, and Rate controllers, or are there any examples that I missed which do this?
Or is the diagram under "Supported Modules that can be Replaced with User-Defined Algorithms" inaccurate, and the Output Driver module is also being replaced?
Thank you!
Jianxin Sun
Jianxin Sun el 17 de Oct. de 2023
Hi Jonah,
I assume you want to keep using PX4's mixer instead of using the PWM blocks from the PX4 support package? In that case, you should consider use the "PX4 uOrb write" block to write to "actuator_controls_0" message. This will let you send roll/pitch/yaw/thrust commands to PX4 firmware, which will then be translated into actuator outputs by PX4 firmware mixer.
You can check the following examples:
Jianxin

Iniciar sesión para comentar.

Más respuestas (1)

Massimo Satler
Massimo Satler el 15 de Mzo. de 2022
Hi Jianxin Sun, I saw the system requirements section where it is recommended Ubuntu 18.04 Is it possible to use the support packets with Ubuntu 20.04 and matlab 2022a?
  1 comentario
Jianxin Sun
Jianxin Sun el 1 de Jun. de 2023
From R2022b, the PX4 support package supports PX4 1.12.3 and Ubuntu 20.04: https://www.mathworks.com/help/releases/R2022b/supportpkg/px4/ug/download-px4-source-code-ubuntu.html

Iniciar sesión para comentar.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by