loading
 
lego nxt
CJ Wisse from Australia  [3 posts]
7 years
hi there
i would like too make a robot that keeps track of a blue ball and centres it all the time with my nxt but im not sure how i think i need to use vbscript but i dont know how to get motor a to turn so that the blue ball is in the centre always and follows the blue ball just lef and right please help me

thanks

CJ
Anonymous 7 years
CJ,

you best bet is to spend some time with the LegoNXT tutorial that does what you want to do and more.

http://www.roborealm.com/tutorial/ball_picker/slide010.php

Basically you first process the image for the blue ball (use RGB_Filter and COG for that). Given the COG_X will range from 0 to screen width you would ideally want to keep it right in the middle of the screen which implies the front of the robot. If the ball is off to the left, you move the left wheel forward and the right one either backwards or just off. Vice versa for the other side.

When the ball is in the middle of the screen (plus or minus 10 pixels or so) then you move the robot forward.

If you have a look at the VBScript you will see it test for the COG_X location and then set variables which are sent to the NXT.

You can also search this forum on this topic. You can also check the Examples subtree right in the Content view of RoboRealm and select the Red Object Tracking example which has the basics for what you want too.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index