Home :  K9 :  code   instructions  FAQ  

K9 with ball
I began to think of building a robot dog that would fetch a ball the first time I saw the RIS. With the raw RIS this task is impossible unless you use a specially illuminated ball. Even with the Vision Command System it is a non-trivial problem using an ordinary ball. The VCS responds well to color and movement. Unfortunately, the color must be consistent -- the color of a flat, evenly-lit object such as a wall of LEGO bricks is easily detected; a ball, on the other hand, is not flat -- when viewed through the camera its color shades from highlight to dark/shadow and there is not a large enough patch of any single color for the software to detect reliably. To solve this, I used a white ball and constructed a black box for the dog to operate in. I then turned up the contrast on the manual camera settings until all the camera could see was a white disc on a black background. (An unexpected benefit of the box was that the walls stopped the ball rolling under my desk / bookcase / etc. and getting lost.)

K9, head detail K9 uses three motors, two touch sensors, and a light sensor. Two of the motors rotate the left and right drive wheels which are placed near the front of the 'bot; the third motor raises and lowers the head. The jaw is operated by a spring catch which forces the jaw to snap into one of two states: 'open' or 'closed'. Opening the jaw presses the first touch sensor and starts an NQC program listening out for messages from the VCS. K9 moves in a series of small arcs until it gets the first message from the VCS, at which point it uses the VCS messages to guide the 'bot in towards the ball.


Either side of the light sensor in the nose are two LEGO lamps (powered from a 9V battery pack on K9's back). When the nose is over the ball, the light sensor in the nose picks up the lamp-light reflected from the ball and performs a pre-programmed ball-trapping maneuver -- moving the head firmly down at the same time as moving straight forwards.

As the jaw is pressed against the ground, the spring catch is forced into 'closed' state and snaps the lower jaw shut, trapping the ball (usually!) between the upper and lower jaws. K9 then backs up, raising his head and lifting the ball until the second touch sensor (located in the left-front shoulder) is pressed. Then K9 does a "doggy dance" until you open the jaw and take the ball out. Opening the jaw presses the jaw touch sensor again, and restarts the program loop.

K9, reaching for ball K9, grabbing ball

  Home :  K9 :  code   instructions  FAQ  
LEGO®, Vision Command and RCX are trademarks of the LEGO Group of companies which does not sponsor, authorize or endorse this site. Read the full heavy latin from LEGO for more details.

Text, graphics and downloads from http://jpbrown.i8.com copyright © JP Brown, 2001-2006. All rights reserved.

2455