# 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
tool.
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, exiting.'
)
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 pose'
)
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.
Summary of Contents for TurtleBot 4 Lite
Page 50: ...Running the Light Ring test...
Page 61: ...Adding Displays in Rviz2...
Page 63: ...Camera image displayed in Rviz2...
Page 82: ...TurtleBot 4 Lite with a NED2 arm...
Page 147: ...Color camera diagnostics...