raspberrypi 4b install ROS

本文详细介绍了在Raspberry Pi上安装ROS的过程,包括配置源、安装依赖、解决Boost库问题等关键步骤,同时提供了编译安装Boost库的教程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

参考:https://blog.youkuaiyun.com/sinat_23857245/article/details/45225147

# 编辑 `/etc/apt/sources.list` 文件,删除原文件所有内容,用以下内容取代:
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib

# 编辑 `/etc/apt/sources.list.d/raspi.list` 文件,删除原文件所有内容,用以下内容取代:
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

Linux下安装Boost1.58

  1. 首先登陆Boost官网(http://www.boost.org/)。

  2. 点击中间download下面的 Version 1.58.0,下载boost_1_58_0.tar.bz2。

  3. 解压下载文件

    tar --bzip2 -xvf boost_1_58_0.tar.bz2

  4. 进入解压后的文件,获得bjam

    cd boost_1_58_0

    ./bootstrap.sh

    可以看到在当前目录下生成了bjam文件

  5. 完整编译Boost

    ./bjam

    编译时间比较长

  6. 将生成的库默认安装到 /urs/local/lib 目录

    ./bjam install

    此时可以看到 /urs/local/lib 目录下包含了很多Boost文件

安装ros过程中找不到Boost

sudo ./src/catkin/bin/catkin_make_isolated --install -DBOOST_ROOT=/home/pi/boost_1_58_0 -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic

///START setup

sudo sh -c ‘echo “deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main” > /etc/apt/sources.list.d/ros-latest.list’
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install -y python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential cmake

sudo rosdep init
rosdep update

mkdir -p ~/ros_catkin_ws
cd ~/ros_catkin_ws

rosinstall_generator ros_comm --rosdistro kinetic --deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall
wstool init src kinetic-ros_comm-wet.rosinstall

(if wstool init fails or is interrupted, you can resume the download by running:
wstool update -j4 -t src )

mkdir -p ~/ros_catkin_ws/external_src
cd ~/ros_catkin_ws/external_src
wget http://sourceforge.net/projects/assimp/files/assimp-3.1/assimp-3.1.1_no_test_models.zip/download -O assimp-3.1.1_no_test_models.zip
unzip assimp-3.1.1_no_test_models.zip
cd assimp-3.1.1
cmake .
make
sudo make install

cd ~/ros_catkin_ws
rosdep install -y --from-paths src --ignore-src --rosdistro kinetic -r --os=debian:buster

sudo ./src/catkin/bin/catkin_make_isolated --install -DBOOST_ROOT=/home/pi/boost_1_58_0 -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic
( compilation will fail with an “internal compiler error” caused by memory exhaustion. A quick fix for this is to add swap space to the Pi and recompile. If the error persists try building with the -j2 option instead of the default -j4 option:

sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j2)

source /opt/ros/kinetic/setup.bash
echo “source /opt/ros/kinetic/setup.bash” >> ~/.bashrc

/end

Maintaining a Source Checkout
Updating the Workspace
See the Ubuntu source install instructions for steps on updating the ros_catkin_ws workspace. The same steps should apply to the Raspberry Pi.

Adding Released Packages
You may add additional packages to the installed ros workspace that have been released into the ros ecosystem. First, a new rosinstall file must be created including the new packages (Note, this can also be done at the initial install). For example, if we have installed ros_comm, but want to add ros_control and joystick_drivers, the command would be:

$ cd ~/ros_catkin_ws
$ rosinstall_generator actionlib astra_camera astra_launch bfl bond bondcpp tf serial ros_control joystick_drivers --rosdistro kinetic --deps --wet-only --tar > kinetic-custom_ros.rosinstall
You may keep listing as many ROS packages as you’d like separated by spaces.

Next, update the workspace with wstool:

$ wstool merge -t src kinetic-custom_ros.rosinstall
$ wstool update -t src
After updating the workspace, you may want to run rosdep to install any new dependencies that are required:

Raspbian Jessie:

$ rosdep install --from-paths src --ignore-src --rosdistro kinetic -y -r --os=debian:buster
Finally, now that the workspace is up to date and dependencies are satisfied, rebuild the workspace:

$ sudo ./src/catkin/bin/catkin_make_isolated --install -DBOOST_ROOT=/home/pi/boost_1_58_0 -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic

树莓派4B支持64位操作系统,因此可以安装64位版本的Raspberry Pi OS。ROS(Robot Operating System)是一个用于机器人软件开发的灵活框架,支持多种操作系统。要在64位的Raspberry Pi OS上安装ROS,可以遵循以下步骤: 1. 更新系统包列表和已安装的包: ```bash sudo apt update sudo apt upgrade ``` 2. 添加Debian软件仓库密钥: ```bash sudo apt install curl curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - ``` 3. 添加ROS软件源到你的源列表中(这里以ROS Noetic为例,适用于Ubuntu 20.04,也就是对应于树莓派的Raspberry Pi OS 64位版本): ```bash sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' ``` 4. 安装ROS Noetic桌面完整版: ```bash sudo apt install ros-noetic-desktop-full ``` 5. 为ROS环境设置初始化脚本: ```bash echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc source ~/.bashrc ``` 6. 安装依赖项以便编译和运行rosinstall工具: ```bash sudo apt install python3-rosdep python3-rosinstall-generator python3-rosinstall python3-wstool build-essential ``` 7. 初始化rosdep(rosdep是ROS的依赖管理工具),需要在系统中安装一些依赖: ```bash sudo apt install python3-rosdep sudo rosdep init rosdep update ``` 8. 现在你已经安装了ROS Noetic,可以开始使用ROS环境进行开发了。 请注意,安装ROS之前,需要确保你的树莓派4B已经安装了64位版本的Raspberry Pi OS,并且系统已经更新到最新版本。另外,安装ROS可能需要较大的磁盘空间,并且在安装过程中需要注意依赖关系和兼容性问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值