def
main
():
rclpy.init()
navigator = TurtleBot4Navigator()
# Start on dock
if not
navigator.getDockedStatus():
navigator.info(
'Docking before intialising pose'
)
navigator.dock()
# Set initial pose
initial_pose = navigator.getPoseStamped([
0.0
,
0.0
], TurtleBot4Directions.NORTH)
navigator.setInitialPose(initial_pose)
# Wait for Nav2
navigator.waitUntilNav2Active()
# Set goal poses
goal_pose = []
goal_pose.append(navigator.getPoseStamped([-
3.3
,
5.9
], TurtleBot4Directions.NORTH))
goal_pose.append(navigator.getPoseStamped([
2.1
,
6.3
], TurtleBot4Directions.EAST))
goal_pose.append(navigator.getPoseStamped([
2.0
,
1.0
], TurtleBot4Directions.SOUTH))
goal_pose.append(navigator.getPoseStamped([-
1.0
,
0.0
], TurtleBot4Directions.NORTH))
# Undock
navigator.undock()
# Follow Waypoints
navigator.startFollowWaypoints(goal_pose)
# Finished navigating, dock
navigator.dock()
rclpy.shutdown()
This example is very similar to
. The difference is that we are using
different poses as our waypoints, and that we use the
startFollowWaypoints
method to perform
our navigation behaviour.
Watch navigation progress in Rviz
You can visualise the navigation process in Rviz by calling:
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...