MATLAB: Does the PX4 Support Package Setup not recognize the installed Ubuntu distribution on Windows 10

Embedded Coderpx4Ubuntuwindows-subsystem

I have installed "Embedded Coder Support Package for PX4 Autopilots" using MATLAB R2019a on Windows 10. I launched the Setup and followed the steps as instructed in the first panel:
I rebootet my PC and re-launched the Setup, but I cannot get past the first setup panel. The error message is:
Install the Ubuntu distribution and then go to the Next Screen.
However, I can launch the Ubuntu shell from Windows Start > Programs and I double-checked that I installed the correct version 16.04.6 LTS. Why does the PX4 support package setup not recognize my Ubuntu distribution?

Best Answer

This may happen if the call to bash.exe fails from the Windows Command Prompt (CMD). You can verify this by entering the following command at the MATLAB prompt:
>> system('bash')
The system cannot find the path specified.
Note that along with Ubuntu bash/Windows System for Linux, there is another way to install PX4 toolchain - by using PX4 cygwin toolchain (which is the preferred way). This is officially supported as part of hardware setup screens from R2019b onwards. For R2019a, we have a documented way of how to use it.
So the following are the options in decreasing order of preference.
  1. Upgrade to R2019b, and use the Hardware Setup screens which will guide you to setup the cygwin toolchain and firmware.
  2. If upgrading to R2019b is not possible, see the below R2019a documentation link which will help install the PX4 cygwin toolchain: https://www.mathworks.com/help/releases/R2019a/supportpkg/px4/ug/px4-using-cygwin.html
  3. If you want to use the Ubuntu bash/Windows System for Linux only, please contact your IT helpdesk to find out why it is not possible to call bash.exe from the Windows Command Prompt on your machine.