What is the px4 installer really doing

Hey

I’d like to compile the arducopter code for a pixhawk, and I obviously should go with the px4_toolchain_installer (as discussed here: dev.ardupilot.com/wiki/building- … with-make/). I have some questions though.

  1. I do have some installations on my PC, such as an arm-noneabi or Phyton27 or drivers needed for a FTDI and the STM32 stuff, and some other things, which seem to be part also of the px4_toolchain_installer. I’m now honestly very worried that running the px4_toolchain_installer will affect or even make unusable my other installations. I would not be very pleased (Britsh understatement) if I would have to repair all stuff. So, my question would be if the px4_toolchain_installer is affecting other installations, and if so, which ones, and what I could do to prevent that from happening ?

  2. What would I have to do when I would like to compile both let’s say the master and latest AC3.2.1 firmware. Would it be sufficient to just keep them in different folders such as e.g. ardupilotmaster and ardupilot321 and cd to the respective paths GitHub/ardupilotmaster/ArduCopter or GitHub/ardupilot321/ArduCopter in the px4 console before the make?

  3. Instead of cloning it from GitHub would it be also possible to just download as zip, and to put the unzipped files into appropriately renamed subfolders, or is it essential that things are held in correct github directories?

THX

Hi BWBWBW

I cannot answer your first question as I am unsure how the installer works. Building on Windows didn’t work for me at all so I used a Vagrantbox instead. Not only is it easier to get it to work, it is also (mostly) unaffected by changes in your Windows installation and at the same time your Windows installation is protected from anything that goes on in the box.
If you use another vm to run the SITL in Ubuntu, you can compile in there as well (it’s a bit more tricky to get it to work there with the shared folders thing), though it’s a bit slower.

I can however answer your other 2 questions:

  1. It does not matter where your Ardupilot source is located on your directory or even how many copies you have. Having multiple Ardupilot folders is not a problem. You can indeed just cd to the proper ArduCopter-directory and compile from there.
    What is important is the location of your PX4Firmware and PX4NuttX directories. These need to be in the same directory as your ardupilot-directory/directories (so in your case GitHub/PX4Firrmware and GitHub/PX4NuttX).
    However, because the versions of the PX4Firmware- and the PX4NuttX-sources should be the same as the version of ardupilot, it can be a problem to share these between different ardupilot-versions.

The better option would be to clone the git repositories and then use git to switch the branches of the PX4Firmware-repository and the PX4NuttX-repository to the matching branches (eg master branches when you want to compile the master branch of ardupilot and AC3.2.1 branches if you want to compile the AC3.2.1 branch of ardupilot).
You could also do the same with the ardupilot source and only keep one repository on your pc and just switch its branch when you want to use a different version (if you make modifications, you can create your own branch).

If you don’t want to use git, I suggest keeping separate copies of PX4Firmware and PX4NuttX for each ardupilot-version you are using:
[ul][li]/GitHub
[list][]/master
[list][
]/ardupilot (master branch)[/li]
[li]/PX4Firwmare (master branch)[/li]
[li]/PX4NuttX (master branch)[/li][/ul][/:m]
[li]/AC3.2.1
[ul][
]/ardupilot (AC 3.2.1 branch)[/li]
[li]/PX4Firmware (AC 3.2.1 branch)[/li]
[li]/PX4NuttX (AC 3.2.1 branch)[/li][/ul][/:m][/list:u][/:m][/list:u]

  1. You can indeed just download the sources and unzip them. You should however only use this if you do not want to use git. If you wish to use git, you should clone the resources and then use pull to get updates. You should not unzip the sources into existing git repositories as this will seriously confuse git (it will think you made a ton of changes yourself).
    I however really recommend using git. It is much easier and offers a lot of advantages (eg changelogs (commitlogs), merging (it won’t just overwrite your changes, but tries to incorporate them in the new version), easily switch to other versions, etc.) If you don’t like using git in commandline, there are several really good GUI’s available that make it childs play.

Hey Madkihg,

thank you so much for your detailed answer, your comments were VERY helpful

I checked things out further on a scratch computer, and it seems that the installer is well designed - at least I could not identify any interference with other installs. Although I lack the knowledge to properly evaluate that, I somehow got the impression that it kind of works in its own sandbox. I did do the install without the drivers however, so, no idea what that part would do.

I did not get along with the github thing, running make px4-v2 would stop with an error that some python package is missing and following the advice what to do would work once but only once. I anyhow don’t understand how all this switching between branches and merging things work.

Fortunately, the zip thing works great and exactly as you say, and it’s simple enough for me to understand in detail what’s going on.

Downloading the px4 file via MP works fine, however px4-v2-upload gets stuck at the “last” line. Since the MP upload works out I was thinking that all required drivers and so on should be fine, and that hence px4-v2-upload also would/should do fine, but obviously this was a too naive assumption.

It was also relatively simple to get the Eclipse thing running. So, I can do compiles now and even better, they seem to work, including my first little changes LOL. When compiling AC3.2.1 the px4 file size differs from the original one, not sure if that means anything.

Even though I’m up now, overall I have however to say that it’s quite a “stone-aged” thing, not sure how anyone could happily do serious work with that environment. I mean, I got used to the convenient features of nowadays IDEs, but the .pde thing and maybe others beyond my knowledge breaks most of them apart, and slows things down. Anyway. It’s kind of working.

Thx again, sir !