I took a quick look at the pixhawk v2 datasheet and I find this pictures explaining the logical system. So there is two CPU : one for Flight management STM32F427, and one for communication with ground and actuators control STM32F100.
My question, how I know on which environments my code will be executed and how can I change it ? if I understand this, the makefile system will is producing two binaries for two physical different cpu. If I want for exemple to create a homemade control-algoritme module I would like it to run on FMU and not IO but if I want to control motors it is on IO that it should also interact… It is a bit confusing for me.
The name of the rule I execute to build the project is “make px4fmu-v2_default” so it’s only for the FMU ?
On the datasheet of PX4IO module they say that it is not recomend to develop code on this failsafe processor or only for “very advance user”.
" PX4IO is designed as a failsafe board with a stable codebase. Building custom frmware is only recommended for very advanced users.To develop custom code, follow the PX4FMU/PX4IO toolchain guide at: https://pixhawk.ethz.ch/px4/dev/start "
Or this guide doesn’t exist anymore, and in the new one I don’t find any information about building code on IO module.
Any more explaination is welcomed,
Nearly everything runs on the FMU. https://github.com/PX4/Firmware/tree/master/src/modules
The IO firmware is just this (+ a few drivers for rc, etc). https://github.com/PX4/Firmware/tree/master/src/modules/px4iofirmware
If you want to manually control motors go through the existing mixing architecture and the system will handle the rest for you whether the motors are physically connected to the IO or FMU. https://dev.px4.io/en/concept/mixing.html
Thank you, I will look at this but one still is still dark for me: how the communication between the two processor is handled ? (Big arrow in the middle on the scheme)
There’s a serial connection and a driver on the fmu side called px4io. https://github.com/PX4/Firmware/tree/master/src/drivers/px4io
Generally you can ignore the IO and focus your development on the FMU side. It you cause the FMU to crash you still have RC and the safety switch on the IO side to safely takeover.
So for example if I am developing on fmu a controler and I plublish in uORB actuator_controls ouput value from -1.0 to +1.0 , as soon as they are publish, the fmu will mix them automaticly and send PWM value threw serial link to IO and then set the output to desired value ?
Yes (depending on how you’ve configured and loaded mixers of course).
IO = MAIN
FMU = AUX
In fmu.cpp code which part do this??? —set the IO pwm value