|
|
Programming Tips and ideas Please note this is a new part to the site, with much more to follow. If you have any good tips, please forward them by Email or Fax on 01257 516382. Scenario 1 - Obstacle evasion and playing a tune at the same time Scenario 2 - Running the Roverbot on a restricted space such as a small table top. Scenario 3 - Roverbot to travel forwards until it hits an object and reverses back to its start position. On route it must calculate its travel time to the object. Scenario 4 - Wall display with flashing lights Scenario 5 - Traffic Lights Scenario 6 - Decisions with Yes or No command. Scenario 7 - Using the Sensors blocks as part pf an automatic lighthouse system. Scenario 8 - How do I get the Roverbot to respond to different coloured lines or objects? Scenario 9 - BBC Great Egg Race challenge [Under development] Scenario 10 - Using the MindStorms kit with Gifted or talented children Scenario 11 - Gathering evidence and more - Recording video with camera
Obstacle evasion (QCA 6C) Running tasks alongside each other can appear daunting or even impossible for a new user of the Robotics Invention software. For example, how can a Roverbot be programmed to move forwards and play a tune at the same time? A simple solution is detailed below. Program the Roverbot to zig-zag forwards through an obstacle course and play a tune as it moves. Sample program For clarity, I have omitted the touch sensor(s) stack. The Timer trips in after the first second of the main stack, and activates the the Play Tune block within a Repeat Forever. Three Timers are available within the Robotics Invention Software so lots of scope for creative programming! Tip Two touch sensors are much more effective in responding to obstacles, than the standard single sensor. For construction details, see page 30 of the Lego MindStorms Constructopedia.
Challenge - Build your own Zig-Zag routine from Small Blocks.
Running the Roverbot on a restricted space such as a small table top. Running the robot on a table top can be problematic, as at normal full speed, it can quickly disappear onto the floor! The Robotics Invention software features a very useful Set Power control option, which resolves the issue.
Set Power can usefully be employed several times in a program stack, with Level 8 the maximum (default) power and Level 1 the minimum. Note I have switched off port B, as it is not normally used to drive the Roverbot.
A more advanced example! (QCA 6C) Example program Note the use of a variable in this program to calculate the travel time with Timer 1. The result is then displayed on the RCX LCD .
The Set command can be found in Small Blocks/Variable. For further information on the Set command consult the on-line Help.
20/06/2003
Wall display with flashing lights (QCA 5E) QCA 5E makes reference to using an output device as part of a wall display. This simple example program uses three LED (Light Emitting Diodes). As an alternative, small bulbs could be used but these draw more current and hence shorten the battery life in the RCX brick. Using the On For block from Small Blocks/Power, I have chosen to flash the LEDs on and off in a running sequence, rather like in disco lights! Challenge Modify the sequence to deliver other eye catching displays. Use the Beep, Play Note or Play Music commands to help draw attention to the display.
For further information on LEDs goto... http://electronics.howstuffworks.com/led.htm 03/09/2003
Scenario 5 Traffic Lights (QCA 5E) For an image of the traffic lights sequence click this link This program simulates a traffic lights sequence within a Repeat Forever block and I have chosen to use the On For ABC block from Small Blocks/Power. Note the use of a Comment block, which can used to describe the program, or alternatively as a descriptor to set the task. Things to try Modify the program to allow the traffic to flow for an extra 10 seconds, once in every three sequences.
IMPORTANT If using an LED (Light Emitting Diode) circuit, it is vital to connect the leads the correct way round on the Outputs ABC. If the circuit was purchased from the ICT Centre, the leads should sweep off the end of the RCX brick, NOT across the LCD screen.
Traffic Lights Purchase This product can be sourced from the ICT Centre for £12. Contact James Mc Alea on: Tel 01257 516360
03/09/2003 Scenario 6 - Robot choosing between two program stacks (QCA 6C) Just as some databases can make a Yes/No decision, the Robotics Invention software also has this useful tool. In this simple program example, the robot moves forward for 2.5 seconds and enters a Yes or No program stack configured for Timer 1. The Turn Left block is activated for 2.0 sec and then after five seconds the Turn Right block runs for 1 second.
25/09/2003 Automatic Lighthouse system (QCA 6C) This is a good example of one light sensor sensing light or dark and activating a response sequence. If dark the Repeat sequence is activated to flash the light on/off and if light, the sequence is switched off.
26/09/2003 Challenge 1. Present part of lighthouse solution, such as the If Dark stack. Ask the children to work out how to switch the lamp off in daylight . Challenge 2. Extend the program to switch a motor on/off to rotate a reflector around the lamp. How do I get the Roverbot to respond to different coloured lines or objects? After selecting the Light Sensor from the Sensors bin, choose manual setting in Stage 3 of the wizard. Position the Roverbot with the light sensor over the coloured line and a number will be referenced such as Bright=greater than 50. After clicking on Done, add your blocks to the light sensor stack to set the action. This process can be repeated with the same sensor to open several Light Sensors each looking for a particular colour. Please note, shadows and varying light conditions (time of day) will interfere with the sensor response.
24/10/2003
Scenario 9 One from the BBC Great Egg Race and a fantastic problem solving challenge In this scenario, the Roverbot is to drop a Lego brick half way down a 3 metre course. In my solution, I have use a cheap standard DC 6Volt motor which can be sourced from a D+T supplier or cannibalised from a broken toy. Drill out a small hole on one end of a thin strip of wood and slide through the motor spindle. If necessary, use glue(epoxy) to support the joint. Attach the motor assembly to a Lego strip with bag ties and hot glue (low is best). This then clips onto the Roverbot and is plugged into Output B. In action, the Lego brick is knocked off its perch by the rotating wood strip. If the programming is correct, it should land on the line marked out half way along the course. The team with the brick nearest to the line wins.
Please note this is only my solution. Children working in teams using a combination of Lego, wood strip and found materials could easily arrive at other methods. Drill Tip Drilling the hole for the motor spindle can be an issue as it is very easy to break the expensive drill bit. I found the best way, is to cut the head off a panel pin and use this in a hand drill to 'drill' the hole. It also gives a good fit!
Instead of motor power, consider using a simple elastic band, which as it unwinds moves a pointer flicking off the brick.
Picture to follow
27/10/2003
Scenario 10 Using the MindStorms kit with Gifted or Talented children
This one is a tip, rather than 'how to...' When building programs for the RoverBot (RCX), most users will use Big Blocks for the main structure of the program (QCA 5E) followed by the Sensor Bin to respond to its environment (QCA 6C). As a further challenge, these children could use just Small blocks in the main structure. Big Blocks are composed of small blocks built inside a procedure and named Forward etc. To see how such a block is built, click the 'Open' symbol on the block (small gray button on the top left).
Parts of a one second Forward block Working from the top, the first Small block sets the same motor direction (clockwise) on outputs A and C. The second block switches on Motor A and C. A wait command for 1 second is activated, so the motors run for 1 second. The last block switches off A and C. Note this option is set to coast and when building with small blocks, this can be set to brake.
Please note The Robotics Invention software will not allow the user to change any of the Big Blocks.
Suitable challenge Create a program using only small blocks in MY Blocks (Procedures) to steer the RoverBot around a maze. This would involve planning out the route into segments with your own building blocks for each stage. 1/11/2003
Scenario 11 - Gathering evidence Recording Video with an onboard camera Many entry level low cost cameras now have the option of grabbing not just still images, but also video and even digital sound tracks. This opens up many possibilities for gathering evidence and makes it a perfect tool to encourage thinking skills addressing QCA 6A Multimedia. An excellent example is the new Mustek 4000 Digital Camera (£89). Click this link to see a review. Example 1 Record several short video sequences (less than 10 seconds) which best describe a Lego MindStorms computer control activity. Edit and sequence these clips together using Microsoft MovieMaker 2.
Example 2 Children could use a digital video to record sequences and combinations of actions in an activity. This would help them to evaluate the quality of movements and links by analysing what different body parts are doing during a PE lesson.
Example 3 They could also use their recordings to improve their performances by comparing and contrasting a short play.
If you have any tips or useful sample programs, Fax(01257 516365) or Email James.Mcalea@ICT.lancsngfl.ac.uk
|