|
Re: Vision example controlled motors
Take a look at the attached example. It's just a very simple (and incomplete) example of how to use the tracked goal to center your robot on a target.
Basically, the PID block shown will try to turn the robot left and right (using values from -1 to 1) so that the Goal X that it is reading will approach 0 (the assumed center of the screen.)
Alternatively, you could simply code something along these lines: IF Goal X < 0, THEN Motor Output = 1, ELSE IF Goal X > 0, THEN Motor Output = -1. You get the idea.
(One other thing...because all the goals are different shapes, you probably will not be able to accurately read how far away from the goals you are.)
|