Subject:
|
Re: Lego Mindstorms Controlled Train Crossing (Duel Track)
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Fri, 15 Jun 2001 07:46:24 GMT
|
Original-From:
|
Steve Baker <sjbaker1@+avoidspam+airmail.net>
|
Reply-To:
|
[sjbaker1@airmail.net]antispam[]
|
Viewed:
|
896 times
|
| |
| |
Ross Crawford wrote:
> Nice! I too have been tossing around something like this! My idea was very
> similar, but used 4 light sensors, 2 in parallel like this:
>
> Crossing -> | |
> ================================ <- Track
> X1 X2| |X3 X4
>
> X2 & X3 are in parallel, when X1 is broken, boom goes down & stays down
> while either X1, X2 or X3 is broken. Similarly for X4. This means X1 & X4
> can be some distance from the crossing, so the boom goes down long before
> the train arrives, but raises very quickly after it leaves. Safer for minifigs!
I'm a programmer - and I have an evil mind...
The train driver spots a JarJar Binks minifig standing at the crossing and
with murderous intent he trundles swiftly past X1, X2 and X3 - and then
stops...just far enough along to block X4 - but not un-block it again. Then
as soon as the gates go up, (because X1,X2 and X3 are no longer blocked), he
looks back and seeing JarJar step onto the crossing he reverses back up
the track at full speed. JarJar gets KERSPLATTED because the RCX can't
tell that the train is reversing and so the gates don't close.
Even if you modify the code to put the gates back down again when X3 is
once again covered, that'll be too late to save poor JarJar. <sniff>
So, what to do?
I think you need to make the rule that the distance between any consecutive
pair of sensors must be less than the length of the shortest train so you are
always sure when the train is anywhere near the crossing.
Then the software is simple. If *any* light sensor is broken - flash the
lights for a fixed amount of time then lower the gates and keep them
down until no light sensors are broken - then stop the lights flashing
and immediately raise the gates.
ALL of the light sensors can now be in parallel and the number you need
is entirely dependent on how many shortest-train-lengths away from the crossing
the fastest train must be to give old Granny-minifig time to get across the
crossing with her little 2x2 stud Zimmer frame from when the lights start
flashing (PLUS the time it takes to shut the gates).
Raising the gates can happen sooner than lowering them because you
can start the moment the train clears all of the sensors without all the
tedious light flashing and bell ringing stuff.
Notice that this also works for multiple tracks running through the same
crossing and for multiple trains running along one or more tracks.
Another option is to have just two light sensors very close together
on either side of the crossing. Then for each pair, you can tell from the
order that they are covered and uncovered whether the train was entering
the region between the two sensor pairs or leaving it. You can easily
deal with very short trains - and if you are careful, with multiple trains
on the same track by counting the number that enter the protected section
of track and the number that leave it.
Unfortunately, you can't do this without four RCX inputs (or some kind of
multiplexor)...which isn't so nice.
----------------------------- Steve Baker -------------------------------
HomeMail : <sjbaker1@airmail.net> WorkMail: <sjbaker@link.com>
HomePage : http://web2.airmail.net/sjbaker1
Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net
http://agtoys.sf.net http://prettypoly.sf.net
http://freeglut.sf.net http://toobular.sf.net
|
|
Message has 1 Reply:
Message is in Reply To:
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|