Table of Contents
Note: this document is intended as a high level overview of our project. For more technical/instructional documentation, see ball_vision_info.md
This project focuses on developing a robot car capable of acting as an autonomous penalty kick goalie. Leveraging computer vision (CV) and a DepthAI framework, the robot detects and tracks a soccer ball, calculates its spatial coordinates, and responds to intercept the ball. Using a YOLO object detection model, the system calculates steering and throttle control inputs, and publishes them to the vehicle's VESC (Variable Electronic Speed Controller) using ROS 2.
- Ball Tracking: Detects and tracks the ball in real time using DepthAI and OpenCV algorithms.
- Depth and Angle Estimation: Computes the ball's depth (distance) and horizontal angle relative to the robot.
- ROS2 Framework: Publishes and subscribes to relevant data across custom ROS2 nodes for modular functionality.
- Proportional and Bang-Bang Control: Implements a proportional controller for accurate steering adjustments and bang-bang control for velocity inputs.
- Goalkeeper Behavior: Waits for ball movement before executing intercept maneuvers, mimicking real penalty-kick rules.
Name | Major | Class |
---|---|---|
Abhi Sachdeva | Electrical Engineering | Class of 2025 |
Charles Lahey | Mechanical Engineering | Class of 2025 |
Evan Gibson | Mechanical Engineering, Ctrls & Robotics | Class of 2025 |
Gautam Ganesh | Mechanical Engineering | Class of 2025 |
-
Ball Tracking and Control:
- Implement a tracking node that uses DepthAI to:
- Deploy a YOLO model directly to OAK-D Lite camera, detecting a soccer ball in frame.
- Measure:
Ball Depth
: Average distance between the ball and the robot in millimeters.Ball Angle
: Horizontal offset angle from the robot's center.
- Publish data to VESC BLDC Motor Controller:
throttle
variable via bang-bang controller.angle
variable, represent's angular offset between ball and car, normalized between -1 and 1 using camera's horizontal FOV.
- Implement a tracking node that uses DepthAI to:
-
Goalkeeper Rules:
- Ensure the robot remains stationary until the ball begins moving (mimicking real penalty-kick rules).
- React swiftly to block the ball once it starts moving.
- Path Prediction:
- Use ball position and velocity data to predict the trajectory and intercept the ball optimally.
- Incorporate robot dynamics to determine the ideal intercept point.
The project leverages a modular architecture, where each node in the ROS2 framework is responsible for specific tasks.
-
yolo_node.py
- Inputs: Camera feed from OAK-D Lite.
- Measures:
- Ball Depth: (distance in mm).
- Ball Angle: (horizontal angle between ball and camera in radians or degrees).
- Outputs:
- Twist messages to the
\cmd_vel
topic linear.x
messages represent throttle commandsangular.z
messages represent servo commands. These message are Ball Angle data normalized between -1 and 1.
- Twist messages to the
-
vesc_twist_node.py
- Inputs:
linear.x
andangular.z
messages from theyolo_node.py
.
- Outputs:
- Commands to the VESC for motor control.
- Inputs:
- DepthAI: For object detection, depth estimation, and spatial tracking of the soccer ball.
- OpenCV: To process image frames and detect circular objects.
- ROS2: Middleware framework for data publishing and subscribing between nodes.
- VESC: Controls the robot's drivetrain, providing precise throttle and steering.
Detailed instructions can be found in ball_vision_info.md
- Install ROS2 (Foxy recommended).
- Set up the DepthAI SDK.
- In Docker container
projects
directory
git clone https://github.com/luxonis/depthai-python
- In Docker container
- Ensure the VESC is configured and calibrated.
- In Docker container, run
source_ros2
- Enter the
src
directory and clone the repository:cd src git clone https://github.com/UCSD-ECEMAE-148/fall-2024-final-project-team-1/tree/main cd ..
- Build the ROS2 workspace:
colcon build --packages-select ball_vision_package
- Launch the system:
ros2 launch ball_vision_package ball_tracking.launch.py
- Integrate a path prediction algorithm for smarter ball interception.
- Enhance the PID controller for faster and smoother responses.
- Explore deep learning-based ball detection for improved accuracy in varying lighting conditions.
Part | CAD Model | Designer |
---|---|---|
Camera Mount | ![]() |
Evan |
LiDAR Case | ![]() |
Gautam |
Part | CAD Model | Source |
---|---|---|
Jetson Nano Case | ![]() |
Thingiverse |
Oak-D Lite Case | ![]() |
Thingiverse |
Circuit Diagram of the electronic hardware setup for the car.
![](https://private-user-images.githubusercontent.com/161119406/307571750-6f7501ee-382a-4590-9c0a-f8ce738efec3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMDYxMDAsIm5iZiI6MTczOTIwNTgwMCwicGF0aCI6Ii8xNjExMTk0MDYvMzA3NTcxNzUwLTZmNzUwMWVlLTM4MmEtNDU5MC05YzBhLWY4Y2U3MzhlZmVjMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxNjQzMjBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yYmUyNjc0YjcyMDQxZTE2YzIxYTBhZjRmM2YwOTk0M2M3ZmI1ZDZiYmQxNzZjNDNhZTM1Yjc2Yjg1NmNhZTllJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.HbVrilgjuCWO7K-7hibUHmSxiVXvgUCST4QSDAi0gBs)
Our team utilized a wirless SSH to a Jetson Nano that contained a docker container with all the necessary packages and dependecies used to run our program in a ROS2 workspace. SSH was done via both Mac terminal and Windows PC with Virtual Machine.
The Docker Images, which were provided to us and pulled from the Docker Hub, contained the UCSD Robocar Module along with the ROS/ROS2 submodules that we utilized during project prototyping and lane following. The UCSD Robocar Module, running on Linux OS (Ubuntu 20.04), was initially developed by Dominic Nightingale, a graduate student at the University of California, San Diego
Thank you to Professor Jack Silberman and our incredible TA's Alexander, Winston, and Vivek for an amazing Fall 2024 class! Thank you also to @kiers-neely for the amazing README.md template.
- Abhi Sachdeva | [email protected]
- Evan Gibson | [email protected]
- Charlie Lahey | [email protected]
- Guatam Ganesh | [email protected]