1.介绍
准备工作:
首先需要在Ubuntu中安装Ros(Ubuntu16.04对应的Ros版本为ROS Kinetic),关于Ubuntu下Ros的安装大家可参考下面网址:
2.安装RealSense的Ros包
Install Intel® RealSense™ ROS from Sources
Create a catkin workspace
$mkdir -p ~/catkin_ws/src
$cd ~/catkin_ws/src/
Clone the latest Intel® RealSense™ ROS from here into catkin_ws/src/
https://github.com/IntelRealSense/realsense-ros/releases
$catkin_init_workspace
$cd ..
$catkin_make clean
$catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
$catkin_make install
$echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
若编译时出现
realsense2_camera/src/base_realsense_node.cpp:363:14: error: ‘class ddynamic_reconfigure::DDynamicReconfigure’ has no member named ‘publishServicesTopics’ ddynrec->publishServicesTopics();
原因:
IntelRealSense-Ros上缺少DDynamic_reconfigure(被intel删掉了),因此需要安装DDynamic_reconfigure
解决办法:
sudo apt-get install ros-kinetic-ddynamic_reconfigure (没有效果)
需要进入
https://github.com/pal-robotics/ddynamic_reconfigure 下载源码DDynamic_reconfigure,将源码放到catkin_ws/src/
下再重新catkin_make
3.使用
安装好RealSense的Ros包后,打开终端使用下面指令查看
$roslaunch realsense2_camera rs_rgbd.launch(或者roslaunch realsense2_camera rs_camera.launch)
$rostopic echo /camera/color/camera_info
4.问题
ResourceNotFound: rgbd_launch
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
Traceback (most recent call last):
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/__init__.py", line 307, in main
p.start()
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 268, in start
self._start_infrastructure()
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 217, in _start_infrastructure
self._load_config()
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 132, in _load_config
roslaunch_strs=self.roslaunch_strs, verbose=self.verbose)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/config.py", line 451, in load_config_default
loader.load(f, config, verbose=verbose)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 746, in load
self._load_launch(launch, ros_config, is_core=core, filename=filename, argv=argv, verbose=verbose)
..........................................
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 329, in _resolve_args
resolved = commands[command](resolved, a, args, context)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 142, in _find
source_path_to_packages=source_path_to_packages)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 188, in _find_executable
full_path = _get_executable_path(rp.get_path(args[0]), path)
File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 203, in get_path
raise ResourceNotFound(name, ros_paths=self._ros_paths)
ResourceNotFound: rgbd_launch
解决办法:
sudo apt-get install ros-kinetic-rgbd-launch
具体可参考网址:https://github.com/IntelRealSense/realsense-ros