## optical mouse sensor for robot positioning

For the discussion of the sciences. Physics problems, chemistry equations, biology weirdness, it all goes here.

Moderators: gmalivuk, Moderators General, Prelates

brötchen
Posts: 112
Joined: Mon Aug 31, 2009 1:45 pm UTC

### optical mouse sensor for robot positioning

i have a little geometry problem here. it seems to me that for small house robots like the roomba it would be a good idea to get relative heading and speed data (and there for also position date, although position data that is prone to drift) by using the same sensors that are used in optical mice. the problem with this is that you would need more than one sensor because those sensors only detect linear movement and not rotation. the question is: how many do i need? intuitively i would say 2 sensors would suffice to give every 2 dimensional movement of the sensor array a unique date profile but I'm not totally sure. how can i go about proving/disproving that 2 sensors would suffice?

excuse my bad English, I'm not a native speaker.

folmerveeman
Posts: 123
Joined: Thu May 20, 2010 5:39 pm UTC

### Re: optical mouse sensor for robot positioning

I'd think you only need two. One for the X axis and one for the Y axis. Though more would be advisable for correction and accuracy.

Charlie!
Posts: 2035
Joined: Sat Jan 12, 2008 8:20 pm UTC

### Re: optical mouse sensor for robot positioning

Your english is fine, although you could capitalize "I" and the first letters in sentences.

The way to prove or disprove it would be to imagine all possible motions of the robot, and then ask if every motion had a unique sensor pattern.

Thinking about this was easiest for me when I imagined putting one mouse right at the center of your coordinates and one mouse at the edge
Some people tell me I laugh too much. To them I say, "ha ha ha!"

Solt
Posts: 1912
Joined: Tue Mar 27, 2007 5:08 am UTC
Location: California

### Re: optical mouse sensor for robot positioning

brötchen wrote:how can i go about proving/disproving that 2 sensors would suffice?

Proof for motion in one direction:

Let's say we have an object floating in space, no friction or anything. What are the equations of motion of this object? F = 0, so a = 0. We define the "state" vector x, which completely defines the state of this object:

$\mathbf{x} = \begin{pmatrix} x \\ \dot{x} \end{pmatrix}$

where x is position, [imath]\dot{x}[/imath] is velocity, and overdot in general means time derivative. Thus the equations of motion in state-space form are:

$\dot{\mathbf{x}}(t) = \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix}\mathbf{x}(t)$ which is of the form [imath]\dot{\mathbf{x}} = A\mathbf{x}[/imath]. Further let's suppose we have a sensor on both states, so our output [imath]y = \begin{pmatrix} 1 & 1 \end{pmatrix}\mathbf{x}[/imath] which is of the form [imath]y(t) = C\mathbf{x}(t)[/imath]

Now, the rule is that if $rank(\begin{pmatrix} C \\ CA \end{pmatrix})=n$ where A is nxn and C is 1xn, our system is Observable.

Doing the calculations, we see that the observability matrix is full rank if C is as defined. If C = [1 0] (sensor on position only) it is also full rank. If C = [0 1] (sensor on velocity only), the matrix is rank 1 and we cannot deduce the complete state using our sensors. This is because even though we can integrate velocity to get position, we don't know the initial condition completely without having a sensor for position. On the other hand if we could only sense position, we have no problem differentiating to get initial velocity.

Obviously there are caveats. We could always put a sensor on velocity only and "define" our starting position to be zero. Since observability tells us whether we can deduce our initial conditions from sensor measurements, magically "knowing" the initial conditions satisfies the requirement. Of course if we restart our sensors, everything starts from zero and there's no way to measure your location in absolute terms.

If the motion in the x and y direction is uncoupled, which it is in this case, the 1-D case is easily generalized to 2-D or even 3-D motion.

I know this is overkill and not quite what you asked, but I have a final exam on this stuff in about 12 hours and couldn't resist
"Welding was faster, cheaper and, in theory,
produced a more reliable product. But sailors do
not float on theory, and the welded tankers had a
most annoying habit of splitting in two."
-J.W. Morris

Zamfir
I built a novelty castle, the irony was lost on some.
Posts: 7604
Joined: Wed Aug 27, 2008 2:43 pm UTC
Location: Nederland

### Re: optical mouse sensor for robot positioning

Why would you want mouse sensors for this? Roombas etc. already have wheels, so you can get speed and rotation data simply from keeping track of wheel rotation speeds. I suspect that on most surfaces, that will be more accurate than a mouse sensor.

SlyReaper
inflatable
Posts: 8015
Joined: Mon Dec 31, 2007 11:09 pm UTC
Location: Bristol, Old Blighty

### Re: optical mouse sensor for robot positioning

Zamfir wrote:Why would you want mouse sensors for this? Roombas etc. already have wheels, so you can get speed and rotation data simply from keeping track of wheel rotation speeds. I suspect that on most surfaces, that will be more accurate than a mouse sensor.

You'd get a problem similar to IMU drift. Small inaccuracies would add together over time until it's just plain wrong.

What would Baron Harkonnen do?

Zamfir
I built a novelty castle, the irony was lost on some.
Posts: 7604
Joined: Wed Aug 27, 2008 2:43 pm UTC
Location: Nederland

### Re: optical mouse sensor for robot positioning

SlyReaper wrote:
Zamfir wrote:Why would you want mouse sensors for this? Roombas etc. already have wheels, so you can get speed and rotation data simply from keeping track of wheel rotation speeds. I suspect that on most surfaces, that will be more accurate than a mouse sensor.

You'd get a problem similar to IMU drift. Small inaccuracies would add together over time until it's just plain wrong.

Sure, but it's not clear it will do worse than a mouse sensor. And with wheels, you can count the number of rotations without any loss of accuracy in the long run. That still leaves slipping and rough surfaces, but it's still better than just integrating speeds.

Solt
Posts: 1912
Joined: Tue Mar 27, 2007 5:08 am UTC
Location: California

### Re: optical mouse sensor for robot positioning

SlyReaper wrote:
Zamfir wrote:Why would you want mouse sensors for this? Roombas etc. already have wheels, so you can get speed and rotation data simply from keeping track of wheel rotation speeds. I suspect that on most surfaces, that will be more accurate than a mouse sensor.

You'd get a problem similar to IMU drift. Small inaccuracies would add together over time until it's just plain wrong.

A mouse sensor will also give you drift. To actually get a usable estimate your best bet would be some sort of differential GPS using transmitters at known locations in the operating environment. That will clearly be prohibitively expensive. The next best bet is to use both wheel rotation (and orientation) data as well as data from another sensor class, such as a mouse sensor or accelerometer, and merge them using a Kalman filter.

Zamfir wrote:And with wheels, you can count the number of rotations without any loss of accuracy in the long run. That still leaves slipping and rough surfaces, but it's still better than just integrating speeds.

You're assuming there's an encoder on the wheels . The best you can actually do on a Roomba is to measure the relationship between current draw and wheel spin rate in an experiment and then assume it always follows that relationship. Very error prone.

Come to think of it, a mouse sensor will be terribly error prone as well. Like an accelerometer it would work fine for short movements over short distances over flat surfaces... but when you've got all kinds of higher frequency vibrations and a changing surface with a large separation distance, you're going to have a hell of a time integrating it. Lots of filtering will be required.
"Welding was faster, cheaper and, in theory,

produced a more reliable product. But sailors do

not float on theory, and the welded tankers had a

most annoying habit of splitting in two."

-J.W. Morris

SlyReaper
inflatable
Posts: 8015
Joined: Mon Dec 31, 2007 11:09 pm UTC
Location: Bristol, Old Blighty

### Re: optical mouse sensor for robot positioning

Solt wrote:To actually get a usable estimate your best bet would be some sort of differential GPS using transmitters at known locations in the operating environment. That will clearly be prohibitively expensive.

Not necessarily. Use a beacon to project three small infrared spots on the ceiling (the further apart, the more accurate), put an IR sensor on top of the robot, and the robot can calculate its position relative to those spots. You can make it fairly accurate without spending the Earth, and it won't suffer from position drift.

What would Baron Harkonnen do?

brötchen
Posts: 112
Joined: Mon Aug 31, 2009 1:45 pm UTC

### Re: optical mouse sensor for robot positioning

Every one suggesting that mouse sensors might not be the greatest thing for overall positioning of a robot are probably right. The point of using a mouse sensor would be that they have high a resolution and fairly good accuracy over small distances which would help when used in combination with a rotating laser range finder to determine what part of the change in the laser rangefinder data set change is caused by measuring errors, movement of the surrounding and actual movement of the robot, but I'm not even sure if it wouldn't be more useful to just stop the robot while acquiring rangefinder data. Basically I'm trying to think of the optimal low cost robotic platform capable of performing accurate SLAM(simultaneous location and mapping) and the point at which I am now is a robotic platform similar to the roomba but with two laser range finders. I was thinking of modifying some of those http://www.sparkfun.com/products/8959 or similar cheap sharp IR range finders by replacing the IR LED with an IR laser diode to improve range and reduce the size of the measured spot. I would think using two of them, one at an angle to capture a 3d image of the room, one horizontally mounted to allow easy location of the robot relative to the room, would allow for fairly good 3d mapping. Obviously a system like this would benefit greatly from an absolute, non drifting, reliable positioning system like the IR beacons that where suggested as well and I was thinking of incorporating a system like this as well (For the camera one could use a wiimote which is basically a dedicated device for exactly this application).