Subject:
|
Re: Lego Mindstorms Controlled Train Crossing (Duel Track)
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Fri, 15 Jun 2001 16:37:28 GMT
|
Viewed:
|
966 times
|
| |
| |
Steve Baker wrote:
> 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.
That's what mine does. If any sensor is broken it starts a timer. If no sensors are
broken after the timer expires they go up. This worked very well except for very
short trains. Hence the plans for a third sensor right near the track to take care of
that. Works great. Both ways, multiple tracks...
>
> 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.
--
Coin-Op's For Sale!: http://www.akasa.bc.ca/tfm/coin-op.html
Dean's Lego Workshop: http://www.akasa.bc.ca/tfm/lego_wr.html
Vancouver Lego Club: http://www.akasa.bc.ca/vlc
|
|
Message is in Reply To:
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|