开放下载连接
——回复可见内容——
1.准备工作
1)环境: 树莓派4b 8GB arm64 平台硬件
2)下载官方 2022-04-04-raspios-bullseye-arm64.img.xz 镜像
3)烧录镜像至TF卡32GB上
2.系统构建
1)将烧录完的tf卡中的boot盘中的文件进行修改
windows cmd:
打开TF卡,文件boot 目录下建立文件
G:>type nul>ssh
G:>>>userconf set /p=“pi:6 66KORC/Q.jy9sfO4dY$Ng2/O021CmodjQ99aPm.kpG4s1ClxvfQN0UylymYN/AYGySUBV6mnPlLDD24YrckXldGR9ZWO3NvOazzNLhBe1” <nul
G:>>>wpa_supplicant.conf set /p="country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
" <nul
注意指令前的”G:>“ 系统自带字符
然后用notepad打开wpa_supplicant.conf 查看下文件,注意换行符
然后将TF卡插到树莓派上,开机启动。
后执行
G:>arp -a
接口: 192.168.193.137 — 0x13
Internet 地址 物理地址 类型
192.168.193.1 d4-ee-07-62-f5-76 动态
192.168.193.239 e4-5f-01-c2-98-51 动态
192.168.193.255 ff-ff-ff-ff-ff-ff 静态
192.168.193.239 树莓派 地址
2)ssh树莓派登陆
用户名:pi
密码:raspberry
3.正式动作
$ mkdir -p ~/ros2_rolling/src
$ cd ~/ros2_rolling
1)系统信息
pi@raspberrypi:~/ros2_rolling $ uname -a
Linux raspberrypi 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux
pi@raspberrypi:~/ros2_rolling $ lsb_release
No LSB modules are available.
pi@raspberrypi:~/ros2_rolling $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
pi@raspberrypi:~/ros2_rolling $
2)ros2 环境构建
$ locale
LANG=en_GB.UTF-8
LANGUAGE=
LC_CTYPE=“en_GB.UTF-8”
LC_NUMERIC=“en_GB.UTF-8”
LC_TIME=“en_GB.UTF-8”
LC_COLLATE=“en_GB.UTF-8”
LC_MONETARY=“en_GB.UTF-8”
LC_MESSAGES=“en_GB.UTF-8”
LC_PAPER=“en_GB.UTF-8”
LC_NAME=“en_GB.UTF-8”
LC_ADDRESS=“en_GB.UTF-8”
LC_TELEPHONE=“en_GB.UTF-8”
LC_MEASUREMENT=“en_GB.UTF-8”
LC_IDENTIFICATION=“en_GB.UTF-8”
LC_ALL=
$ apt-cache policy | grep universe
此处信息不必对照官网
$ vi /etc/apt/sources.list
aarch64 用户:编辑 /etc/apt/sources.list 文件,用以下内容取代:
默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install software-properties-common
$ sudo apt update && sudo apt install curl gnupg lsb-release
$ sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
$ echo “deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu/ lsb_release -cs main” | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
$ sudo apt update && sudo apt install -y \
build-essential \
cmake \
git \
python3-colcon-common-extensions \
python3-flake8 \
python3-flake8-blind-except \
python3-flake8-builtins \
python3-flake8-class-newline \
python3-flake8-comprehensions \
python3-flake8-deprecated \
python3-flake8-docstrings \
python3-flake8-import-order \
python3-flake8-quotes \
python3-pip \
python3-pytest \
python3-pytest-cov \
python3-pytest-repeat \
python3-pytest-rerunfailures \
python3-rosdep \
python3-setuptools \
python3-vcstool \
wget
(this command can altenative by below :
$ sudo apt update && sudo apt install -y
build-essential
cmake
git
python3-colcon-common-extensions
python3-flake8
python3-pip
python3-pytest
python3-pytest-cov
python3-pytest-rerunfailures
python3-rosdep
python3-setuptools
python3-vcstool
wget
$ pip install -i https://pypi.tuna.tsinghua.edu.cn/simple \
flake8-blind-except \
flake8-builtins \
flake8-class-newline \
flake8-comprehensions \
flake8-deprecated \
flake8-docstrings \
flake8-import-order \
flake8-quotes \
pytest-repeat
)
$ sudo rosdep init
(please copy pre-downloade rosdistro/ into ~/)
$ sudo vi /home/pi/rosdistro/rosdep/sources.list.d/20-default.list
{ # os-specific listings first yaml file:///home/pi/rosdistro/rosdep/osx-homebrew.yaml osx # generic yaml file:///home/pi/rosdistro/rosdep/base.yaml yaml file:///home/pi/rosdistro/rosdep/python.yaml yaml file:///home/pi/rosdistro/rosdep/ruby.yaml gbpdistro file:///home/pi/rosdistro/releases/fuerte.yaml fuerte # newer distributions (Groovy, Hydro, …) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead }
$ sudo vi /etc/ros/rosdep/sources.list.d/20-default.list
{ # os-specific listings first yaml file:///home/pi/rosdistro/rosdep/osx-homebrew.yaml osx # generic yaml file:///home/pi/rosdistro/rosdep/base.yaml yaml file:///home/pi/rosdistro/rosdep/python.yaml yaml file:///home/pi/rosdistro/rosdep/ruby.yaml gbpdistro file:///home/pi/rosdistro/releases/fuerte.yaml fuerte # newer distributions (Groovy, Hydro, …) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead }
$ sudo vi /usr/lib/python3/dist-packages/rosdep2/sources_list.py
DEFAULT_SOURCES_LIST_URL = ‘file:///home/pi/rosdistro/rosdep/sources.list.d/20-default.list’
$ sudo vi /usr/lib/python3/dist-packages/rosdistro/init.py
DEFAULT_INDEX_URL = ‘file:///home/pi/rosdistro/index-v4.yaml’
$ sudo vi /usr/lib/python3/dist-packages/rosdep2/rep3.py
REP3_TARGETS_URL = ‘file:///home/pi/rosdistro/releases/targets.yaml’
$ rosdep update
$ wget https://raw.githubusercontent.com/ros2/ros2/rolling/ros2.repos
$ vcs import src < ros2.repos
{windows shell > vcs import --input ros2.rpos src here, you can pre-download ros2 rolling package into src/ pi@raspberrypi:~/ros2_rolling $ ls src ament eclipse-iceoryx ignition ros ros-perception ros-tooling sllidar_ros2 eclipse-cyclonedds eProsima osrf ros2 ros-planning ros-visualization pi@raspberrypi:~/ros2_rolling $ }
(try below command ,
rosdep install --from-paths src --ignore-src -y --skip-keys “ignition-cmake2 ignition-math6 fastcdr rti-connext-dds-6.0.1 urdfdom_headers”
it will trigger warnning
#ignition-cmake2 ignition-math6 can’t support os debian , ok then skip it
)
$ rosdep install --from-paths src --ignore-src -y --skip-keys “ignition-cmake2 ignition-math6 fastcdr rti-connext-dds-6.0.1 urdfdom_headers”
{ it will be trgger some error ,so you install it manuelly, then excute it continue. after a long time … }
$ cd ~/ros2_rolling/
$ colcon build --symlink-install
(please keep connectting net fluently and your patient for a long long time
if you can’t , you can donwnload some pakage into build/ souce , bless you
)
…
{ $ colcon build --packages-select sllidar_ros2 (build special package) }
test ros2 rolling envirenment
first terminal
$ . ~/ros2_rolling/install/local_setup.bash
ros2 run demo_nodes_cpp talker
second terminal
$ . ~/ros2_rolling/install/local_setup.bash
ros2 run demo_nodes_py listener
then you can excute talker on raspberry 4b board and excute listener on a ubuntu host terminal