View Single Post
  #4   Spotlight this post!  
Unread 11-01-2013, 20:54
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
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.)
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	46
Size:	5.7 KB
ID:	13470  
Reply With Quote