realsense 使用IMU出错
已经参照blogs:
https://blog.csdn.net/weixin_46363611/article/details/114643088
将 realsense_ws/src/realsense2_camera/launch/rs_camera.launch 中launch文件内容修改,修改如下:
<arg name="enable_gyro" default="true"/>
<arg name="enable_accel" default="true"/>
修改之后需要删除realsense_ws中的devel 和 build 文件,重新执行catkin_make
如果catkin_make报错:
CMake Error at /opt/ros/noetic/share/catkin/cmake/empy.cmake:30 (message):
Unable to find either executable ‘empy’ or Python module ‘em’… try
…
Invoking “cmake” failed
解决办法:
终端实行如下,重新编译即可,如没有这个错误请跳过此步骤。
catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3
执行之后 source一下source devel/setup.zsh
或source devel/setup.bash
运行
roslaunch realsense2_camera rs_camera.launch
运行rostopic list
依然没有看到imu的话题。且报错如下:
[ERROR] [1664782650.663608546]: An exception has been thrown: Failed to open scan_element /sys/devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.5/0003:8086:0B3A.0006/HID-SENSOR-200076.3.auto/iio:device1/scan_elements/in_anglvel_x_en Last Error: Permission denied
[ERROR] [1664782650.663637692]: Exception: Failed to open scan_element /sys/devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.5/0003:8086:0B3A.0006/HID-SENSOR-200076.3.auto/iio:device1/scan_elements/in_anglvel_x_en Last Error: Permission denied
根据上述信息大致猜测是因为权限问题。
继续探索。。。。
终端执行
realsense-view
想打开Motion Module但也出错了,错误信息如下:
realsense-viewer realsense UDEV-Rules are missing UDEV-Rules permissions configuration
于是一切似乎明朗了:
应该为realsense的udev权限脚本
找到路径librealsense/scripts/
下的setup_udev_rules.sh
cd到librealsense下,先拔下所有摄像头,再执行
./scripts/setup_udev_rules.sh
即可解决。