Skip to content

Repository files navigation

Team 61 - Task 4: Documentation

Overview:

This application uses Nav2 with cartographer. An inflation layer is implemented to help prevent collisions and an occupancy grid to allow the robot to explore unknown areas. The robot travels to unknown areas using the nav2 planner to plan a route, avoiding obstacles using the cost map. The launch file contains an argument to input a specific coloured beacon which our robot is constantly looking for using a colour_search.py script, this uses the front cameras and HSV values. Once it has found the specific beacon, it takes a picture, saves it and continues to explore the arena. Throughout exploration, an image of the map is saved every 5 seconds.

Installation and Execution

  1. In a new terminal instance, navigate into the ROS Workspace.
cd ~/ros2_ws/src/
  1. Then run this command to clone Team 61's package into your workspace.
git clone git@github.com:Lobstergoat/com2009_team61_2025.git
  1. Once that has been cloned, run this command to build the package and source the bash.
cd ~/ros2_ws/ && colcon build --packages-up-to com2009_team61_2025 && source ~/.bashrc
  1. After that, you can now run our application!
ros2 launch com2009_team61_2025 (file_name) (launch arguments) 
ros2 launch com2009_team61_2025 task3.launch.py target_colour:=red 

Dependencies

Here is the list of imports we have used outside our package.

  1. import time
  2. import random
  3. import numpy
  4. import math

Functional Description

Explore Server Node

Explore Server Node FBD

The Explore Server Node autonomously navigates the robot through unexplored areas of the arena by processing occupancy grid maps. The map_callback subscribes to the /map topic, which provides a 2D grid where -1 are unknown cells, 0 is free space, and 100 are obstacles. The timer_callback runs every second, checking if map data is received. If the robot is not searching for a beacon and has reached its previous navigation goal, it triggers find_frontier_goal() to find new exploration goals.

The find_frontier function identifies frontiers at the edge of open spaces next to unknown cells by analysing the map data as a NumPy array. All points are collected and sorted by distance, and are randomly selected to be sent as a navigation goal. The robot navigates to these goals to explore the arena. When a beacon is detected, the searching flag is set to true, halting navigation to investigate and turn towards the beacon. This flow is clearly outlined in the first diagram, showing map processing, frontier selection, and navigation decision-making.

Colour Search Server Node

Colour Search Server Node FBD

Colour Search Node The Colour Search Node detects and centers the robot towards a beacon using the /camera/image_raw topic. The timer_callback checks if an image has been saved; if not, it calls the camera_callback. The camera callback processes images from the camera topic, cropping and applying color filters based on HSV values to isolate the beacon.

Once a colored blob is detected, the robot adjusts its orientation to align the blob to the center of the camera view. If the robot is not centered, the robot rotates left or right; if the blob is centered, the robot stops and saves an image of the beacon to the snaps folder. This is controlled through a series of checks in the timer_callback, ensuring the robot constantly searches until successful. The camera processing and decision logic are visually represented in the diagram, detailing the flow from capturing the image, to navigation commands and image saving.

Map Saver Server Node

Map Saver Server Node FBD

Map Saver starts off by creating the map directory if it doesn’t exist and prepares the service client to call to the /map_saver/save_map topic. It waits until this service is available. A timer implemented to trigger the map saving process every 5 seconds. The timer callback function constructs a SaveMap request specifying the map topic (/map), the image format and the file path to save the map. This request is sent asynchronously to the save map service. The handle response function handles the response of the asynchronous service call and logs an error message if the service call fails.

Contributors

Charlie Selmes

https://github.com/Lobstergoat

Rajat Talwar

https://github.com/rajat791

Jatin Halkhoree

https://github.com/jatinhalkhoree

Michael Udo


About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages