Raspberry Pi 4b install ubuntu18.04 and install ros

Ubuntu officially supports Raspberry Pi, the official image is as follows

https://ubuntu.com/download/raspberry-pi

This is an ubuntu with arm architecture for Raspberry Pi, not ubuntu-mate, and the function is similar to that of the pc version of ubuntu, and it is a server version (server version, no desktop)

Unfortunately, the official website can only download the latest version 20 of ubuntu, and the link to version 18 of ubuntu given by a large number of online tutorials is no longer valid.

There are a lot of bugs in version 20, and the corresponding ros noetic version lacks arms and legs, so I still found the Raspberry Pi version corresponding to ubuntu18 and directly provided the link:

http://cdimage.ubuntu.com/releases/18.04/release/ubuntu-18.04.5-preinstalled-server-armhf+raspi4.img.xz
http://cdimage.ubuntu.com/releases/18.04/release/ubuntu-18.04.5-preinstalled-server-arm64+raspi4.img.xz

The above two URLs
armhf are 32bit, only support 3.8GB RAM,
arm64 is 64bit

I downloaded the arm64 version. After all, the Raspberry Pi 4b I purchased has 8G RAM (not storage, but RAM)

Download with Thunder! ! !
Download with Thunder! ! !
Browser download is too slow! ! ! Left me for more than an hour


Or go to
http://cdimage.ubuntu.com/ubuntu/releases/18.04.5/release/ and
choose Raspberry Pi 3 (64-bit ARM) preinstalled server image to download

http://cdimage.ubuntu.com/releases/

There are mirrors of various versions of Raspberry Pi ubuntu in this website

After downloading the .img image, decompress it and burn it to the SD card with win32Diskimager. Plug it into the Raspberry Pi and power it on and change the power-on password, then you can use it

 

Because it is a server version of ubuntu, there is only a command line interface to connect to the monitor after booting, and the wireless network card is not turned on by default.

The method to turn on the wireless network card and set wifi is:

https://blog.csdn.net/zyr920425/article/details/93351457

ip a

sudo vim /etc/netplan/xxxxxxx.yaml

Modify this yaml file as


network:
   version: 2
   ethernets:
       eth0:
           dhcp4: true
           match:
               macaddress: b8:27:eb:c6:94:8f
           set-name: eth0
   wifis:
       wlan0:
           dhcp4: true
           access-points:
               "wifi的ssid":
                   password: "wifi密码"

Then run try to perform the changes:

sudo netplan try

sudo netplan apply

Here wifi is set to auto dhcp, and ip is assigned automatically. If you want to set a static ip, including the problem of no wifi list after the subsequent graphical interface, you need to modify the yaml file to

network:
    ethernets:
        eth0:
            dhcp4: true
            optional: true
    version: 2
    renderer: NetworkManager
    wifis:
        wlan0:
             dhcp4: false
             addresses: [192.168.43.201/24]
             gateway4: 192.168.43.1
             nameservers:
                     addresses: [192.168.43.1, 114.114.114.114]
             access-points:
                     "wifi的名字":
                      password: "wifi密码"

Where addresses is to set the default ip and mask. nameservers is to set the dns address, two alternative addresses.

renderer: NetworkManager is to open networkmanager, so that the wifi list will appear in the graphical interface. Of course, the premise is that networkmanager has been installed

sudo apt install network-manager*

To download things with apt, it is best to change the domestic source, refer to https://blog.csdn.net/qq_27149279/article/details/105359840

Edit the apt source file and update it to the domestic mirror source (note: the path node is not ubuntu, but ubuntu-ports)

sudo vim /etc/apt/sources.list

Paste in the following sources:

deb https://mirrors.aliyun.com/ubuntu-ports/ bionic main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ bionic main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ bionic-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ bionic-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse

Let's talk about installing the graphical interface, I chose the xubuntu interface

sudo apt install xubuntu-desktop

After waiting for half an hour, reboot will do.

The graphical interface may cause serious mouse lag. The general online solution is wrong, correct solution:

https://blog.csdn.net/sxdmsr_/article/details/107325703

sudo vim /boot/firmware/nobtcmd.txt

Add at the end of the file

usbhid.mousepoll=0

Just restart

Time zone settings can be modified in time and date in the graphical interface

Close the graphical interface method:

sudo systemctl set-default multi-user.target
sudo reboot

Open the graphical interface method:

sudo systemctl set-default graphic.target
sudo reboot

However, the graphic interface cpu is on, and the memory usage is not large, about 10%

You can also modify the boot option in raspi-config whether it is console login or desktop login

Install ros-melodic and mavros, nothing to say, just install under normal ubuntu. Note that rosdep init is not used

This set can save a mirror image for easy porting to other Raspberry Pi.

 

Guess you like

Origin blog.csdn.net/benchuspx/article/details/110939265