Platforms supported by ROS2
Linux (Ubuntu Focal(20.04))
macOS
Windows
ROS2 is really cross platform, and ROS1 only supports Linux.
A great God said, don't do ROS1, go directly to ROS2~~
Install ROS2 (foxy) to NVIDIA Jetson development kit
- Download my script: https://gitee.com/lhamojam/installROS2
- Or original address: https://github.com/jetsonhacks/installROS2
- Run script:
[*] be sure to surf the Internet scientifically
# Give permission sudo chmod u+x installROS2.sh # function ./installROS2
[*] join the communication group and communicate robot technology with small partners vx: artscript
note
NVIDIA Jetsons is currently running Ubuntu 18.04. ROS2 foxy requires Ubuntu 20.04. However, by providing some 20.04 equivalents, you can run ROS2 foxy on Jetsons. This script provides a workaround. Please note that this is not exhaustive, you may encounter gaps, and some packages may have problems.
Install ROS2
[*] be sure to hang up the Science Internet
We follow Official documents Install ros2 fox Fitzroy in Ubuntu 20.04:
Setup Locale
Ensure that the system supports UTF-8:
sudo locale-gen en_US en_US.UTF-8 sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 export LANG=en_US.UTF-8
Setup Sources
Add source of ROS2:
sudo apt update sudo apt install curl gnupg2 lsb-release # The following statement, my output error: gpg: no valid OpenPGP data found # curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - # To solve the above problem, you can replace it with the following statement: $ curl http://repo.ros2.org/repos.key | sudo apt-key add - # Add source later: sudo sh -c 'echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
Install ROS 2 packages
Update source
# There was a problem after the update sudo apt update N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'http://packages.ros.org/ros2/ubuntu focal InRelease' doesn't support architecture 'i386'
Refer to the BUG after ROS 2 installation. The solution is:
$ cd /etc/apt/sources.list.d $ sudo gedit ros2-latest.list # After opening the text: deb http://packages.ros.org/ros2/ubuntu bionic main # After deb, insert [arch=amd64] to become: deb [arch=amd64] http://packages.ros.org/ros2/ubuntu bionic main # Save and close # Just update again sudo apt update
Note: if there is a problem with the update, try updating more times
It is recommended to install ROS2 desktop version (including ROS, RViz, demos, tutorials)
sudo apt install ros-foxy-desktop
Setup Environment
Use footbook settings
- If your SHELL uses bash, it is:
source /opt/ros/foxy/setup.bash
- If your SHELL uses zsh, it is:
source /opt/ros/foxy/setup.zsh
- In the future, you need to input the above statement every time you open the terminal, which is more troublesome. Let's take zsh as an example to solve the problem:
$ echo "source /opt/ros/foxy/setup.zsh" >> ~/.zshrc $ source ~/.zshrc
In this way, you don't need to enter this annoying statement every time you open the terminal in the future. source /opt/ros/foxy/setup.zsh, the terminal will automatically load this statement and set the environment variable of ROS2
Install argcomplete (optional)
sudo apt install python3-argcomplete
Install RMW implementation
sudo apt update sudo apt install ros-foxy-rmw-connext-cpp
Try an example
Let's take an example to see if ROS2 is successfully installed:
- Open the first terminal and run C++ talker: ros2 run demo_nodes_cpp talker
- Open the second terminal and run Python listener: ros2 run demo_nodes_py listener
We can see that terminal 1 continuously sends [Hello World: xx], and terminal 2 continuously receives the information sent by terminal 1.
Unloading ROS2
sudo apt remove ros-foxy-* sudo apt autoremove
[*] join the communication group and communicate robot technology with small partners vx: artscript