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

评论

29条评论
  1. Gravatar 头像

    Jill王 回复

    古月老师您好,想请问 ORB SLAM2平台和本章讲的RGBD SLAM的区别是什么呢?

  2. Gravatar 头像

    茉莉 回复

    古月大神,请问基于激光slam建图会出教程吗?

    • 古月

      古月 回复

      @茉莉 这部分资料很多的,所有英文教程中的SLAM建图都可以用激光雷达的。

  3. Gravatar 头像

    罗西 回复

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

    • 古月

      古月 回复

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

      • Gravatar 头像

        罗西 回复

        @古月 就是想用一个插件,在我扫描出的地图上画出路径,然后当启动程序时,机器人就会按照画的路线来执行,现在有这种插件吗?

        • 古月

          古月 回复

          @罗西 你的意思就是全局路径吧,rviz中的“Path”就可以的

          • Gravatar 头像

            罗西 回复

            @古月 月哥,是这样,我之前咨询过一个关于装了谷歌的那个算法后,在该工作空间下就不能运行自己写的.cpp程序 当时您让我在另外一工作空间下试试, 现在问题是我在安装了谷歌算法的工作空间里用了sick 的激光头,下载驱动后,运行不了(因为里面有一个.cpp的节点),但我同样在另外的正常的工作空间里就可以用, 因为现在要用这个激光头来建图, 不知道怎么搞了 想请问一下

            • 古月

              古月 回复

              @罗西 这种问题一般是环境变量和路径导致的,还是先解决sick驱动的问题,可以同时在bashrc中设置多个工作空间的,只要工作空间中的功能包没有重复的就可以。

              • Gravatar 头像

                罗西 回复

                @古月 sick驱动已经解决了 在新建的工作空间中是可以运行的,也能看到数据,但是在安装了谷歌算法的工作空间中就不能运行了 ERROR:cannot launch node of type [lms1xx/LMS1xx_node] : cannot locate node [LMS1xx_node] in package [lms1xx] 之前下载的别的包也有这种情况。

                • 古月

                  古月 回复

                  @罗西 会有这种情况,因为谷歌包的编译方法不太一样,最好放在其他工作空间运行

                  • Gravatar 头像

                    罗西 回复

                    @古月 哦 您的意思是几个工作空间同时运行 我明白了 我试试 先 谢谢

                    • 古月

                      古月

                      @罗西 是的,可以几个空间同时运行,设置环境变量就行,但是这些空间内不能有重名功能包

                    • Gravatar 头像

                      罗西

                      @罗西 月哥,又来麻烦你了 我用的是turtlebot3,现在我想把上面的激光头换成sick网口的,sick激光头驱动部分已经解决,但现在电脑和底层电机驱动板(stm32)的串口通讯不成功,电脑不能直接用键盘控制电机,想问一下要怎么解决,或者提供一个思路,不知道该怎么办了。

                    • Gravatar 头像

                      罗西

                      @罗西 月哥 刚刚我自己又试着调了一下 可以用了 不好意思啊 麻烦了

  4. 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

  5. Gravatar 头像

    回复

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

  6. Gravatar 头像

    James 回复

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

  7. Gravatar 头像

    鲨鱼旋风 回复

    这个能不能用kinect 2做呀?

  8. Gravatar 头像

    海漩涡 回复

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

    • 古月

      古月 回复

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

发表评论

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