PS/2 Mouse Scaling Issues?
Jared5755
Posts: 26
I'm using the PS/2 mouse library.· I think I'm having scaling issues.· When I move the mouse at a moderate speed my LCD displays correct values (move left then back right and end at 0,0).· When I move the mouse fast left then slow right it doesn't get anywhere near 0,0.
I've read into the PS/2 protocol and it looks like the mouse needs to be scaled to 1:1.· I see the function in mouse.spin called "bound_scales(x_scale, y_scale, z_scale)", but am unsure how to use it...and if this is how I fix it.
I'm trying to use the mouse to tell my robot it's position on a small board.· Obviously I don't care about how fast the mouse (i.e. robot) is moving, just where it is.
The parallax web site and downloads section seems to be down so I can't go look at other people's examples.
Thanks a lot
I've read into the PS/2 protocol and it looks like the mouse needs to be scaled to 1:1.· I see the function in mouse.spin called "bound_scales(x_scale, y_scale, z_scale)", but am unsure how to use it...and if this is how I fix it.
I'm trying to use the mouse to tell my robot it's position on a small board.· Obviously I don't care about how fast the mouse (i.e. robot) is moving, just where it is.
The parallax web site and downloads section seems to be down so I can't go look at other people's examples.
Thanks a lot
Comments
But, I think the mouse driver uses software scaling so you should be fine.
Also, There are other mouse drivers also aviable in the object exchange. Try out the different version to see which one works the best.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 2/4/2009 10:02:46 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Parallax Forums - If you're ready to learn, we're ready to help.
I'm not using the parallax mouse. The object exchange was down earlier today, I'll check there for more versions. I did see yours in the forums, but haven't had a chance to test it yet.
I don't think I'm overrunning the bounds since I'm only moving it around a standard size mouse pad as I'm testing.
Just to make sure I'm understanding this correctly, here's what I think the problem is. When you move a mouse around a computer screen, the slower you move the more distance you must move the get the mouse from point A to point B. So if you jerk the mouse left 1 inch, the PC mouse will move across the entire screen. But if you slowly move left 1 inch the mouse moves only a little bit on the screen. I need someway to make it so the mouse "moves" (outputs distances in my case) the same distance everytime my robot moves X inches (no matter how fast the robot moves X inches).
I'll do some more testing to make sure my problem isn't somewhere else.
You'll have acess to a locked max and min 16 bit signed counters for the x and y positions and acess to hardware deltas for the x and y positions.
Note, that when I say hardware deltas I literally mean the delta is what the mouse sends to the driver when it moves. Because of this you need to poll the hardware delta pretty fast because the driver overwrites it every 100ms or so. But if
you have a fast program checking the deltas then you can get the exact movement reported by the mouse.
Since the driver runs the mouse at 4 counts per millimeter (4 for every 1) you can get a pretty good estimation on distance traveled.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,