From MAE/ECE 148 - Introduction to Autonomous Vehicles
Jump to navigation Jump to search

Team 6 Members


From Left to Right

Kevin Bishara (MAE) | William Lynch (ECE) | Anwar Hsu (ECE)

Robot & 3D Modeling Designs

Our Robot


Electronics Plate


Camera Mount

Jetson Nano Case

Cad2.png Cad3.png

Autonomous Laps

    DonkeyCar Laps

Our autonomous laps for DonkeyCar can be found here.

    OpenCV/ROS Laps

Our OpenCV/ROS autonomous laps can be found here.

Final Project Overview

Our Python Code!


import rospy import cv2 import numpy as np from std_msgs.msg import Int32, Int32MultiArray from sensor_msgs.msg import Image from decoder import decodeImage import time from cv_bridge import CvBridge from elements.yolo import OBJ_DETECTION

  1. Give names for nodes and topics for ROS

STOPSIGN_NODE_NAME = 'stopsign_node' STOPSIGN_TOPIC_NAME = 'StopSign' CAMERA_TOPIC_NAME = 'camera_rgb'

  1. types of objects that can be detected

Object_classes = ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', 'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush' ]

Object_colors = list(np.random.rand(80,3)*255) Object_detector = OBJ_DETECTION('weights/yolov5s.pt', Object_classes)

class StopSignDetection:

       def __init__(self):
           self.init_node = rospy.init_node(STOPSIGN_NODE_NAME, anonymous=False)                 # initialize the node
           self.StopSign_publisher = rospy.Publisher(STOPSIGN_TOPIC_NAME,Int32, queue_size=1)    # make this node a publisher
           self.camera_subscriber = rospy.Subscriber(CAMERA_TOPIC_NAME,Image,self.detect_stop)   # subscribe to the camera feed
           self.bridge =CvBridge()
           self.stopsign = Int32()
       def detect_stop(self,data):
               frame = self.bridge.imgmsg_to_cv2(data)          # get frame from camera feed data
                       # detection process
               objs = Object_detector.detect(frame)             # detect the object 
                       # plotting
               for obj in objs:
                               # print(obj)
                               label = obj['label']
                               score = obj['score']
                               [(xmin,ymin),(xmax,ymax)] = obj['bbox']
                               color = Object_colors[Object_classes.index(label)]
                               frame = cv2.rectangle(frame, (xmin,ymin), (xmax,ymax), color, 2)
                               frame = cv2.putText(frame, f'{label} ({str(score)})', (xmin,ymin),
                cv2.FONT_HERSHEY_SIMPLEX , 0.75, co