‹ MAE 148 — Introduction to Autonomous Vehicles · Maurício de Oliveira

2022WinterTeam6

Team 6: DKar

Team6 robotspotlight.png

Team Members

Team6 teampic.png

Project Overview

A robot that acts as an aimbot, in that it follows a target and dynamically adjusts a laser pointing at that target. The robot should use OpenCV to detect the target and ROS to guide steering and throttle based on the target position and distance.

Goals:


Gantt Chart

Team6 gantt.png

Robot setup

Hardware Setup

Team6 robotside.jpeg Team6 robotfront.png

Notes:

CAD/Mechanical Designs

Servo.PNG This design is meant to mount an SG90 servo to the car plate.

Team6Lidar.PNG This is the case for the Intel D435 that also attaches to the laser module and servo on the bottom.

Wiring

Team6 wireschema.png

Special Components

Team6 specialcomponents.png

Software/Jetson Setup

Configured the Jetson Nano and compiled OpenCV from source, using the class guide instructions.

DonkeyCar

Installed the DonkeyCar AI framework on the Jetson, which collected data during manual driving with the joystick. This allowed us to train a behavioral cloning model using that data and then run the robot autonomously based on that model.

3 Laps Video

{{#ev:youtube|https://www.youtube.com/watch?v=FTRKwKKNqF8%7C500x300%7C left | DonkeyCar Laps |frame}}















Tips/Notes

Team6 donkeyport.png

OpenCV/ROS2

Setup Dominic's docker container on the Jetson, allowing us to run the ROS and calibrate the robot for image detection for the track. Then, launched Dominic's nodes, which autonomously guided the robot through the laps based on our calibrations of error, HSV for yellow, and throttle.

3 Laps Video

{{#ev:youtube|https://youtu.be/FTRKwKKNqF8%7C500x300%7C left | ROS2 Laps |frame}}















Tips/Notes

Final Project

Our Final Project is to implement an autonomous target detection mechanism for our robot (aka aimbot). Our idea was to have some sort of target, and have the robot follow it, adjusting its steering and throttle to mimic the target's maneuvers. In addition, added an additional camera, the Intel RGBD, onto a servo, so that the actual FOV and image the robot was taking in would adjust itself in response to the target. And just for fun, we added a small laser connected to the camera, so it was easy to see where the robot was "detecting the target". Lastly, we made it so that the target was actually another robot car, which we controlled using a joystick. So essentially, our robot was tracking the target robot around the track and dynamically adjusting its actuators.


How We Did It

  1. Image Processing using OpenCV to Detect a Colored Target
    1. Used Virtual Machine to run a simple python script that detects the largest rectangle which is the color blue, using masking, bound the rectangle, and then detect the line from the point at the center of the object to the point at the actual center of the frame
  2. Gathered Depth data using an RGBD camera
  3. Create a custom Target Detection node which Subscribes to Camera Topics and Publishes to the Twist and Servo Topics.
    1. Node was a python script using ROS2, and utilized Dominic's existing custom ROS2 metapackage to publish/subscribe to.
  4. Wrote a program which publishes commands to the appropriate nodes based on the gathered data.
    1. Implemented P controller for throttle which maintains a certain distance from the target
    2. Implemented a P controller for servo movement
  5. Integrated code into a ROS package (aimbot_pkg) within the ucsd_robocar_hub2 docker metapackage.

Team6 opencvdemo.png

ROS Software Design

Team6 packagetree.png Team6 rosnodes.png

Source Code/Github

Github Link: Project Code

Custom ROS Node Link: Target Detection ROS2 Node

PID Algorithm

A P controller.

Servo/Steering:

Throttle:

Demo Video

{{#ev:youtube| https://youtu.be/tL3elf0cDe0 |500x300| left | Final Project Demonstration |frame}}















Tips/Notes

Presentations

Final Project Presentation
Weekly Update Presentations

Challenges

Future Developments

Send reverse throttle controls.

Recognize different colors and dynamically adjust following distance.

Resources

https://gitlab.com/ucsd_robocar2/ucsd_robocar_hub2

Acknowledgements

Thanks to: Professor Silberman, Dominic, Ivan, Professor De Oliveira, as well as the other teams.


Recovered from the original course wiki (server backup, August 2024).