CLEARPATH Turtlebot4 User Manual page 142

Table of Contents

Advertisement

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 here.
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,
exit(0)
# Start on dock
if not navigator.getDockedStatus():
navigator.info('Docking before intialising
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)
exiting.')
pose')

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Turtlebot 4 lite

Table of Contents