Install Ubuntu20.04+ros-noetic on Raspberry Pi 4b
- foreword
- 1. Mirror download
- 2. Burning system
- 3. System initialization
- 3. Change domestic sources
- Fourth, install the desktop environment
- 5. Install the ROS environment
foreword
This article introduces the installation steps of Raspberry Pi to install Ubuntu, and supports various versions of Ubuntu
The following is the text of this article for reference
1. Mirror download
The latest version of Ubuntu (Ubuntu20.04) for Raspberry Pi can be downloaded from the Ubuntu official website
For historical versions of Ubuntu, it is recommended to use the mirror website to download http://cdimage.ubuntu.com/releases/
2. Burning system
1. Insert the TF card, first format the TF card
Just choose a method:
2. Burn image
Method 1. Official burning software Raspberry Pi Imager
Connect to Raspberry Pi Imager
Download and install and open
Select the image to burn in CHOOSE OS Select
the Raspberry Pi Ubuntu image to burn
Select the TF card to burn and burn
Method 2. Win32DiskImager
3. After burning, the system will prompt that the U disk needs to be formatted, and it must not be formatted at this time! ! ! , eject the TF card, insert the Raspberry Pi, and initialize the system
3. System initialization
It is recommended to use a monitor, mouse and keyboard, which will be much simpler
1. Initial login
After the system is initialized, you will be prompted to enter the user name and password. The user name and password here are both ubuntu
2. Change password
After logging in for the first time, the system will prompt to change the password
提示输入当前用户名current user,输入ubuntu
接下来输入两次新密码,完成密码修改
3. Change domestic sources
If you change your country, you can download software and dependencies faster
1. Search commonly used domestic sources, such as Tsinghua source, Ali source, Zhongke University source
Aliyuan Aliyuan is selected here
2. Change source.list
the file
First of all source.list
, the backup is used for source.list
file restoration,
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
If you want to source.list
restore
sudo cp /etc/apt/sources.list.bak /etc/apt/sources.list
Terminal input, open source.list
file
sudo nano /etc/apt/sources.list
Replace all URLs in it with http://mirrors.aliyun.com/ubuntu-ports/
the final effect
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiv>
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe m>
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted univer>
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe mu>
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted univers>
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe m>
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted univer>
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe >
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted unive>
implement
sudo apt-get updata
sudo apt-get upgrade
If no error is reported, the source change is successful
Fourth, install the desktop environment
sudo apt-get install ubuntu-desktop
Restart the system to see the Ubuntu classic desktop
roboot
5. Install the ROS environment
1. Add ROS software source and import Key
It is recommended to use domestic software sources here. The ROS download file is large and takes a long time. Using domestic ROS software sources can reduce the ROS download time.
How to use the domestic ROS software source can be queried on the official website of the software source:
Take the software source of University of Science and Technology of China as an example:
在web中搜索中科大源
找到ros,点击右侧Help
#按照提示安装即可
#添加软件源
sudo sh -c 'echo "deb https://mirrors.ustc.edu.cn/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
#导入KEY
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
#更新软件源缓存
sudo apt update
2. Install the desktop full version
sudo apt install ros-noetic-desktop-full
The installation process takes a long time, so be patient.
3. Set environment variables
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
4. ROS initialization
It is not recommended to use the official rosdep
initialization tutorial here, as it is prone to problems such as failure to connect, and the success rate of using domestic sources is higher. Here I use Xiaoyu ROS to solve the initialization method, and the success rate is higher.
sudo apt-get install python3-pip
sudo pip install rosdepc
sudo rosdepc init
rosdepc update
5. ROS test (roscore and little turtle)
(1) roscore test
roscore
(2)rosrun turtlesim turtlesim_node
rosrun turtlesim turtlesim_node
打开小海龟仿真界面
(3)rosrun turtlesim turtle_teleop_key
rosrun turtlesim turtle_teleop_key
通过键盘控制小海龟运动
Seeing the movement of the little turtle means that the ROS installation is successful.