Waypoint navigation

From RobotForAll
Jump to: navigation, search

Turtlebot

get your waypoint

$ cd ~/catkin_ws/src/robocup_nav_tutorial/src

modify the scripts 'save_waypoint.py' add the path to your waypoints.txt like this

$ f = open('/home/hts/ROS_test/src/nav_test/src/waypoints.txt','w')

start ROS

$ roscore

bringup your robot

$ roslaunch robot_bringup start_turtle.launch
$ roslaunch robocup-nav-toturial get_waypoints.launch
$ cd ~/catkin_ws/src/robocup_nav_toturial/src
$ python save_waypoint.py

use keyboard to control your robot to points you want to save, and then input pointname. when your finish, you can input stop to shutdown.

go to your destination

$ cd ~/catkin_ws/src/robocup_nav_tutorial/src

modify the scripts 'go_to_waypoint.py' add the path to your waypoints.txt like this

$ self.load_waypoint('/home/hts/ROS_test/src/nav_test/src/waypoints.txt')

you can choose whether to use keyboard to input your destination or fix a destination in your code. you can see the example in the code

start ROS
$ roscore

bringup your robot

$ roslaunch robot_bringup start_turtle.launch
$ roslaunch robocup-nav-toturial get_waypoints.launch
$ cd ~/catkin_ws/src/robocup_nav_toturial/src
$ python go_to_waypoint.py

set your robot initial pose in rviz use 2D Pose Estimate,and then use keyboard to input the destination name you want your robot to go. when your finish, you can input stop to shutdown.