Shop OBEX P1 Docs P2 Docs Learn Events
PS/2 Mouse Scaling Issues? — Parallax Forums

PS/2 Mouse Scaling Issues?

Jared5755Jared5755 Posts: 26
edited 2009-02-04 22:08 in Propeller 1
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

Comments

  • KyeKye Posts: 2,200
    edited 2009-02-04 20:08
    Well if you are using the parallax mouse do not try to enable hardware based scaling or resolution changes, it will not work - the mouse just stops working. You most likely cannot do this anyway without hacking the driver.

    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
  • CJCJ Posts: 470
    edited 2009-02-04 20:35
    you might be overrunning the bounds, the mouse driver will stop counting on the bounded axis if you continue moving in the same direction once the boundary has been reached. then once you start back, it takes less to get back to zero due to the first motion being clamped in data

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax Forums - If you're ready to learn, we're ready to help.
  • Jared5755Jared5755 Posts: 26
    edited 2009-02-04 21:19
    Kye said...
    Well if you are using the parallax mouse do not try to enable hardwarwe based scaling or resolution changes, it will not work - the mouse just stops working. You most likely cannot do this anyway without hacking the driver.

    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.

    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.

    CJ said...
    you might be overrunning the bounds, the mouse driver will stop counting on the bounded axis if you continue moving in the same direction once the boundary has been reached. then once you start back, it takes less to get back to zero due to the first motion being clamped in data

    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.
  • KyeKye Posts: 2,200
    edited 2009-02-04 22:08
    Then try my driver. The interface is very different but it will work for pretty much all PS2 mice.

    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,
Sign In or Register to comment.