一.建圖實際操作
- 下載源碼測試源碼,depthimage_to_laserscan,參考https://blog.csdn.net/u010925447/article/details/56494680
- 解壓到你的ros工作空間路徑中。
- 使用catkin_make編譯功能包。
- 分析launch文件,修改使其在自己的平台上可用:參考https://www.jianshu.com/p/429e59d48322
- 運行launch文件 啟動轉換節點:roslaunch depthimage_to_laserscan sample_node.launch(包含主節點和深度相機啟動節點)
二.利用深度相機仿激光數據創建地圖
- 下載hector_slam_example:下載地址 https://github.com/chenxingzhe/hector_slam_example,編譯(cmake)(無需里程計即可建圖,核心節點hector_mapping訂閱/scan話題)
- sudo apt-get install ros-indigo-hector-slam
- Install the dependency packages:rosdep install hector_slam_example
- 在啟動之前如果你用的是kinect,那就修改一下launch文件
- 然后就是roslaunch hector_slam_example hector_openni.launch
- 只需要讓移動平台移動就可以去構建地圖了,當然這里面用的生成模擬激光的方法是depthimage_to_laserscan節點,但是要求KINECT要相對穩定,並且盡量水平放置。
- 在rviz中就可以看到hector_slam的效果了
三.終端操作
- 啟動攝像頭 : $ roslaunch freenect_launch freenect.launch
- 啟動深度轉scan信息:$ rosrun depthimage_to_laserscan depthimage_to_laserscan image:=/camera/depth/image_raw
- 啟動自己添加的三個launch文件:$ roslaunch hector_slam_launch slam.launch
- 查看tree圖:$ rosrun rqt_tf_tree rqt_tf_tree
- 接下的是我自己通過手柄控制機器人的程序
- $ rosrun joy joy_node
- $ rosrun input_js_control logitech
- $ rosrun ros_car_py base.py
- $ python 22-tcp_client_joy.py
- 利用預先准備好的bag文件運行的SLAM
- $rosbag record -o foo scan tf
- $rosbag play --clock foo.bag
- $rosbag info foo.bag
- 創建完成之后,啟動地圖以及查看地圖
- $ rosrun map_server map_server map.yaml
- $ rosrun map_server map_server -f map
- $ roscd ~/maps
- $ rosrun map_server map_server map.yaml
