How to locate the PX4 files which in wsl2 when I use the UAV ToolBox for PX4?

23 views (last 30 days)
Env:
matlab:R2024a
UAV Tool box support package:24.1.0
wsl2:Ubuntu 20.04
PX4: source code:v1.14.0
When I configure the UAV Tool box support package,following is my question
"Firmware validation failed: Firmware folder not found. Specify a correct PX4 firmware directory or re-clone a valid PX4 firmware v1.14 repository."
I think my path is correct.Following is my Path.
When I change the file path like this,the error is following.
"Firmware validation failed: Error while trying to find the PX4 Version: bash: line 0: cd: -2: invalid optioncd: usage: cd [-L|[-P [-e]] [-@]] [dir]fatal: not a git repository (or any parent up to mount point /mnt)Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)."
I am so confused.How I can get through this?

Accepted Answer

Arun Mathamkode
Arun Mathamkode on 26 Mar 2024
I believe the issue you might be facing is because of the distribution root folder name. The expected path is '\\wsl.localhost\Ubuntu' instead of '\\wsl.localhost\Ubuntu-20.4'. You can consider installing the distrubution 'Ubuntu' and by default it will be installing 22.04 distribution. Try installing the 'Ubuntu' distribution by running the following comamnd in your Windows Command Prompt.
wsl --install -d Ubuntu
After the successful installation, ensure that you are chosing Ubuntu as the default distribution.
wsl --set-default Ubuntu
After this please try by giving either '/home/cfc/PX4-Autopilot' or '\\wsl.localhost\Ubuntu\home\cfc\PX4-Autopilot' as the PX4 firmware location.
  5 Comments

Sign in to comment.

More Answers (2)

Jacob
Jacob on 8 Oct 2024
Just in case someone else comes across this post in the future:
Currently, the default Ubuntu version for WSL2 is Ubuntu 24.04, which has incompatibilities with the PX4 software. This means that Ubuntu 22.04 no longer has the default name of "Ubuntu," which MATLAB requires to detect the distro.
To fix this:
1. Make sure the default Ubuntu (24.04) is not installed (delete it with wsl --unregister if it is already installed).
2. Install Ubuntu 22.04:
wsl --install Ubuntu-22.04
4. Export the WSL distro using:
wsl --export Ubuntu-22.04 Ubuntu.tar
5. Re-import the distro with the name "Ubuntu" using:
wsl --import Ubuntu <YOUR_INSTALL_LOCATION_HERE> .\Ubuntu.tar
This will create a copy of your current Ubuntu 22.04 distro but with the correct name "Ubuntu" so MATLAB can detect it.
6. Set it as the default and remove the original distro:
wsl --set-default Ubuntu
wsl --unregister Ubuntu-22.04
This worked for me, and I hope it helps anyone else with a similar issue.

Arun Mathamkode
Arun Mathamkode on 23 Oct 2024
Edited: Arun Mathamkode on 27 Oct 2024 at 10:47
As Jacob mentioned, currently the default Ubuntu version for WSL2 is Ubuntu 24.04, which is not compatible with the PX4. You need to install Ubuntu 22.04 specifically. But exporting and importing it to the name 'Ubuntu' is not necessary.
1. Install Ubuntu 22.04 and set the default distribution
wsl --install Ubuntu-22.04
2. After the installation is complete, restart the computer.
3. After the computer restarts, relaunch the Windows command prompt. Set Ubuntu-22.04 distribution as default
wsl --set-default Ubuntu-22.04
You don't have to do export and import as mentioned above. If you set Ubuntu-22.04 as the default distribution MATLAB will recognize it.

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!