Good Day sir! Saw your video of this ball collecting robot using OpenCV and it's great! We wanted to make a robot with this same principle for color detection and tracking. But we find it hard to make the program for our robot. Using OpenCv, what we are only able to do is tracking the colors. We're getting problem on how to get the orientation of the robot to make it move towards the target. Can you please help us and teach us on how you coded this part. Hope you can help us! Thanks and More Power!
I was also confused when I started making the robot. I found my solution by thinking of the robot as a vector which joins the centroid of the blue color to the red color< (x_red - x_blue) i + (y_red-y_blue) j>. This is the vector of your robot. Another vector is the one joining the center of your robot to the centeroid of the ball. Now u can directly use dot product of the vectors to find the angle of your robot with your desired path and use the if else ladder similar to what you use to make a line follower.Hope this helps!!All the best!Rohan.