Hello,
does anybody know if there's a way to improve the resolution/sensitivity of the standard NXT 2.0 Ultrasonic sensor?
I'm using NXC in my project and the standard SensorUS(<port>); function returns distance values to the nearest cm, between 0 and 255.
I had an idea that the SensorUS() function returns a rounded/processed value and that, if I could get hold of the raw value from the sensor, it would be in the range 0..1023, giving me, theoretically, 0.25cm resolution, or thereabouts.
I've tried getting the raw value from the sensor by using SetSensorMode(<port>,SENSOR_MODE_RAW); but this hasn't had any obvious effect.
I've tried getting the sensor to return the raw value by using SensorRaw(<port>); but the sensor just returns 0.
I had a go at using the LowSpeedRead(<port>,<buffer Length>,<buffer>); function, but this just threw runtime errors on the NXT whenever I tried it, so I resorted to the SysCommLSRead(<argument struct>); to interpret the function return code. SysCommLSRead() uses an incredibly convoluted argument structure type and has to have NXCDefs.h included to work...I think it was returning -32 when I ran it, which is, apparently, ERR_COMM_CHAN_NOT_READY and, at that point, I gave up.
Am I on the right lines trying to get the raw 10-bit value out of the I2C data or am I barking up the wrong garden path, as it were?
I'm trying to square a diff-steering vehicle up to a wall it's alongside by comparing two US sensors mounted at the front and back - 1cm resolution just isn't accurate enough to guarantee it's parallel to the wall...
Any thoughts would be much appreciated,
Thanks :)