CLEARPATH Turtlebot4 User Manual page 143

Table of Contents

Advertisement

# Finished navigating, dock
navigator.dock()
rclpy.shutdown()
This example begins the same as the others by initialising the TurtleBot 4 Navigator.
Create your path
After initialisation, the user is prompted to create their path by using the
You must set at least one pose. Once all of the poses have been set, the user can press CTRL
+ C to stop creating the path and begin navigating.
goal_pose = navigator.createPath()
if len(goal_pose) == 0:
navigator.error('No poses were given,
exit(0)
Set initial pose and clear costmaps
Next we set the initial pose and clear all costmaps. We clear costmaps because the 2D Pose
Estimate tool is subscribed to by the Nav2 stack, and every time we use it Nav2 assumes that
the robot is in that position, when it is not. Clearing the costmaps will get rid of any false
costmaps that may have spawned when creating the path.
if not navigator.getDockedStatus():
navigator.info('Docking before intialising
navigator.dock()
initial_pose = navigator.getPoseStamped([0.0, 0.0], TurtleBot4Directions.NORTH)
navigator.clearAllCostmaps()
navigator.setInitialPose(initial_pose)
navigator.waitUntilNav2Active()
We also wait for Nav2 to be active before continuing.
exiting.')
pose')
2D Pose Estimate
tool.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Turtlebot4 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Turtlebot 4 lite

Table of Contents