I have been noticing a couple threads spawning about different teams’ vision systems. I was going to create a new thread about my software, until I realised that there were already threads aplenty about our vision systems
In this thread, please discuss how your vision systems functioned in the competition, how effective they were, how you did it, what you learned from it and what you want to learn to improve the system for next year.
To start off, my program didn’t have enough time to be bug tested and used on the robot, but I did a couple tests to find out that it was quite accurate to what I was seeing. We ended up using just basic hot goal detection using NI vision. My program was modular, and pressing a key would allow you to enable and disable features. Whilst it was meant to run off a USB camera for optimal performance, we didn’t have one of those on hand, so I ended up switching to the MJPEG stream from the AXIS camera. My programs are all written in C++ because I love performance. Also, my program was geared towards running not only in autonomous, but also in teleop period, to allow the robot to home itself, lock onto a target (and reposition if pushed around), and attempt to automate the shooting process
Now that I am done with the description of my vision software, let me point out some important things that I realised. My first version of DevVision2014 had no threading. The grabber had to wait for the processing to be completed. The problem came when the framerate dropped just below the capture rate. Images started piling up and the next thing I knew was that I was recieving 30 seconds of laaaggg! :ahh:. I fixed this by threading my next program versions. Now, the image is grabbed by one thread, but copied over and processed by another!
Through vision processing, I learned quite a bit. It, first of all, pushed me into self-teaching trigonometry so I can add more and more features to my program. I started off by grabbing an image from a camera and displaying it. I did this with VideoCapture because that was in the tutorial. I STRONGLY SUGGEST NOT TO USE VideoCapture! It is deprecated with CvCapture and is a bit harder to use anyways. I then learned about the different color spaces and why RGB (BGR) is horrible for complex color tracking. I settled with HSV because that was the color space I was introduced to be perfect for my needs. I learned how to then find the features in the image. This allowed me to actually locate the target instead of just filtering it out from everything else. However, a bunch of point data is useless naked. Next, I started pulling the relevant data from this point data, a vector containing vectors of cv::Points! I first learned how to calculate a regular bounding rectangle and using that for crazy cool things, like target location, target type and distance and how centered it is on the screen! Now, I have moved onto using minAreaRect instead, to give me even better accuracy, even if the camera is a bit tilted. I also learned that being able to send multiple images and tap into images during any stage of processing using imshow can make debugging and setup easier. It took me much less time to set up the thresholding in my program (5 mins) as compared to my mentor’s program (~1 hour) because I was able to tap into the threshold process and play with the variables accordingly. I also was able to use sliders so I never had to recompile the code for setup.
There are many things I want to learn for next year. I want to be able to take two cameras and use stereo vision to triangulate the position of the object relative to us. I also want to attempt to create some sort of image stabilisation algorithm to make the code automatically move the image ROI up and down to compensate for the terrain roughness. I also want to learn how to use other thresholds, like canny, to make my findContours even more efficient! It would be fun to see a 100% accuracy in my program in the near future. I also want to have a node-based system where there are multiple onboard computers, communicating all through a tunnel protocol I want to create. Basically, there will be a RasPi as a host, and all the ODROIDs are going to:
send the destination
send a request (purpose of the data)
data
requested action
All these requests will be concatenated with a specific magic number sequence.
This way, only one ethernet port would be required, optional because that would be for DS communication
I have a couple repositories that may interest you if you want OpenCV.
https://github.com/yash101/ai
https://bitbucket.org/devyash_lodha/opencv-programs
https://bitbucket.org/devyash_lodha/robotai2014/overview
For those who are having problems in installing OpenCV, I’ve written a script to automate the apt-get install.
Script Here