On your PC you will need to start Rviz:
ros2 launch turtlebot4_viz view_robot.launch.py
Code breakdown
The source code for this example is available
Lets take a look at the main function.
def
main
():
rclpy.init()
navigator = TurtleBot4Navigator()
# Set goal poses
goal_pose = navigator.createPath()
if
len
(goal_pose) ==
0
:
navigator.error(
'No poses were given, exiting.'
)
exit
(
0
)
# 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.clearAllCostmaps()
navigator.setInitialPose(initial_pose)
# Wait for Nav2
navigator.waitUntilNav2Active()
# Undock
navigator.undock()
# Navigate through poses
navigator.startFollowWaypoints(goal_pose)
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...