ROS基本使用以及与kinect连接

使用平台

  • 14.04
  • ros indigo

安装步骤

  • sudo apt-get install libfreenect-dev
  • sudo apt-get install ros-indigo-freenect-launch

测试部分

运行kinect

roslaunch freenect_launch freenect.launch

运行image_view

rosrun rqt_image_view rqt_image_view

如果想用openni_launch,有时会因为驱动的问题而出现bug,显示No device connect…的情况,此时需要按照以下网站的步骤操作,安装驱动等

http://answers.ros.org/question/60562/ubuntu-12042-and-openni_launch-not-detecting-kinect-after-update/

显示图像

  • 显示原图

    rosrun image_view image_view image:=/camera/rgb/image_color
    
  • 显示视差图

    rosrun image_view disparity_view image:=/camera/depth/disparity
    
  • 使用技巧前面的参数按tab键就可以出来,后面的image:=等部分,需要填写当前的topics,而关于当前topics列表的查询可以通过rostopics list实现。

其他ros常用指令

  • 查看topic的类型

    rostopic type yourspecifiedtype
    

    比如若在运行openni_launch,则

    rostopic type /camera/rgb/image_color
    

    会返回sensor_msgs/Image的数据类型

  • 显示topic的值

    rostopic echo /camera/rgb/image_color
    

    topic有值时会显示

  • 显示msg的类型

    rosmsg Num
    
  • 显示srv的类型:表示输入数据类型和输出数据类型的一类文件

    rossrv AddTwoInts

猜你喜欢

转载自www.linuxidc.com/Linux/2017-03/141956.htm