I got it to work! USB mice

It has come full circle. Years ago I joined this forum as a student with the sole goal to learn how to get optical mice to work with the microcontroller we had at the time. Now, seven years later and back on board as a mentor, (and with the new roboRIO having USB ports) I can finally say I GOT IT!

So here’s a video tutorial I made. I included links to the necessary files in the dooblydoo.

Very interesting. The idea to use a wireless mouse to control the robot, correct? Am I correct to assume this wouldn’t be for competition use.

No. It’s to put a hardwired optical mouse on the robot for position tracking.

I’m assuming the mouse would read the carpet then as move around. Then using the equation you stated you could tell how far away you are from your starting position?

Exactly.

So it reads in pixels then you’d divid it by your dpi. How accurate is it?

I’d also like to know… In my experience most mouse only maintain about 95% accuracy (meaning that the same motion repeated an infinite number of times will have a 5% deviance in delta distance). At the start of the season I expected to integrate the accelerometer to obtain velocity, but it’s noise is horrendous. If the mouse gets good data, than it might be a good option.

Also, whats the issue with

MouseInfo.getPointerInfo().getLocation().x

This would be used to replace the gyro then? How close to the ground does the mouse have to be?

This is a pretty awesome achievement. Position this guy at the center of rotation, and the measurement is very precise. Do you know if it works on the HDPE surface of the scoring platform? I know mice tend to go crazy if used on glass, or sometimes even an overly-polished conference room table.

I don’t yet know how accurate it is. We are printing a plastic board to hold the circuitry to better mount it on a practice bot. I’ll update this thread with how well it works once we know. However, the manufacturer claims it can detect speeds up to 10 feet/sec and has a resolution of 1000 pixels per inch. When leaving it stationary on carpet similar to competition carpet, it had an error of about 1 pixel (or 1/1000 in) every five minutes. This was not rigorously tested.

Also, whats the issue with

MouseInfo.getPointerInfo().getLocation().x

Two issues: first, that requires a screen to be set up as the pointer only exists with a display. That would have been possible to do (set up a dummy XServer on the roboRIO) but you would have to constantly reset the pointer’s position each time you got its location as once it reaches the end of the imaginary screen, it wouldn’t go any further. That was something I was prepared to do as well if this didn’t pan out, but getting the raw data seemed more elegant to me.

One mouse could not replace the gyro as it only measures linear distance. However, two mice (and there are two USB ports) could replace the gyro. That is our intention if this ends up working reliably (see above). As far as distance to the ground, pretty close. It’s a gaming mouse, so it was designed to not register anything if it’s more than even a quarter of an inch off the ground (so that a gamer could move the mouse forward for a game and pick it up to reset it on their mouse pad without redacting the action they just made in game), so we’re using a smooth and curve-ended plastic board for it to slide on with springs holding it to the ground. The springs will hopefully allow it to slide up the ramps.

Putting it at the center of rotation does not need to be done if two mice are used to get actual rotation. However, lining them up along the robot’s x and y axis will be the challenge, considering the resolution this mouse has…
I do not know if it will work on the scoring platform. All it needs is imperfections on the surface at least 1/500th of an inch for it to work. Even if not, the main purpose of this was to drive precisely in auto, and we can just tell it to go around.

hm. The only issue I see is sensor distance. I have a laser mouse with me ATM and I can only hover it ~1cm above the mousepad for it to pick up, any higher and the cursor doesn’t move. How far above the carpet does your team plan to mount your mouse? My biggest fear would be chipping the mouse when going over the bump

We’re making a custom base for the mouse’s circuitry to rest on and using springs to keep it to the ground while allowing it to rise up on the bump. It also cannot be too far from the ground. Also, we’re using an optical mouse, though that doesn’t matter too much.

We are looking at options for tracking position ahead of next build season. Can you share how you physically mounted the mouse (pics), and any performance information you gained this season (how well it worked)?

Thanks!

Unfortunately, we never got around to it. Too much got in the way. I hope to try it for this coming year, though, as we still have all the parts.

I still do intend to update this thread with any information once we have it

This would be useful in the coming season!
Correct me if I’m wrong, in order to use an optical mouse to track the robot’s position it has to be centered around the rotation axis of the robot, otherwise it will sense rotation in place as a change in the robot’s position.

It does not have to be centered around the rotational axis of the robot; it only needs to be straight; facing the same direction as the robot as perfect as you can get it. Its ‘X’ axis needs to be parallel to the robot’s ‘X’ axis. You can put it in the corner of the robot so long as it lines up with the robot’s build direction