raspberry4B安装realsenseD435驱动

前言

最近有一个需求是开发raspberry在树莓派上实现realsense D435相机驱动的开发,没有现成的驱动需要手动编译,并且网上查到的大多是树莓派安装Ubuntu 22.04或20.04等系统,需要重新下载树莓派镜像刷系统,博主树莓派当前已经安装了官方2023-02-21-raspios-bullseye-arm64-full的系统,所以想是否能够docker方式实现环境配置安装。

本文主要记录如何实现再现有系统下实现驱动编译安装。

一、编译安装流程

git clone https://github.com/IntelRealSense/librealsense.git
cd librealsense
git fetch --all --tags
git checkout v2.54.2
mkdir build && cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true -DFORCE_RSUSB_BACKEND=ON
sudo make uninstall && make clean && make -j4 && sudo make install
cd ..
./scripts/patch-realsense-ubuntu-lts-hwe.sh


apt二进制安装

sudo mkdir -p /etc/apt/keyrings
curl -sSf https://librealsense.intel.com/Debian/librealsense.pgp | sudo tee /etc/apt/keyrings/librealsense.pgp > /dev/null

echo "deb [signed-by=/etc/apt/keyrings/librealsense.pgp] https://librealsense.intel.com/Debian/apt-repo `lsb_release -cs` main" | \
sudo tee /etc/apt/sources.list.d/librealsense.list
sudo apt-get update

sudo apt-get install librealsense2-utils

卸载单个

sudo apt-get purge <package-name>
# 例如 sudo apt-get purge librealsense2-udev-rules

卸载所有realsense相关包

dpkg -l | grep "realsense" | cut -d " " -f 3 | xargs sudo dpkg --purge

ROS2启动

export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export ROS_DOMAIN_ID=30
ros2 launch realsense2_camera rs_launch.py pointcloud.enable:=true align_depth.enable:=true depth_module.profile:=640x480x30 rgb_camera.profile:=1280x720x30
$ ros2 topic list -v
Published topics:
 * /camera/color/camera_info [sensor_msgs/msg/CameraInfo] 1 publisher
 * /camera/color/image_raw [sensor_msgs/msg/Image] 1 publisher
 * /camera/color/metadata [realsense2_camera_msgs/msg/Metadata] 1 publisher
 * /camera/depth/camera_info [sensor_msgs/msg/CameraInfo] 1 publisher
 * /camera/depth/image_rect_raw [sensor_msgs/msg/Image] 1 publisher
 * /camera/depth/metadata [realsense2_camera_msgs/msg/Metadata] 1 publisher
 * /camera/extrinsics/depth_to_color [realsense2_camera_msgs/msg/Extrinsics] 1 publisher
 * /camera/imu [sensor_msgs/msg/Imu] 1 publisher
 * /parameter_events [rcl_interfaces/msg/ParameterEvent] 2 publishers
 * /rosout [rcl_interfaces/msg/Log] 2 publishers
 * /tf_static [tf2_msgs/msg/TFMessage] 1 publisher

Subscribed topics:
 * /parameter_events [rcl_interfaces/msg/ParameterEvent] 1 subscriber

总结

本文用来记录arm硬件如何安装实现realsense驱动。

参考:

  1. 【精华】ROS学习(二):Realsense ROS驱动安装
  2. 树莓派4 ubuntu22.04LTS整合Intel Realsense深度相机
  3. RealSense相机在ros2环境的安装
  4. 树莓派4B安装RealSense D435i相机详细教程
03-08 23:19