|
Re: FRC Sonar Reading Delays
Post some code?
What type of sonar sensor is it, and how it it configured in software?
Some output an analog voltage. These should be pretty clear and easy to use with an AnalogInput.
Some have two digital lines, one pulsed to transmit and one pulsed when the sonar receives a ping back. You have to pulse the TX pin and measure the time before you get a response on the RX pin. This can take time, and if your timeout is very long (e.g. a second) and the response pulse is either missed or lost then your code would wait for a very long time. My guess is this particular condition causes a pulse to be lost, but the RoboRIO is waiting for a pulse for a second before giving up on it.
Another option is that something else in the same thread is blocking, and preventing the sonar code from executing.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor
"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
|