JEMARO Days Robotics Competition

A competitive workshop focused on developing a complete software stack for a mobile robot to solve a series of autonomous navigation and perception challenges.

JEMARO Competition Banner

At a Glance

  • Situation: The JEMARO Days 2023 event included a time-limited competition where teams had to program a mobile robot to autonomously solve three distinct challenges: a timed lap race, marker-based navigation, and a search-and-find task for tennis balls.
  • Task: As a member of a four-person team, my task was to co-develop a robust and modular software stack using Python and ROS2 that could be quickly adapted to solve all three challenges. My specific responsibilities were centered on the computer vision pipeline and its integration.
  • Action: I was heavily involved in developing the perception node (`detecting.py`), which used OpenCV for color segmentation, contour analysis, and shape recognition to identify track lines, markers, and tennis balls. I worked on integrating this perception data into a central state machine (`main_loop.py`) that managed the robot's overall behavior, and which communicated with navigation goals via a ROS2 action client (`moving.py`).
  • Result: Our team successfully built an integrated system that was able to perceive its environment and make autonomous decisions. The architecture allowed the robot to navigate complex arenas, identify and react to competition elements, and complete the specified tasks under the pressure of the competition environment.

Technical Deep Dive

System Architecture & Design

Our team's solution was built on a modular, state-driven architecture in Python and ROS2. The system was orchestrated by a central state machine, which allowed us to easily switch behaviors based on the active challenge and sensor input.

The core components of the architecture were:

  1. Main Loop (main_loop.py): This node acted as the "brain" of the robot. It implemented a state machine that subscribed to topics from the vision node. Based on the detected objects and the current task, it would decide the next action, such as "follow the line" or "move towards the detected ball."
  2. Perception Node (detecting.py): This node was responsible for all visual processing. It received raw camera images and published structured information about detected objects.
  3. Motion Service Client (moving.py): This node provided a clean interface for the main loop to command the robot's motion. It used a ROS2 Action Client to send goals (e.g., target coordinates) to a pre-existing navigation or motion server on the robot.

Core Implementation Details: Computer Vision

My primary technical contribution was within the perception node, which used a classic OpenCV pipeline to handle the different detection tasks:

  • Color Segmentation: To isolate objects of interest (e.g., the yellow tennis balls or colored markers), I implemented color segmentation in the HSV (Hue, Saturation, Value) color space. Using `cv2.inRange`, we could create binary masks for specific colors, effectively filtering out the rest of the image.
  • Contour Analysis: After segmentation, I used `cv2.findContours` to identify distinct blobs in the binary mask. For each contour, I calculated properties like its area (to filter out noise) and its centroid (to determine the object's location in the image frame).
  • Shape Recognition: For challenges involving markers, we needed to differentiate shapes. I used the `cv2.approxPolyDP` function to approximate the contour's shape. By counting the number of vertices in the approximation, we could robustly distinguish between triangles, squares, etc., allowing the robot to follow the "rules" of the challenge.

Challenges & Solutions

A key challenge was making the perception pipeline robust to varying lighting conditions and camera angles, which are common in a live competition environment. A fixed set of HSV thresholds might work in one corner of the room but fail in another.

Our solution was to develop a flexible and well-structured parameter system. Instead of hard-coding values, all HSV thresholds, minimum contour sizes, and other parameters were exposed in a configuration file. This allowed us to quickly **re-calibrate the vision system** for the specific competition arena just before our run, a crucial factor in adapting to the real-world environment and ensuring our detection logic remained reliable.

Project Information

Type: Workshop & Robotics Competition

Event: JEMARO Days 2023

Technologies Used

  • Python
  • ROS2
  • OpenCV
  • Computer Vision
  • State Machines
  • ROS2 Actions
  • Git