|
In lugnet.robotics.nxt, Kevin L. Clague wrote:
> You might be able to come up with a simpler algorithm, but
> this one should be very reliable.
Well, just for diversity here's a slightly different approach. Make the first
block a "Reset Timer" block, then split the program into four sequences. Each is
simply a "Wait for Touch Sensor", followed by "Read Timer" block with the result
wired into a variable block: "Time1", "Time2", "Time3, or "Time4". after all
these timers are non-zero, just compare them to determine the winner.
You could have each sequence beam display its own time on a certain line on the
LCD "as it happens", which would be fun to watch. Note also that for alternative
implementations of this, four parallel sequence beams might not be needed -
after all, even with four sequences "in parallel", the NXT is really only
watching them one at a time. By using the the "Wait" block you get around this
slightly (the FW is watching the sensors, not your program), but there's always
going to be a sequential evaluation of the sensors... it then becomes a question
of how often the sensors are polled, vs. how close you realistically think the
race is going to be.
--
Brian Davis
|
|
Message has 1 Reply: | | Re: NXT Newbie "Is it possible" question
|
| (...) I like it! As they say "There's more than one way to skin a cat". I work on computer servers that have 128 CPUs per chip and 512 CPUs per pizza sized box, and I knew that there is no true parallelism here with the NXT :) I like your design, (...) (14 years ago, 26-Aug-10, to lugnet.robotics, lugnet.technic)
|
Message is in Reply To:
| | Re: NXT Newbie "Is it possible" question
|
| (...) Chris, Sure it is, as long as the NXT cables are long enough to place the sensors where you want on the track. As you already figured out, the tricky bits are in the software. Here is pseudocode for what I would do were I to program it in G (...) (14 years ago, 19-Aug-10, to lugnet.robotics.nxt)
|
9 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
|
|
|
|