EasyManua.ls Logo

CLEARPATH Turtlebot4 - Page 133

Default Icon
153 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
TurtleBot 4 Navigator
The TurtleBot 4 Navigator is a Python node that adds on to the Nav2 Simple Commander. It
includes TurtleBot 4 specific features such as docking and undocking, as well as easy to use
methods for navigating.
Note
TurtleBot 4 Navigator requires at least version 1.0.11 of Nav2 Simple Commander
The code for the following examples is available at
https://github.com/turtlebot/turtlebot4_tutorials. For each example, the robot starts on a dock at
the origin of the map.
Navigate to Pose
This example demonstrates the same behaviour as Nav2 Goal. The Nav2 stack is given a pose
on the map with which it calculates a path. The robot then attempts to drive along the path. This
example is demonstrated in the depot world of the TurtleBot 4 simulation.
To run this example, start the Ignition simulation:
ros2 launch turtlebot4_ignition_bringup ignition.launch.py nav:=true slam:=off localization:=true
Once the simulation has started, open another terminal and run:
ros2 run turtlebot4_python_tutorials nav_to_pose
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()
# Start on dock
if not navigator.getDockedStatus():
navigator.info('Docking before intialising pose')
navigator.dock()