1. 程式人生 > >TX1安裝執行turtlebot3 cartographer 利用rplidar

TX1安裝執行turtlebot3 cartographer 利用rplidar

http://emanual.robotis.com/docs/en/platform/turtlebot3/navigation/#navigation

 

$ sudo apt-get install ninja-build libceres-dev libprotobuf-dev protobuf-compiler libprotoc-dev
$ cd ~/catkin_ws/src
$ git clone https://github.com/googlecartographer/cartographer.git
$ git clone https://github.com/googlecartographer/cartographer_ros.git
$ cd ~/catkin_ws
$ src/cartographer/scripts/install_proto3.sh
$ rm -rf protobuf/
$ rosdep install --from-paths src --ignore-src -r -y --os=ubuntu:xenial
$ catkin_make_isolated --install --use-ninja

 

roslaunch turtlebot3_bringup turtlebot3_robot.launch

修改原始雷達為rplidar

roscd turtlebot3_bringup找到相應launch資料夾。

turtlebot3_robot.launch第八行,改為turtlebot3_rplidar.launch,改檔案如下

<launch>

<arg name="set_frame_id" default="base_scan”/>

<node pkg="rplidar_ros" type="rplidarNode" name="turtlebot3_rplidar" output="screen">

<param name="port" value="/dev/ttyUSB0"/>

<param name="frame_id" value="$(arg set_frame_id)"/>

</node>

</launch>

export  TURTLEBOT3_MODEL=burger

roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

 修改~/catkin_ws/src/turtlebot3/turtlebot3_slam/config/turtlebot3_lds_2d.lua配置檔案第22行,跟蹤座標系imu_link改為base_link

然後執行

$ source ~/catkin_ws/install_isolated/setup.bash
$ roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=cartographer

rviz -d `rospack find turtlebot3_slam`/rviz/turtlebot3_cartographer.rviz

rviz -d `rospack find turtlebot3_navigation`/rviz/turtlebot3_navigation.rviz

檢視地圖

儲存地圖

$ rosrun map_server map_saver -f ~/map

 導航

export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.yaml