![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
...but I need a little help, I just can't find any good way to pre-process the accelerometer/gyroscope data from the thing.
qdot, you have any math in your back pocket somewhere? Specifics:
10-bit X/Y/Z accelerometer, data returned unsigned. 4G range, centered on 512. Lowest 2-3 bits flicker madly at rest on a table.
10-bit gyroscope, no idea if that's the right term but it's what everything calls it. Indicates how much rotational velocity the controller has around the axis that goes straight up through the face of the controller if it's set down on a table. Unknown exact velocity mapping, approximately 180 degrees rotation in 0.9-1.1 seconds just barely pegs the meter. Clockwise is lower, counterclockwise is higher.
I'd like to return full six axis results, if it's possible from these values? If a reduced set of values is the best we can do, that's fine too. Right now I have the HID Descriptor coded for -128 to +127, if someone thinks raising the range is useful, I can and will.
Since the Linux-USB list ignored my e-mail asking if it was the appropriate place for HID discussion and if there was anything I should know to make this patch more likely to get accepted (likely due to my name not looking real enough, I'd imagine) I'll just drop a patch on them, see what they say then. But I'd like the patch to be damn high quality, so I don't want to screw up the accelerometer handling if I can avoid it. :-)
![[livejournal.com profile]](https://www.dreamwidth.org/img/external/lj-userinfo.gif)
10-bit X/Y/Z accelerometer, data returned unsigned. 4G range, centered on 512. Lowest 2-3 bits flicker madly at rest on a table.
10-bit gyroscope, no idea if that's the right term but it's what everything calls it. Indicates how much rotational velocity the controller has around the axis that goes straight up through the face of the controller if it's set down on a table. Unknown exact velocity mapping, approximately 180 degrees rotation in 0.9-1.1 seconds just barely pegs the meter. Clockwise is lower, counterclockwise is higher.
I'd like to return full six axis results, if it's possible from these values? If a reduced set of values is the best we can do, that's fine too. Right now I have the HID Descriptor coded for -128 to +127, if someone thinks raising the range is useful, I can and will.
Since the Linux-USB list ignored my e-mail asking if it was the appropriate place for HID discussion and if there was anything I should know to make this patch more likely to get accepted (likely due to my name not looking real enough, I'd imagine) I'll just drop a patch on them, see what they say then. But I'd like the patch to be damn high quality, so I don't want to screw up the accelerometer handling if I can avoid it. :-)
6DOF pose
Date: 2009-05-13 01:52 am (UTC)The accelerometers, being near the earth, will always report acceleration due to gravity. If you hold the controller perfectly still, you can determine pitch and roll because you can find the direction straight down. You cannot determine yaw. So, Sony adds a rate gyro to tell you when you turn the controller around the vertical axis (yaw). As long as you hold the controller perfectly level (or otherwise keep the controller always in the same plane) -- forever -- you can determine an exact pose relative to wherever you started measuring. Integrate the rate gyro over time to get yaw. To get roll and pitch, we have to assume that the controller is level. Integrate them over time too. This assumption that the controller is level (or some other constant) lets us subtract gravity out of the accelerometer readings and find out how the controller is moving relative to us.
You cannot detect roll or pitch directly with the sixaxis. As soon as you tilt the controller, you will not be able to subtract gravity, and hence you will not be able to distinguish your movements from the effects of gravity. You cannot detect this tilt because you have no gyros for pitch or roll, so you will not know when this happens. Your accelerometers will register a tilt to the left exactly the same as a strafe to the right. You can only know when the controller stops moving that you have been wrong: Wait for the magnitude of the accelerometers to roughly equal the magnitude of gravity. This means that the controller is in some position (unknown yaw) but remaining still. Reset all your positions and assume that this is your starting point. You can know an exact relative position from this point as long as you only rotate in the plane of the rate gyro. This is effective enough for games that only care about gestures or small movements, but not 6DOF.
http://wiki.ps2dev.org/ps3:hardware:sixaxis
http://wiki.ps2dev.org/ps3:linux:sixaxis
Hope this helps you plan your project.
-twoeven