树莓派5 Raspberry Pi OS 安装 ROS

炒鸡管理员 Views: 213 Column: ROS Edit Time: {{ "20240920195526".amazdatetimeformat() }}

ROS官网 https://www.ros.org/

从源码安装:

官方文档 https://wiki.ros.org/noetic/Installation/Source

1. 安装bootstrap依赖

$ python -m pip install -U rosdep rosinstall_generator vcstool

1.1 如果不想安装到系统的python环境中,可以指定Python。安装结束后ROS相关的可执行文件在对应python的bin目录下,必要时需手动建立连接

$ whereis python311 
python311: /usr/bin/python311 /usr/local/python311

$ ls -lah /usr/local/python311/bin/ros
rosdep                        rosdistro_migrate_to_rep_143
rosdep-source                 rosdistro_reformat
rosdistro_build_cache         rosinstall_generator
rosdistro_freeze_source       rosversion
rosdistro_migrate_to_rep_141

$ sudo ln -s /usr/local/python311/bin/ros* /usr/bin/
$ sudo ln -s /usr/local/python311/bin/vcs* /usr/bin/

2. 本地编译安装

$ sudo rosdep init
$ rosdep update

输出

$ sudo rosdep init
Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run

	rosdep update

$ rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Skip end-of-life distro "dashing"
Skip end-of-life distro "eloquent"
Skip end-of-life distro "foxy"
Skip end-of-life distro "galactic"
Skip end-of-life distro "groovy"
Add distro "humble"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Add distro "iron"
Skip end-of-life distro "jade"
Add distro "jazzy"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Skip end-of-life distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/fire0517/.ros/rosdep/sources.cache

如果提示找不到命令,参加1.1

$ sudo rosdep init
sudo: rosdep: 找不到命令

2.1 下载ROS源码

在home目录下创建catkin工作区,并下载源码

$ mkdir ~/ros_catkin_ws
$ cd ~/ros_catkin_ws

$ rosinstall_generator desktop --rosdistro noetic --deps --tar > noetic-desktop.rosinstall
$ mkdir ./src
$ vcs import --input noetic-desktop.rosinstall ./src

2.2 安装依赖项

$ rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro noetic -y

提示缺少必要组件

$ rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro noetic -y
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
rviz: No definition of [libogre-dev] for OS version [bookworm]
rosconsole: No definition of [log4cxx] for OS version [bookworm]

尝试apt安装libogre和log4cxx提示找不到

参考https://gist.github.com/vrbadev/ec168a0940d45f523bf050011d7dff75

下载安装需要的包,记得把镜像地址改成cn

$ wget https://mirrors.ustc.edu.cn/debian/pool/main/o/ogre-1.12/libogre-1.12-dev_1.12.10%2Bdfsg2-3%2Bb1_arm64.deb
$ wget https://mirrors.ustc.edu.cn/debian/pool/main/o/ogre-1.12/libogre1.12.10_1.12.10%2Bdfsg2-3%2Bb1_arm64.deb
$ wget https://mirrors.ustc.edu.cn/debian/pool/main/l/log4cxx/liblog4cxx15_1.0.0-1_arm64.deb
$ wget https://mirrors.ustc.edu.cn/debian/pool/main/l/log4cxx/liblog4cxx-dev_1.0.0-1_arm64.deb
$ sudo apt install ./*.deb

2.3 编译

./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 -DSETUPTOOLS_DEB_LAYOUT=OFF

2.3.1 若提示

No module named 'catkin'

则不要pip安装catkin,这个包在src/catkin/python/下

2.3.2 若提示关于找不到或者让你下载或者安装

/usr/src/gmock

则不需要管他,用gtest建一个连接即可 

$ sudo ln -s /usr/src/gtest/ /usr/src/gmock

2.3.3 若提示

error: option --install-layout not recognized

则在2.3编译语句后加上

 -DSETUPTOOLS_DEB_LAYOUT=OFF

参考资料 https://blog.51cto.com/u_16099211/11145391

2.3.4 若提示

Could not find a package configuration file provided by "boost_thread"

则安装依赖

$ sudo apt install libboost-thread-dev

2.3.5 找不到console-bridge

$ sudo apt install libconsole-bridge-dev

2.3.6 提示找不到Poco

Poco was not found.

apt安装 

$ sudo apt-get install libpoco-dev

2.3.7 提示找不到boost_filesystem

Could not find a package configuration file provided by "boost_filesystem"

apt安装即可

$ sudo apt install libboost-filesystem-dev

2.3.8 找不到boost_program_options

Could not find a package configuration file provided by
  "boost_program_options"

还是安装

$ sudo apt install libboost-program-options-dev

2.3.9 TinyXML2

同理

$ sudo apt install libtinyxml2-dev

2.3.10 rosconsole的问题

参考 https://blog.csdn.net/qq_43106548/article/details/140615665

 

Give a reward if you like!