Practicum 2: A navigation example#
Practicum date: Tuesday, February 17, 2026, 23:59
Course: RO47014 Knowledge Representation and Symbolic Reasoning, TU Delft, CoR
Instructors: Carlos Hernandez Corbato, email: c.h.corbato@tudelft.nl
In this practicum you will work with a ROS 2 Python node that sends navigation goals to Nav2 using the navigate_to_pose action.
You will:
Configure custom waypoints for the robot using a configuration file.
Modify the node so it stops automatically once it returns to its starting position.
Setup#
Start the simulation like provided within the setup instructions, open your src folder and place the krr_navigator package in it.
Download the krr_navigator package
Rebuild your workspace and source it.
colcon build --symlink-install --packages-select krr_navigator
source install/setup.bash
Now, in a different singularity terminal, you can run the krr_navigator_node node with:
ros2 run krr_navigator krr_navigator_node
As you can see the robot loops and navigates to 4 waypoints within the room. This is behavior we would like to adjust for gathering information for our KB.
Exercise 1 – Configure waypoints using a YAML file#
Inside the
krr_navigatorpackage, create a new folder calledconfig.Inside the
configfolder, create a file namedparams.yaml.Open
config/params.yamland add the following content:
krr_navigator:
ros__parameters:
frame_id: "map"
loop: true
waypoints:
- "[0.0, 0.0, 0]"
- "[-4.0, 0.0, 0]"
- "[-4.0, 3.5, 0]"
- "[0.0, 3.5, 0]"
- "[0.0, 0.0, 0]"
Build your workspace if needed:
colcon build --symlink-install --packages-select krr_navigator
source install/setup.bash
Run the node with the parameter file:
ros2 run krr_navigator krr_navigator_node --ros-args --params-file src/krr_navigator/config/params.yaml
As you can see the robot now goes to the same spots as before, now we can try to adjust the waypoints the robot can move to.
Exercise 2 – Stop navigation after returning to the start position#
In Exercise 1, the robot continuously loops through the configured waypoints.
In this exercise, you will modify the node so that it stops automatically once it has returned to its starting position.
Open the file
krr_navigator_node.pyinside thekrr_navigatorpackage.Identify where the list of waypoints is stored in the node.
The first waypoint in this list should be considered the starting position.
Store this starting position when the node starts.
You will need this later to determine when the robot has completed its route.
Modify the navigation logic so that:
The robot navigates through all waypoints once
When the robot reaches the final waypoint and
That waypoint corresponds to the starting position
the node stops sending new navigation goals.
When the robot has returned to its starting position:
Print an informational log message
Shut down the node cleanly
Example log output:
[INFO] [krr_navigator]: Returned to start position
[INFO] [krr_navigator]: Navigation complete, shutting down
Build your workspace again:
colcon build --symlink-install --packages-select krr_navigator
source install/setup.bash
Run the node with the same parameter file as before:
ros2 run krr_navigator krr_navigator_node --ros-args --params-file src/krr_navigator/config/params.yaml
If implemented correctly, the robot should:
Visit all configured waypoints
Return to its starting position
Stop automatically without looping forever