build my car(1)

网络搭建

首先配置raspberry pi和ubuntu 20.04(开发机)到一个网络,建议买一个GL-MT300N-V2,然后把两台ip都配置到192.168.3.*

1
2
192.168.3.119 pi
192.168.3.120 robot

robot is the dev machine, and pi is my raspberry pi.

config /etc/netplan/50-cloud-init.yaml on dev machine.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
network:
version: 2
ethernets:
renderer: networkd
enp0s5:
dhcp4: no
addresses:
- 192.168.3.120/24
routes:
- to: default
via: 192.168.3.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
optional: true

ubuntu server 20.04 connect to wifi

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
network:
version: 2
ethernets:
eth0:
dhcp4: true
optional: true
wifis:
renderer: networkd
wlan0:
dhcp4: no
addresses:
- 192.168.3.119/24
routes:
- to: default
via: 192.168.3.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
access-points:
"gl":
password: "4da86c9782081b654f1cca03590bebf374da6084aad4c2e471aa99cdb33a144f"
optional: true

树莓派(Raspberry Pi) 设置静态IP/连接Wi-Fi

安装ros2相关工具

目前humble有点问题,所以装foxy,可以的镜像是ubuntu-20.04.5-preinstalled-server-armhf+raspi.img.xz

初始化项目

登录开发机。

1
2
3
4
5
mkdir ~/code/dev_ws/src -p
cd ~/code/dev_ws/src
git clone git@github.com:joshnewans/my_bot.git
cd ..
colcon build --symlink-install

launch

1
2
3
cd ~/code/dev_ws/
source install/setup.bash
ros2 launch my_bot rsp.launch.py