基础安装
1. 安装ROS
2. 安装Realsense驱动
更新
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install -y --no-install-recommends python3-setuptools python3-pip python3-dev
sudo apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
sudo apt-get install -y libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
编译realsense
cd ~/librealsense
mkdir build
cd build
rm -rf *
cmake ../ -DFORCE_RSUSB_BACKEND=ON -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=/usr/bin/python3
make -j6
sudo make install
配置环境变量
将pyrealsense写入~/.bashrc中:
sudo vim ~/.bashrc
写入以下内容:
export PYTHONPATH=$PYTHONPATH:/usr/local/lib:/usr/local/lib/python3.6/pyrealsense2
- 需要注意的是:如果你在之后的环境中需要使用Conda,需要指定新的环境重新编译。
3. ROS+Realsense环境安装
sudo apt-get install ros-melodic-realsense2-camera
下载Realsense ros包
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1`
cd ..
catkin_init_workspace
cd ..
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
- 编译报错:
ModuleNotFoundError: No module named 'em' 解决方法:
pip install rosdep rosinstall_generator wstool rosinstall six vcstools
pip install empy
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
roslaunch realsense2_camera rs_camera.launch
Octomap
参考文章:
环境配置
sudo apt-get install -y ros-melodic-imu-filter-madgwick
sudo apt-get install -y ros-melodic-rtabmap-ros
sudo apt-get install -y ros-melodic-robot-localization
安装octomap-ros:
sudo apt-get install -y ros-melodic-octomap*
运行
roslaunch realsense2_camera opensource_tracking.launch
roslaunch realsense2_camera rs_camera.launch filters:=pointcloud
roslaunch realsense2_camera rs_camera.launch align_depth:=true
参考文章:
|