Intel Realsense camera - ashBabu/Utilities GitHub Wiki
Udev rules issues with Intel NUC
- All software were installed from APT yet the following error came
ERROR [132977812047424] (librealsense-exception.h:52) Failed to open scan_element /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.5/0003:8086:0B5C.0001/HID-SENSOR-200076.3.auto/iio:device1/scan_elements/in_anglvel_x_en Last Error: Permission denied
Hid device is busy!
when ran the command ros2 launch realsense2_camera rs_launch.py enable_accel:=true enable_gyro:=true unite_imu_method:=2
. The error was because of the arguments enable_accel:=true enable_gyro:=true unite_imu_method:=2
which enables the topic /camera/imu
. This was solved by adding a custom udev rule
in the Intel NUC
sudo nano /etc/udev/rules.d/99-realsense-imu.rules
. Add the following two linesSUBSYSTEM=="iio", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0B5C", MODE="0666"
SUBSYSTEM=="iio", ATTR{name}=="accel_3d|gyro_3d", MODE="0666"
sudo udevadm control --reload-rules
sudo udevadm trigger
Then it worked.
Intel realsense camera with Raspberry Pi 4b
ROS Noetic, librealsense 2.50, realsense-ros 2.3.2
- Need an microsd card, a microsd-SD adapter and another computer that can read and flash the microsd card with the appropriate OS
Follow this tutorial or the following. No kernal patching required for Rpi
-
In another computer,
-
sudo apt-get install rpi-imager or snap install rpi-imager
-
Open the imager and use the dropdown menu to select the OS version (Ubuntu server 20.04 for me) and where to write to (microSD card) and write
-
Put the microusb in the rPi slot and it would take on to the installation screen and will take a few minutes to finish
Follow the steps without the kernal patch as shown in this
-
Clone the librealsense (the required version, 2.50) and build it with
cmake ../ -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true -DFORCE_RSUSB_BACKEND=ON
-
make -j$(nproc)
NOTE: if the command sudo apt-get install ros-noetic-realsense2-camera
is used, then it automatically install librealsense
which may or may not match the version required for Rpi.
Observations
The rPi was able to run the realsense-viewer and the camera showed both RGB and depth images. After running it for a few minutes, the rPi automatically rebooted. I suspect this could be because of overheating as the rPi was very hot to touch.
librealsense from source to work with OpenCV
CompilingDetailed Installation Instructions
- librealsense SDK needs OpenCV 3.4 (here) (as on 06/12/2021)
- Build OpenCV from Source
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
git clone https://github.com/IntelRealSense/librealsense.git
sudo apt-get install git libssl-dev libusb-1.0-0-dev libudev-dev pkg-config libgtk-3-dev
- For Ubuntu 18.04/20/22
sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
cd librealsense && ./scripts/setup_udev_rules.sh
./scripts/patch-realsense-ubuntu-lts.sh
for 18.04./scripts/patch-realsense-ubuntu-lts-hwe.sh
for 20/22export OpenCV_DIR=~/opencv/build (~/opencv/build is the folder containing OpenCVConfig.cmake
mkdir build && cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true -DBUILD_CV_EXAMPLES=true
sudo make uninstall && make clean && make -j$(nproc) && sudo make install
Github)
Installation (ROS specific)(-
sudo apt-get install ros-$ROS_DISTRO-realsense2-camera
# This will install both realsense2_camera and its dependencies, including librealsense2 library and matching udev-rules -
sudo apt-get install ros-$ROS_DISTRO-realsense2-description
Start the camera
roslaunch realsense2_camera rs_camera.launch filters:=pointcloud
OR
-
roslaunch realsense2_camera rs_camera.launch align_depth:=true
-
rosrun rviz rviz
-
Add
PointCloud2-->/camera/depth/color/points
Check out Github for more helpful tips. What I have is D435i