View unanswered posts | View active topics It is currently Wed Nov 26, 2014 3:04 pm






Reply to topic  [ 6 posts ] 
NXT Sensor Update Rate 
Author Message
Rookie

Joined: Wed Oct 23, 2013 5:16 pm
Posts: 3
Post NXT Sensor Update Rate
I was working on a basic line-tracking program for my school robotics course, when I started wondering if there was any way to make the NTX Sensors (ex: active light, ultrasonic, sound, touch, etc.) update faster. For me, it seemed like the sensors took a new reading about ever 400 ms or so. Is this the fastest I will ever get? Or is there something I can do to make the sensors take new readings faster? Thanks in advance.


Wed Oct 23, 2013 5:21 pm
Profile
Professor
User avatar

Joined: Sat May 18, 2013 1:24 pm
Posts: 272
Location: Olympia, WA
Post Re: NXT Sensor Update Rate
The poll rate for the sensors is a default of once per 10ms, and can be "overclocked" to once per 3ms. I don't remember where I read that information. Somewhere on Xander's blog I think. :) I don't know how you would actually make them update faster... How did you figure out the update speed? Are you printing out the time it takes to execute each loop? Is there other stuff in that loop that might take lots of time to execute?

_________________
FTC Team 6424, the 'Oly Cow - Chief programmer.
FRC Team 4450, Olympia Robotics Federation (ORF).

and also quadrotors. Quadrotors!


Wed Oct 23, 2013 9:34 pm
Profile
Rookie

Joined: Wed Oct 23, 2013 5:16 pm
Posts: 3
Post Re: NXT Sensor Update Rate
There was not any specific update rate I found. I just noticed that when looking at the panel in RobotC where it shows the state and values of all the sensors plugged into the brick, the value of my light sensors were only changing once ever 400 ms or so. I may be doing something wrong, but I assumed that that meant the poll rate was ~400 ms. Is this true?

Edit: Forgot to add that I know it wasn't the loop just taking too long to execute. I tried once with nothing in the loop but taking the value of the sensor and printing on the screen. Unless printing on the screen takes 390 ms, I think I've ruled that out.


Wed Oct 23, 2013 10:01 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3293
Location: Rotterdam, The Netherlands
Post Re: NXT Sensor Update Rate
That polling window is just for diagnostics, it's not really meant to be used for fast changing sensor readings. If you use a program to poll the sensors, you should be able to read a new value from the analogue sensors at a rate of 333Hz (every 3 ms). The I2C can vary due to the number of bytes that need to be transferred, sometimes that's 1, 2, 4 or even more. You can max it out at about 500 transactions per second: http://botbench.com/blog/2009/11/05/i-f ... for-speed/

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Oct 24, 2013 3:56 am
Profile WWW
Rookie

Joined: Wed Oct 23, 2013 5:16 pm
Posts: 3
Post Re: NXT Sensor Update Rate
Is there any specific way to tell the sensors to take a new reading other than just saying:

SensorValue(lightSensor);

Does this not actually poll the sensors, just takes the current value of the sensor?

- Z


Fri Oct 25, 2013 11:07 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3293
Location: Rotterdam, The Netherlands
Post Re: NXT Sensor Update Rate
It takes he value that has been assigned to it by the built-in drivers. If you're using my 3rd party driver suite, you have more control over when the data is read from your digital sensors. For the analogue ones the case is still that you rely on the firmware's internal mechanisms to poll it for you. Mind you, this data should never be older than 3ms, which is probably more than adequate :)

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Oct 26, 2013 4:55 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.