PX4-Autopilot icon indicating copy to clipboard operation
PX4-Autopilot copied to clipboard

Cloud build (customization) support for PX4

Open junwoo091400 opened this issue 2 years ago • 2 comments

Describe problem solved by the proposed feature

As described in https://github.com/mavlink/qgroundcontrol/issues/10676, betaflight currently provides a 'cloud build', which essentially allows users to have custom-built target (with custom set of drivers, features, etc).

image

In the betaflight configurator (equivalent to QGC), the custom build options are shown as indicated in red marking in the screenshot above, and users can easily build a target binary with custom options and have it directly flashed in the UI, which is amazing!

This is done via having the cloud service with a docker build environment, building a target with a specified build flags (e.g. -DUSE_SDCARD) in the make command. This is the script.

Note: Cloud build feature is also supported in Ardupilot.

Benefits

I think having this cloud build feature will enhance PX4 in following ways:

  • Reduce flash constrained problem: Since customization is possible, the target default binaries can include minimal set of features, and extra features can be added only if the user wants to do so
    • One concrete example would be including only certain 'flight tasks' (we had huge delay back when follow me flight task improvement PR was constantly overflowing the flash of FMU v2, and since it wasn't omittable, it had to be hacked away via flash constrained define option.
  • Provides custom build option for non-developers: This was previously not possible & kept the entry barrier to customization (in driver selection level) very high

Describe your preferred solution

So far, I am uncertain if in PX4 build, such options like -DUSE_SDCARD for the make command exists. Since we are more using the KConfig architecture, defining the inclusion of drivers and features via .px4board files, I am uncertain how we would make this CLI compatible. @PetervdPerk-NXP I would love to know your thoughts on this!

However, if we can indeed specify the build options in the CLI, having the cloud build service set up wouldn't be a big hassle, as we can benchmark betaflight's implementation: https://github.com/betaflight/cloudbuild

p.s. Example of how betaflight transitioned USE_SDCARD flag to be cloud build compatible can be found here: https://github.com/betaflight/betaflight/pull/11947/files

Other

Note, the notion of 'selecting (custom) build variants' was also introduced in this PR https://github.com/PX4/PX4-Autopilot/pull/19848#issuecomment-1191590296, but was left unfinished for now.

junwoo091400 avatar May 04 '23 04:05 junwoo091400

I don't know the specifics of cloud-build, configuring flexibility and security.

But you could re-use the work of #17180 but then instead of using Qt for the frontend you create a web-based GUI with something like twisted.

PetervdPerk-NXP avatar May 04 '23 11:05 PetervdPerk-NXP

This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/how-to-build-get-specific-firmware-release-as-v-1-14-3/38804/3

DronecodeBot avatar May 20 '24 16:05 DronecodeBot