Tuesday, December 17, 2013

Lasers and Servos!

So you've mounted a sensor on a servo and are happily gathering data as your sensor sweeps back and forth.

Where is your sensor looking?

For some obstacle avoidance tasks it doesn't matter much. If the sensor detects something 'close' and has a field of view in the direction of travel, that might be all you need.

But what if you need to do some trigonometry with the sensor angle to determine actual range or elevation?

Probably then you'll want to move the servo a bit, wait for the servo to move, and then take a reading.

How long to wait? Based on published specs, you might do some math like 60 degrees in 0.18 seconds is 3ms per degree, and call it a day.

Or, you could strap a laser to the servo and actually measure it.

I did this experiment by mounting a small $5 laser on top of the servo and turning it on for 1ms at the measurement points, and set my camera to a 1.5 second exposure. That way I can see the entire sweep, and where the laser spots are really pointed. The angles used are chosen that they fall at equidistant points on a flat surface when the servo is mounted to the rover. Here, at the incorrect angle, it's still obvious that timing is everything.

Watch below as the delay between moves is decreased; the measurement position becomes more incorrect because the servo can't keep up. The start position is on the right, and the furthest travel is on the left. See how the dots start to shift to the right?

I'll need to refine the tuning code so I can adjust the delay per movement once it's mounted in the right orientation and position on the rover. That way I can ensure that the delay is correct, and that my chosen angles actually fall at evenly spaced points on the ground in front of the rover. Stay tuned!

No comments:

Post a Comment