Log in

View Full Version : "GetUltrasonic" hangup


P1h3r1e3d13
23-03-2006, 19:52
Has anyone tried using the VEX Ultrasonic sensor with EasyC for FRC? The GetUltrasonic command seems to be taking 1/4 - 1/2 second to execute (which causes big problems). Does it take that long for everyone else?

BradAMiller
24-03-2006, 07:49
Has anyone tried using the VEX Ultrasonic sensor with EasyC for FRC? The GetUltrasonic command seems to be taking 1/4 - 1/2 second to execute (which causes big problems). Does it take that long for everyone else?
Question: is this the first time trying the sensor or has it been working and recently stopped working?

The ultrasonic sensor code will loop while it's getting no result from the sensor, then time out after 2 seconds. If you're seeing that, try checking the connections or the sensor - that the input port on the sensor is connected to the digital output port on the RC and the output port on the sensor is connected to the interrupt port on the RC (digital I/O port 1-6).

A bad connection will result in no returns from the sensor and the timeout will occur.

P1h3r1e3d13
24-03-2006, 17:40
I've checked the connections, and I've used the sensor before, but not in any capacity where I would've noticed the response time.

It is possible that it didn't have anything in range of of which to reflect. Would that cause the timeout?
I'll check whether response time improves when I put something close to the sensor.

BradAMiller
25-03-2006, 07:00
I've checked the connections, and I've used the sensor before, but not in any capacity where I would've noticed the response time.

It is possible that it didn't have anything in range of of which to reflect. Would that cause the timeout?
I'll check whether response time improves when I put something close to the sensor.
If there is nothing in range, then the hardware in the rangefinder returns a maximum value - which wouldn't cause the timeout.

Is the sensor returning valid values after the timeout?

P1h3r1e3d13
12-04-2006, 00:44
Yeah, that's what I thought (about out of range).
And no, it never returns a valid value, so far as I can tell. The user byte display on the OI should be showing the US distance, but all I ever see is 000 or occasionally 012 (for just one loop).

lynca
27-04-2006, 11:16
I have also noticed a considerable hang time when reading the sonar sensor. From testing mulitiple sonars, the problem is usually hardware related such as a loose cable or connector. Always listen for a faint clicking noise to make sure the sonar is operating.

However, the sonar driver needs updating on the easy C kit, possibly something more interrupt based similar to kevin watson's accelerometer code.