Install librealsense2 on Jetson nx
1, Prepare microSD card with JetPack4.5.1
- Download JetPack image
- Burn by balenaEtcher
2, Install ROS Melodic
- follow this wiki
http://wiki.ros.org/melodic/Installation/Ubuntu
3, Install Librealsense2 SDK
-Update Ubuntu
$ sudo apt-get update && sudo apt-get upgrade
-Download the complete source tree with git
$ git clone https://github.com/IntelRealSense/librealsense.git
$ cd librealsense
-Install requirements
$ sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
$ sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev at
- Setup udev for realsense, please remove realsense from USB
$ ./scripts/setup_udev_rules.sh
-Build and install librealsense2 SDK
$ cmake ../ -DBUILD_EXAMPLES=true
$ sudo make uninstall && make clean && make && sudo make install
4, Install ROS Wrapper for RealSense device
-Set path for OpenCV
$ sudo ln -s /usr/include/opencv4/ /usr/include/opencv
-Create a catkin workspace Ubuntu
$ sudo apt install python-catkin-tools
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin init
- Clone the latest Intel RealSense ROS wrapper
$ cd ~/catkin_ws/src/
$ git clone https://github.com/IntelRealSense/realsense-ros.git
$ cd realsense-ros/src
$ git checkout master
$ cd ..
$ rosdep install --from-path src --ignore-src -r -y
$ catkin build
$ cd ..
$ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
$ source ~/.bashrc
5, SLAM with RealSense
- Install components
imu_filter_madgwick, rtabmap-ros, robot_localization
$ sudo apt-get install ros-melodic-imu-filter-madgwick
$ sudo apt-get install ros-melodic-rtabmap-ros
$ sudo apt-get install ros-melodicc-robot-localization
- Get serial number from realsense device and put them in "opensource_tracking.launch"
$ rs-enumerate-device
- Running:
$ roslaunch realsense2_camera opensource_tracking.launch
- Visit
https://github.com/IntelRealSense/realsense-ros/wiki/SLAM-with-D435i
- Improve performance cuda should be activated, however you need Python 3.8 and I did not try;
$ cmake .. -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=release -DFORCE_RSUSB_BACKEND=false -DBUILD_WITH_CUDA=true && make -j$(($(nproc)-1)) && sudo make install
- Run with 1st terminal
$ roslaunch realsense2_camera rs_aligned_depth.launch
And 2nd terminal
$ roslaunch rtabmap_ros rtabmap.launch rtabmap_args:="--delete_db_on_start" depth_topic:=/camera/aligned_depth_to_color/image_raw rgb_topic:=/camera/color/image_raw camera_info_topic:=/camera/color/camera_info