Subject:
|
Re: Ooops! NXT Software Comparison correction
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Sun, 2 Sep 2007 19:21:51 GMT
|
Viewed:
|
22448 times
|
| |
| |
In lugnet.robotics.nxt, Walt White wrote:
> I found this as I was testing the NXC speed test. I had the brick connected
> to Tribot and the motors started moving so I realized that my pbLua code
> needed some work.
>
> I can only get 1784 loops per minute on the NXC code, instead of the 4285
> noted on the Team Hassenplug web site.
>
> I tried commenting out the displays on the NXC code and got 1875 loops per
> minute, but the NXT brick itself was updating the display with a changing
> icon to show that a program was running, so it appears that there is no way
> to stop the display action completely.
Nearly all of the speed test numbers on Steve's page are wrong. That's because
Steve's loop boils down to "how fast can you reliably read the LEGO Ultrasonic
Sensor". You can't reliably read a value from that device faster than about
once every 15 milliseconds at the very fastest. If you try to read from it
faster than that then you will get back bad data.
Beta 28 of NBC/NXC corrected a problem with reading the Ultrasonic sensor too
quickly in a tight loop (like Steve's) by adding a 15 ms wait prior to each
sensor read. The maximum loop iterations possible when you read the US sensor in
a way that does not cause it to return incorrect readings is 4k. The total time
required to complete a valid I2C transaction with the LEGO US sensor using the
standard LEGO firmware is closer to 30 ms when you include the required ~15ms
delay.
In NXC if you replace the SensorUS(port) call with an analog sensor read using
Sensor(port) then the loop count with LCD drawing of ~1800 turns into a loop
count with LCD drawing of 18.7k. If you take out the LCD drawing then with NXC
you get ~35k iterations. So as you can see any tool claiming to get 103k or 412k
iterations while successfully completing an I2C read transaction that returns
correct data from the LEGO Ultrasonic sensor is suspect.
John Hansen
|
|
Message has 2 Replies: | | Re: Ooops! NXT Software Comparison correction
|
| (...) So if I cheat I can move the I2C transaction out of the actual timing loop (which may be what some other folks are doing, effectively) then with a "read" of the Ultrasonic sensor value in the loop and all sensors and motors attached I get (...) (17 years ago, 2-Sep-07, to lugnet.robotics.nxt)
|
Message is in Reply To:
| | Ooops! NXT Software Comparison correction
|
| My bad. When I fiddled with the pbLua code I forgot to turn on the motors and neglected to change the Motor A speed. So when you ran the program, the motors didn't move. I also had uploaded the wrong version to my web site of the version that shows (...) (17 years ago, 1-Sep-07, to lugnet.robotics.nxt)
|
13 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
|
|
|
Active threads in NXT programmable brick
|
|
|
|