Grab the ball

The second step for the TriBot... if you touch the ball stop moving and grab the ball (if you haven't a clue what I'm talking about, read my previous Robotics posts first).

The program is pretty similar to the previous part. If the contact sensor is pressed the DrivePower is set to zero stopping the motor. When adding the GenericDifferentialDrive service to the diagram you'll have to choose the same instance that was used in the first part of the diagram.

At the same time power is set to the GenericMotor controlling the TriBot's arms. In this case the Timer is used to limit the time power is set to the motor, when the arms are closed no further power to the motor is needed.

VPL program to react to generic contact sensor

I must admit that by now TriBot has actually been converted to Spike, but it worked quite well. The only thing I hadn't figured out yet was how to make the program sequential. Using the Lego Mindstorms programming environment a program is sequential by default, meaning that it stops listing to a sensor after there has been input from it once. If you want to keep listing to a sensor you have to make that explicit in your program. The Robotics VPL program works parallel. So it's working just like I programmed it; if there's input from the Sonar it starts driving and if there's input from the Contact sensor it stops and closes the robot's arms.

This behaviour is perfect for Spike... the scorpion. Spike moves forward until you come close, then it starts moving backwards... until you come to close, then it attacks you with its tail (... yes... I know it's Lego... use you imagination... ). So Spike will be the next experiment and this time I'll try the Robotics Studio as well.

Published Sun, Jan 14 2007 11:20 AM by Ilske Verburg
Filed under: