AutoRef honors 2019: Difference between revisions

From Control Systems Technology Group
Jump to navigation Jump to search
 
(93 intermediate revisions by 3 users not shown)
Line 7: Line 7:
<font size="8"> '''AutoRef Honors 2019/20''' </font>
<font size="8"> '''AutoRef Honors 2019/20''' </font>
</div>
</div>
__TOC__


=Introduction=
*explain intentions
*since we cannot test hardware anymore we had to adapt and switch to simulation




=Software Architecture=
Since hardware testing is not an option anymore during times like these we had to adapt how we execute the project. Since we still want to be able to use the work done in these times, we chose to build the communication of our system on the Robot Operating System (ROS). This way we can keep many components of our system unchanged when we go back and implement it with real hardware. Only the part that models the quadcopter and the video stream of the camera have to be swapped for the real drone and camera.


The simulation environment chosen is CoppeliaSim (also known as V-rep), this environment has a nice intuitive API and works great with ROS. In CoppeliaSim each object (i.e. a drone, or a camera) can have its own (child) script which can communicate with ROS via subscription and publication to topics. The overall architecture can be displayed by the ROS command ''rqt_graph'' while the system is running. The output of this command will be displayed in the following figure.
=Introduction=
 
[[File:CF_on_laptop.jpg|right|300px|]]
[[File:Rqt drone follow.jpg|750 px|system]]
This wiki is the documentation of work delivered by the AutoRef Honors students from the High Tech Systems track in the academic year 2019/2020.  
 
The following text will briefly explain what everything in the figure means. More in-depth information will come later or can be seen in the topics own section.
The ''sim_ros_interface'' is the node which is created by the simulator itself and serves as a communication path between the simulator scripts and the rest of the system. What can not be seen in this figure are the individual object scripts within the simulator. A script that belongs to a camera object will publish camera footage from the camera mounted on the drone to the topic ''/txCam''. The ''image_processor'' node which is ran outside the simulator will subscribe to ''/txCam'' and will subsequently get the image from the simulator. It will then extract the relative ball position and size (in pixels) out of each frame and stores it in an object (message type). This message will then be published to the ''/ballPos'' topic. The simulator node (actually a script belonging to the flight controller object) will subscribe to this topic, get the position of the ball relative to the drone and decide what to do with this information i.e. move in an appropriate manner. This loop will run at approximately 24Hz.
 
 
 
=Vision=
Ball tracking
 
To track the ball from the drone camera a python code was found and adapted. To track the ball a threshold in HSV color space is needed, this threshold represents a range of colors that the ball can show on camera due to different lighting.
 
The first thing the code will do is grab a frame from the video and make it into a standard size and apply a blur filter to create a less detailed image. Then all of the image that is not the color of the ball is made black, and more filters are applied to remove small parts in the image with the same color as the ball. Now a few functions of the cv2 package are used to encircle the largest piece of the image with the color of the ball. Then the center and radius of this circle are identified.
A problem we ran into was that the ball was sometimes detected in an incorrect position due to a color flickering, we then added a feature to only look for the ball in the same region of the image where the ball was detected in the previous frame.
 
More on the code can be found here https://www.pyimagesearch.com/2015/09/14/ball-tracking-with-opencv/


=Control of Drone in Simulator=
The goal of this project is to develop an autonomous robot capable of refereeing a robot football play. Such a system can be of benefit by eliminating human error and by using factual data from more sources to make better-evaluated decisions. For this project we have decided to use a drone (quadcopter) as a robot. Most drones are fast and they can change altitude easily, this agility enables a drone to quickly move to a position with a good view, this is a large advantage for a referee. Robot soccer is played on fields of different sizes, and a system using a drone is scalable, whereas for instance a camera on a rail next to a field would not be so scalable. Another reason for using a drone is that it is easy to carry around and it is a small object to work on.  
The drone used in the simulation is CoppeliaSims build-in model 'Quadcopter.ttm' which can be found under ''robots->mobile''. This drone uses a script that takes care of the stabilization and drift. The object script takes the drone's absolute pose and the absolute pose of a 'target' and tries to make the drone follow the target using a PID control loop which actuates on the four motors of the drone. In our actual hardware system we do not want to use an absolute positioning system to follow an object so we will not use the absolute pose of the drone in order to path plan in the simulation as well.
This drone will receive an object from the /ballPos topic that contains information about the position of the ball relative to the drone.


=hardware=
We made the project goal more specific into the following:
cf
bolt
flowdeck


=implementation=
''''' "Autonomously assist a football referee in a 2 versus 2 robot soccer match using a drone by enforcing three main rules: out of bounds, free kick, and goal."'''''
//


=Tutorial Simulation=
A large obstacle we faced during the project was that the university had to close due to the Covid-19 virus outbreak from March 2020 until the end of the project year. The effects on this project are that the team has not been able to test hardware on the university or work together physically. Considering these changes the team has decided to move our system to a simulation environment, and the work on the hardware has not been finalized.
After following this tutorial the reader should be able to run a basic simulation of a drone following a yellow object (ball) on a soccer field.
The simulation environment chosen for this project was CoppeliaSim (also known as V-rep). This environment was chosen because of its intuitive API and the ability of its internal object scripts, more information about how CoppeliaSim deals with scripts can be found here https://www.coppeliarobotics.com/helpFiles/en/scripts.htm. This tutorial assumes the reader is on a Linux machine, has installed ROS, and is familiar with its basic functionalities. The next figure gives a sense of what is achieved after this tutorial.


[[File:Simulator inaction honors.jpg|500 px]]
=Team=
This project was made by the following Honors student in the academic year 2019/2020:
*Alvaro Gonzalez
*Jake Rap
*Wolff Voss


*Download and extract the downloadable zip file at the bottom of the page.
=References=
*Download CoppeliaSim (Edu): https://www.coppeliarobotics.com/downloads
*Install it and place the installation folder in a directory (Home).
*Initialize ROS by opening a terminal (ctrl+alt+t) and typing ''roscore''
*Open CoppeliaSim by going to its folder, open a terminal and type ''./coppeliaSim.sh''
*In the sim, ''file->open scene...'' and locate the ''.ttt'' file from the extracted zip.
*Open the main script(orange paper under 'scene hierarchy'), find the line ''camp = sim.launchExecutable('/PATH/TO/FILE/camProcessor.py')'' and fill in path to the extracted zip.
*


=Downloads=
Rosebrock, A. (2015). Ball Tracking with OpenCV - PyImageSearch. Retrieved 24 May 2020, from https://www.pyimagesearch.com/2015/09/14/ball-tracking-with-opencv/
*Total Simulation so far: [[File:Drone_follow_roomba_v-rep.zip]]
*Empty Robot Soccer Field for CoppeliaSim(V-rep): [[File:V-rep_soccerfield.zip]]

Latest revision as of 20:00, 24 May 2020



AutoRef Honors 2019/20



Introduction

CF on laptop.jpg

This wiki is the documentation of work delivered by the AutoRef Honors students from the High Tech Systems track in the academic year 2019/2020.

The goal of this project is to develop an autonomous robot capable of refereeing a robot football play. Such a system can be of benefit by eliminating human error and by using factual data from more sources to make better-evaluated decisions. For this project we have decided to use a drone (quadcopter) as a robot. Most drones are fast and they can change altitude easily, this agility enables a drone to quickly move to a position with a good view, this is a large advantage for a referee. Robot soccer is played on fields of different sizes, and a system using a drone is scalable, whereas for instance a camera on a rail next to a field would not be so scalable. Another reason for using a drone is that it is easy to carry around and it is a small object to work on.

We made the project goal more specific into the following:

"Autonomously assist a football referee in a 2 versus 2 robot soccer match using a drone by enforcing three main rules: out of bounds, free kick, and goal."

A large obstacle we faced during the project was that the university had to close due to the Covid-19 virus outbreak from March 2020 until the end of the project year. The effects on this project are that the team has not been able to test hardware on the university or work together physically. Considering these changes the team has decided to move our system to a simulation environment, and the work on the hardware has not been finalized.

Team

This project was made by the following Honors student in the academic year 2019/2020:

  • Alvaro Gonzalez
  • Jake Rap
  • Wolff Voss

References

Rosebrock, A. (2015). Ball Tracking with OpenCV - PyImageSearch. Retrieved 24 May 2020, from https://www.pyimagesearch.com/2015/09/14/ball-tracking-with-opencv/