ROS探索总结(三十)——3D地图建模

  • 内容
  • 评论
  • 相关

        今天正好有时间,尝试了一下3D地图建模,记录一下流程:

一、安装rgbdslam功能包

    在工作空间中下载代码并解压:

  1. wget -q http://github.com/felixendres/rgbdslam_v2/archive/indigo.zip
  2. unzip -q indigo.zip

    然后回到catkin_ws的目录下,安装依赖:

  1. rosdep install rgbdslam
  2. rosdep update

    依赖包安装完成后,就可以开始编译了:

  1. catkin_make

    编译成功后,就可以准备建模了。

 

二、开始3D建模

    先把kinect运行起来,然后开始建模。

  1. roslaunch freenect_launch freenect.launch
  2. roslaunch rgbdslam rgbdslam.launch

    可以把kinect放在机器人上,让机器人扫描室内的模型,也可以直接用手转动kinect,同样可以进行建模。按空格键可以停止或者开始建模。

clip_image002

 

 

三、保存并回看地图

    建模完成后,直接在菜单栏中选择保存成点云数据即可,然后就可以通过pcl_roshttp://wiki.ros.org/pcl_ros )来查看保存的点云地图了:

  1. rosrun pcl_ros pcd_to_pointcloud quicksave.pcd

    rviz中显示pointcloud2数据:

clip_image004

 

参考资料

视觉SLAM实战(一):RGB-D SLAM V2 http://www.cnblogs.com/gaoxiang12/p/4462518.html

RGBDSLAMv2https://github.com/felixendres/rgbdslam_v2

 


原创文章,转载请注明: 转载自古月居

本文链接地址: ROS探索总结(三十)——3D地图建模

微信 OR 支付宝 扫描二维码
为本文作者 打个赏
pay_weixinpay_weixin

评论

14条评论
  1. Gravatar 头像

    罗西 回复

    月哥,我想在地图上以地图编辑的形式设置导航点,就是在地图上画路径,想问一下有什么方法可以做到?

    • 古月

      古月 回复

      @罗西 类似于全局路径规划出来的路线么?可以看下这个路径的显示插件需要订阅的数据

  2. Gravatar 头像

    candy 回复

    请问各位大牛,有人在ubutun16.04 & ROS kinetic版本上实测过该节内容吗?
    到catkin_make就编译失败了
    [ 60%] Building CXX object rgbdslam_v2/CMakeFiles/rgbdslam.dir/src/moc_qtros.cpp.o
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:15:2: error: #error "This file was generated using the moc from 5.5.1. It"
    #error "This file was generated using the moc from 5.5.1. It"
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:16:2: error: #error "cannot be used with the include files from this version of Qt."
    #error "cannot be used with the include files from this version of Qt."
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:17:2: error: #error "(The moc has changed too much.)"
    #error "(The moc has changed too much.)"
    ^
    In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/QThread:1:0,
    from /root/catkin_ws/build/rgbdslam_v2/src/../../../src/rgbdslam_v2/src/qtros.h:28,
    from /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:9:
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qthread.h:53:39: error: expected ‘;’ at end of member declaration
    static Qt::HANDLE currentThreadId() Q_DECL_NOTHROW;
    ^
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qthread.h:53:41: error: ‘Q_DECL_NOTHROW’ does not name a type
    static Qt::HANDLE currentThreadId() Q_DECL_NOTHROW;
    ^
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qthread.h:55:33: error: expected ‘;’ at end of member declaration
    static int idealThreadCount() Q_DECL_NOTHROW;
    ^
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qthread.h:55:35: error: ‘Q_DECL_NOTHROW’ does not name a type
    static int idealThreadCount() Q_DECL_NOTHROW;
    ^
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qthread.h:92:29: error: expected ‘;’ at end of member declaration
    bool event(QEvent *event) Q_DECL_OVERRIDE;
    ^
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qthread.h:92:31: error: ‘Q_DECL_OVERRIDE’ does not name a type
    bool event(QEvent *event) Q_DECL_OVERRIDE;
    ^
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qthread.h:109:18: error: ‘QPrivateSignal’ has not been declared
    void started(QPrivateSignal);
    ^
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qthread.h:110:19: error: ‘QPrivateSignal’ has not been declared
    void finished(QPrivateSignal);
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:22:5: error: ‘QByteArrayData’ does not name a type
    QByteArrayData data[4];
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:28:24: error: ‘QByteArrayData’ was not declared in this scope
    - idx * sizeof(QByteArrayData)) \
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:32:1: note: in expansion of macro ‘QT_MOC_LITERAL’
    QT_MOC_LITERAL(0, 0, 5), // "QtROS"
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:29:5: error: ‘Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET’ was not declared in this scope
    )
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:32:1: note: in expansion of macro ‘QT_MOC_LITERAL’
    QT_MOC_LITERAL(0, 0, 5), // "QtROS"
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:28:24: error: ‘QByteArrayData’ was not declared in this scope
    - idx * sizeof(QByteArrayData)) \
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:33:1: note: in expansion of macro ‘QT_MOC_LITERAL’
    QT_MOC_LITERAL(1, 6, 8), // "rosQuits"
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:29:5: error: ‘Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET’ was not declared in this scope
    )
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:33:1: note: in expansion of macro ‘QT_MOC_LITERAL’
    QT_MOC_LITERAL(1, 6, 8), // "rosQuits"
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:28:24: error: ‘QByteArrayData’ was not declared in this scope
    - idx * sizeof(QByteArrayData)) \
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:34:1: note: in expansion of macro ‘QT_MOC_LITERAL’
    QT_MOC_LITERAL(2, 15, 0), // ""
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:29:5: error: ‘Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET’ was not declared in this scope
    )
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:34:1: note: in expansion of macro ‘QT_MOC_LITERAL’
    QT_MOC_LITERAL(2, 15, 0), // ""
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:28:24: error: ‘QByteArrayData’ was not declared in this scope
    - idx * sizeof(QByteArrayData)) \
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:35:1: note: in expansion of macro ‘QT_MOC_LITERAL’
    QT_MOC_LITERAL(3, 16, 7) // "quitNow"
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:29:5: error: ‘Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET’ was not declared in this scope
    )
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:35:1: note: in expansion of macro ‘QT_MOC_LITERAL’
    QT_MOC_LITERAL(3, 16, 7) // "quitNow"
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp: In static member function ‘static void QtROS::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)’:
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:80:22: error: ‘IndexOfMethod’ is not a member of ‘QMetaObject’
    } else if (_c == QMetaObject::IndexOfMethod) {
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp: At global scope:
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:94:60: error: ‘const struct qt_meta_stringdata_QtROS_t’ has no member named ‘data’
    { &QThread::staticMetaObject, qt_meta_stringdata_QtROS.data,
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:95:48: error: ‘Q_NULLPTR’ was not declared in this scope
    qt_meta_data_QtROS, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:95:59: error: ‘Q_NULLPTR’ was not declared in this scope
    qt_meta_data_QtROS, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp: In member function ‘virtual const QMetaObject* QtROS::metaObject() const’:
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:101:57: error: ‘class QObjectData’ has no member named ‘dynamicMetaObject’
    return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp: In member function ‘virtual void* QtROS::qt_metacast(const char*)’:
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:106:26: error: ‘Q_NULLPTR’ was not declared in this scope
    if (!_clname) return Q_NULLPTR;
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp: In member function ‘virtual int QtROS::qt_metacall(QMetaObject::Call, int, void**)’:
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:121:22: error: ‘RegisterMethodArgumentMetaType’ is not a member of ‘QMetaObject’
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
    ^
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp: In member function ‘void QtROS::rosQuits()’:
    /root/catkin_ws/build/rgbdslam_v2/src/moc_qtros.cpp:132:55: error: ‘Q_NULLPTR’ was not declared in this scope
    QMetaObject::activate(this, &staticMetaObject, 0, Q_NULLPTR);
    ^
    rgbdslam_v2/CMakeFiles/rgbdslam.dir/build.make:86: recipe for target 'rgbdslam_v2/CMakeFiles/rgbdslam.dir/src/moc_qtros.cpp.o' failed
    make[2]: *** [rgbdslam_v2/CMakeFiles/rgbdslam.dir/src/moc_qtros.cpp.o] Error 1
    CMakeFiles/Makefile2:6406: recipe for target 'rgbdslam_v2/CMakeFiles/rgbdslam.dir/all' failed
    make[1]: *** [rgbdslam_v2/CMakeFiles/rgbdslam.dir/all] Error 2

    • 古月

      古月 回复

      @candy 我在Ubuntu16.04下试过,一些依赖的库安装很麻烦,建议使用该功能包作者的安装脚本:https://raw.githubusercontent.com/felixendres/rgbdslam_v2/kinetic/install.sh,现在后直接运行安装就能用了。

      • Gravatar 头像

        candy 回复

        @古月 谢谢古月大侠
        按照官方脚本,安装已通过,但是运行时报错:
        root@fang:/home/fang# roslaunch rgbdslam rgbdslam.launch
        ... logging to /root/.ros/log/02f83704-07b5-11e8-aa1b-000c296eced3/roslaunch-fang-7564.log
        Checking log directory for disk usage. This may take awhile.
        Press Ctrl-C to interrupt
        Done checking log file disk usage. Usage is <1GB.

        started roslaunch server http://fang:43143/

        SUMMARY
        ========

        PARAMETERS
        * /rgbdslam/config/backend_solver: pcg
        * /rgbdslam/config/cloud_creation_skip_step: 2
        * /rgbdslam/config/cloud_display_type: POINTS
        * /rgbdslam/config/detector_grid_resolution: 3
        * /rgbdslam/config/feature_detector_type: ORB
        * /rgbdslam/config/feature_extractor_type: ORB
        * /rgbdslam/config/max_keypoints: 600
        * /rgbdslam/config/max_matches: 300
        * /rgbdslam/config/min_sampled_candidates: 4
        * /rgbdslam/config/neighbor_candidates: 4
        * /rgbdslam/config/optimizer_skip_step: 1
        * /rgbdslam/config/pose_relative_to: largest_loop
        * /rgbdslam/config/predecessor_candidates: 4
        * /rgbdslam/config/ransac_iterations: 100
        * /rgbdslam/config/topic_image_depth: /camera/depth_reg...
        * /rgbdslam/config/topic_image_mono: /camera/rgb/image...
        * /rgbdslam/config/topic_points:
        * /rosdistro: kinetic
        * /rosversion: 1.12.12

        NODES
        /
        rgbdslam (rgbdslam/rgbdslam)

        ROS_MASTER_URI=http://localhost:11311

        process[rgbdslam-1]: started with pid [7581]
        ================================================================================REQUIRED process [rgbdslam-1] has died!
        process has died [pid 7581, exit code -11, cmd /root/catkin_ws/devel/lib/rgbdslam/rgbdslam __name:=rgbdslam __log:=/root/.ros/log/02f83704-07b5-11e8-aa1b-000c296eced3/rgbdslam-1.log].
        log file: /root/.ros/log/02f83704-07b5-11e8-aa1b-000c296eced3/rgbdslam-1*.log
        Initiating shutdown!
        ================================================================================
        [rgbdslam-1] killing on exit
        shutting down processing monitor...
        ... shutting down processing monitor complete
        done

  3. Gravatar 头像

    回复

    16线的激光雷达 可以在这个平台下运行吗? 生成点云数据吗?

  4. Gravatar 头像

    James 回复

    老师您好,咨询您一个问题。用map_server保存地图数据时,怎么样可以修改occupied_thresh,我想把原来的0.65改的小一点。

  5. Gravatar 头像

    鲨鱼旋风 回复

    这个能不能用kinect 2做呀?

  6. Gravatar 头像

    海漩涡 回复

    月哥你好,请问下你有了解过激光slam吗?视觉slam与激光slam的区别不是很了解。
    我当前是在奥比中光的slam方案下做二次开发。这是用astra_camera相机采集数据然后depthimage to laserscan。
    这就变成了激光slam了,对这种方案你有什么看法?

    • 古月

      古月 回复

      @海漩涡 激光slam的成本高,但是精度也高,一般是二维建模;用这种红外视觉的slam方案,成本低,精度低,但是可以实现三维建模。主要还是看自己的需求。

发表评论

电子邮件地址不会被公开。 必填项已用*标注