abbeyjean’s
Lego Mindstorms NXT
Projects
GameBot
|
Originally this was going to be a plotter, but part way through building it I decided to add a Joystick and make it play 'Pencil & Paper' games. I choose three games, TicTacToe (boring I know) but I did not make it play a perfect game so it can be beaten, a version of Combinatorial Regio I found on the internet which seemed ideal for my purposes, and a simplified version of Salvo (or Battleships) It can also be a plotter. Instructions can be saved into a file (nxtdata.txt) and then the robot reads these and executes the necessary actions. Part of the file for drawing the NXT brick looks like this. Measurements are in millimeters.
Other commands are MRP (Move Relative Position), DAP (Draw Absolute
Position), LINE (Draw a line from x1,y1 to x2,y2), CIRCLE and ARC. It
doesn't draw circles very well.
I wrote a simplified version of Salvo with grids of 5x5 rather than 10x10, a Headquarters of 3 squares, two Tanks of 2 squares each and two Jeeps of 1 square each. Each player gets one shot at a time. The robot does not know where your targets are but it does know when it scores a hit. This eliminated the need for the player to somehow tell the robot when it had made a hit or destroyed one of your targets. You set up your targets by using the Joystick to move to the square where you want to start, press and hold down the Touch Sensor on the top of the Joystick and then 'drag' to the square where you want to stop. You then release the button. Targets can not go diagonally and you must 'drag' the correct number of squares, ie 3 for the Headquarters, 2 for the Tanks etc. You also use the Joystick in all games to move to the square you want and then you press the button on top. As you can see from the pictures (and the video) everything the robot draws is also displayed on the NXT screen. A small flashing cursor helps when you are trying to position the robot over a particular spot using the Joystick. The Joystick uses a HiTechnic Tilt sensor to detect which direction you want to move and a Touch sensor as a button. The only other sensors used are two touch sensors to detect x and y home positions. The penholder is spring loaded to accommodate different diameter pens. Two clutch gears prevent the motor stalling when the pen is raised or lowered. The plotter is a bit different in that rather than the motors to raise/lower the pen and to move the penholder being mounted on the beam, they are mounted on the carriage that supports the beam and the pen and penholder are driven with size 32 axles and worm gears. Likewise the beam carriage is driven from a motor mounted by the brick also using a 32 axle and a worm screw. The only problem with this is that it is slow which is one of the reasons I reduced the Salvo game from 10x10 to 5x5. The Power Functions battery box (with batteries) is purely a counterweight to the beam and penholder. The paper is held in place by a spring loaded rubber bumper at the rear edge and a series of flexible rubber axle joiners along the left had size.
|
||||||||||||||||||||
Home The NXT Step Nxtasy RobotC Bricklink HiTechnic Mindstorms Home Contact Me
LEGO, MINDSTORMS and NXT are registered trademarks of The LEGO Group.