PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.48k stars 13.5k forks source link

Installing PX4-Autopilot for M1 Mac Users Running Parallels Ubuntu 20.04 Virtual Machine #21117

Open OliverHeilmann opened 1 year ago

OliverHeilmann commented 1 year ago

Description

As per the title, I have been trying to install PX4-Autopilot so that I can use the Gazebo Rover SITL environment with MavSDK. I am using a Macbook Pro with Apple Silicon (M1 chip) and have a Parallels VM instance running Ubuntu 20.04.

Linux ubuntu 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:27 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

I have managed to get the setup working, following issues including #19210 and #21014, but it was not as straight forward I was hoping.

I am opening up a Feature Request as a means to capture the steps I went through and link the associated resources I used, as well as to ask the PX4 developer community if we can have some clearer documentation for others in my situation. Hopefully, this post will help other developers experiencing the same issue in the meantime.

Installation

Note that this post assumes that readers already have a working Parallels (or similar) VM installed.

Clone the repository as normal into the desired location.

git clone https://github.com/PX4/PX4-Autopilot.git --recursive

Next, you need to delete two lines in the ubuntu.sh file located in the setup folder.

# delete the two lines (lines 125, 126) in ubuntu.sh
#       g++-multilib \
#       gcc-multilib \
nano PX4-Autopilot/Tools/setup/ubuntu.sh

Install the ARM-Linux gcc and g++ multilib versions.

sudo apt-get install gcc-multilib-arm-linux-gnueabi gcc-multilib-arm-linux-gnueabihf g++-multilib-arm-linux-gnueabi g++-multilib-arm-linux-gnueabihf

The rest of the instructions shown below are as normal and described in the standard instructions here.

bash ./PX4-Autopilot/Tools/setup/ubuntu.sh
sudo reboot

# in PX4-Autpilot directory
make px4_sitl gazebo_rover

Resources Used

  1. I found mengchaoheng's post to be useful in explaining how developers should 'delete g++-multilib and gcc-multilib lines'.
  2. I ended up following the steps from this YouTube video.
  3. Official PX4-Autopilot YouTube video describing the installation instructions.
  4. The PX4-Autopilot documentation instructions here
Flyingtux commented 1 year ago

Hello, Thanks for the tuto. I followed it on my M1 64GB with parallels pro 18 on a fresh ubuntu 18.04 32GB but I had some trouble.

which version did you checkout ?

on current version (25/03/2023), gazebo targets seem not work anymore and jmavsim targets crash on previous versions like 1.13.2 I have this issue :

jpdumont@macuntu2004:~/PX4-Autopilot$make px4_sitl gazebo_rover ninja: error: '../../src/modules/mavlink/mavlink/pymavlink/tools/mavgen.py', needed by 'mavlink/development/development.h', missing and no known rule to make it make: *** [Makefile:235: px4_sitl] Error 1

Thanks in advance

Flyingtux commented 1 year ago

Hello,

Ok I solved my problem, I was using the v1.11.3. My problem was a bad init of git when I did :

git clone https://github.com/PX4/PX4-Autopilot.git
cd PX4-Autopilot.git
git checkout v1.11.3
git submodule init
git submodule update --recursive

the good way is :

git clone https://github.com/PX4/PX4-Autopilot.git
cd PX4-Autopilot.git
git checkout v1.11.3
git submodule update --init --recursive

Regards,

OliverHeilmann commented 1 year ago

Hi @Flyingtux, thanks for posting your solution! Answering your initial question anyway, I am using v1.11.3 as per the screenshot shown below.

Screenshot 2023-03-26 at 14 36 55

My experience of setting up the PX4 SITL environment didn't require me to checkout any specific version (I think the version I have was the default). One thing I did note was that you are using Ubuntu 18.04 whereas I was using 20.04. PX4 documentation says both should be fine but just wanted to highlight this difference.

Another noteworthy thing is that you might need to turn of 3D/ Graphics/ GPU Acceleration while using Gazebo. Some users experience a 'black screen' if not. Generally this slows down the SITL environment but, as you are using an M1 Pro, I am sure it will be fine regardless. See setting option below (click on Advanced and ensure that this is disabled).

Screenshot 2023-03-26 at 14 45 47

Can you confirm that the Gazebo and JMavSim simulators are working as you expect now?

I will keep this issue open to allow others to post if they had any other issues following these steps.

Flyingtux commented 1 year ago

Hello Oliver,

Nice to meet you, Thanks for your answers/advises

Actually I tested the 3 last versions of ubuntu LTS (18, 20 and 22) to see which was better. The only one really working from v1.11.3 to the last current version of PX4 is the 20.04,

My goal was to find the best/easiest solution to develop on my MacM1 (macos native/parallels Ubuntu/macos dockers...) For now, I'm thinking to invest in VOXL2 platforms from Modalai based on Qualcomm RB5. But their docker tool-chains are only build available for amd64 platform. Fortunately, they seem to work with Docker under Macos/Rosetta, but not under parallels Ubuntu. so I will have to jump from Parallels-Ubuntu and MacOs-Docker-Rosetta but it should be simple with the shared folder

Not easy to work with the Apple ARM architecture. The superb silence of the M1 has its price ;-).

I did test a lot Gazebo yet, I just noticed that it didn't like big screen like 3440x1440

Regards,

Jean-Pierre

Le dim. 26 mars 2023 à 15:50, Oliver @.***> a écrit :

Hi @Flyingtux https://github.com/Flyingtux, thanks for posting your solution! Answering your initial question anyway, I am using v1.11.3 as per the screenshot shown below.

[image: Screenshot 2023-03-26 at 14 36 55] https://user-images.githubusercontent.com/49697817/227779626-2cfc79b8-d576-471a-8d4c-b55b3344a565.png

My experience of setting up the PX4 SITL environment didn't require me to checkout any specific version (I think the version I have was the default). One thing I did note was that you are using Ubuntu 18.04 whereas I was using 20.04. PX4 documentation says both should be fine but just wanted to highlight this difference.

Another noteworthy thing is that you might need to turn of 3D/ Graphics/ GPU Acceleration while using Gazebo. Some users experience a 'black screen' if not. Generally this slows down the SITL environment but, as you are using an M1 Pro, I am sure it will be fine regardless. See setting option below (click on Advanced and ensure that this is disabled).

[image: Screenshot 2023-03-26 at 14 45 47] https://user-images.githubusercontent.com/49697817/227780016-35c31189-66c1-405a-8b5c-4e7f23fef42c.png

Can you confirm that the Gazebo and JMavSim simulators are working as you expect now?

I will keep this issue open to allow others to post if they had any other issues following these steps.

— Reply to this email directly, view it on GitHub https://github.com/PX4/PX4-Autopilot/issues/21117#issuecomment-1484102706, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLJISX2REEBAUAX4VZUOB3W6BJTDANCNFSM6AAAAAAUZIAGVQ . You are receiving this because you were mentioned.Message ID: @.***>

Flyingtux commented 1 year ago

Re Hello, I didn't test jmavsim, I don't like java at all. I already found this techno slow and sluggish, so not good for real-time applications like sitl simulations. And we have already a virtual machine with parallels that slows us down !

Regards,

Jean-Pierre

Le lun. 27 mars 2023 à 11:25, Jean-Pierre Dumont @.***> a écrit :

Hello Oliver,

Nice to meet you, Thanks for your answers/advises

Actually I tested the 3 last versions of ubuntu LTS (18, 20 and 22) to see which was better. The only one really working from v1.11.3 to the last current version of PX4 is the 20.04,

My goal was to find the best/easiest solution to develop on my MacM1 (macos native/parallels Ubuntu/macos dockers...) For now, I'm thinking to invest in VOXL2 platforms from Modalai based on Qualcomm RB5. But their docker tool-chains are only build available for amd64 platform. Fortunately, they seem to work with Docker under Macos/Rosetta, but not under parallels Ubuntu. so I will have to jump from Parallels-Ubuntu and MacOs-Docker-Rosetta but it should be simple with the shared folder

Not easy to work with the Apple ARM architecture. The superb silence of the M1 has its price ;-).

I did test a lot Gazebo yet, I just noticed that it didn't like big screen like 3440x1440

Regards,

Jean-Pierre

Le dim. 26 mars 2023 à 15:50, Oliver @.***> a écrit :

Hi @Flyingtux https://github.com/Flyingtux, thanks for posting your solution! Answering your initial question anyway, I am using v1.11.3 as per the screenshot shown below.

[image: Screenshot 2023-03-26 at 14 36 55] https://user-images.githubusercontent.com/49697817/227779626-2cfc79b8-d576-471a-8d4c-b55b3344a565.png

My experience of setting up the PX4 SITL environment didn't require me to checkout any specific version (I think the version I have was the default). One thing I did note was that you are using Ubuntu 18.04 whereas I was using 20.04. PX4 documentation says both should be fine but just wanted to highlight this difference.

Another noteworthy thing is that you might need to turn of 3D/ Graphics/ GPU Acceleration while using Gazebo. Some users experience a 'black screen' if not. Generally this slows down the SITL environment but, as you are using an M1 Pro, I am sure it will be fine regardless. See setting option below (click on Advanced and ensure that this is disabled).

[image: Screenshot 2023-03-26 at 14 45 47] https://user-images.githubusercontent.com/49697817/227780016-35c31189-66c1-405a-8b5c-4e7f23fef42c.png

Can you confirm that the Gazebo and JMavSim simulators are working as you expect now?

I will keep this issue open to allow others to post if they had any other issues following these steps.

— Reply to this email directly, view it on GitHub https://github.com/PX4/PX4-Autopilot/issues/21117#issuecomment-1484102706, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLJISX2REEBAUAX4VZUOB3W6BJTDANCNFSM6AAAAAAUZIAGVQ . You are receiving this because you were mentioned.Message ID: @.***>

OliverHeilmann commented 1 year ago

Hi @Flyingtux, if you're looking into simulators and concerned about performance, I'd have a look at WeBots. I've used it with good success and it uses much less compute power than other simulators such as Gazebo. I think the UI is quite intuitive, as is the nodal structure of all the in-world assets (docs are good too).

Look at this comparison between Gazebo, CoppeliaSim, MORSE and WeBots paper for some further insight.

Flyingtux commented 1 year ago

Hi Oliver,

Thanks, interesting for robotics application ;-)

LongLiveForFreedom commented 6 months ago

Description

As per the title, I have been trying to install PX4-Autopilot so that I can use the Gazebo Rover SITL environment with MavSDK. I am using a Macbook Pro with Apple Silicon (M1 chip) and have a Parallels VM instance running Ubuntu 20.04.

Linux ubuntu 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:27 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

I have managed to get the setup working, following issues including #19210 and #21014, but it was not as straight forward I was hoping.

I am opening up a Feature Request as a means to capture the steps I went through and link the associated resources I used, as well as to ask the PX4 developer community if we can have some clearer documentation for others in my situation. Hopefully, this post will help other developers experiencing the same issue in the meantime.

Installation

Note that this post assumes that readers already have a working Parallels (or similar) VM installed.

Clone the repository as normal into the desired location.

git clone https://github.com/PX4/PX4-Autopilot.git --recursive

Next, you need to delete two lines in the ubuntu.sh file located in the setup folder.

# delete the two lines (lines 125, 126) in ubuntu.sh
#         g++-multilib \
#     gcc-multilib \
nano PX4-Autopilot/Tools/setup/ubuntu.sh

Install the ARM-Linux gcc and g++ multilib versions.

sudo apt-get install gcc-multilib-arm-linux-gnueabi gcc-multilib-arm-linux-gnueabihf g++-multilib-arm-linux-gnueabi g++-multilib-arm-linux-gnueabihf

The rest of the instructions shown below are as normal and described in the standard instructions here.

bash ./PX4-Autopilot/Tools/setup/ubuntu.sh
sudo reboot

# in PX4-Autpilot directory
make px4_sitl gazebo_rover

Resources Used

  1. I found mengchaoheng's post to be useful in explaining how developers should 'delete g++-multilib and gcc-multilib lines'.
  2. I ended up following the steps from this YouTube video.
  3. Official PX4-Autopilot YouTube video describing the installation instructions.
  4. The PX4-Autopilot documentation instructions here

thank you for your sharing! It worked for me!