Ticket #95 (new defect)

Opened 4 years ago

Last modified 3 years ago

processing low/high speed of gyro

Reported by: emris Owned by: dsmith
Priority: major Milestone:
Component: libcwiid Version: 0.6.00
Keywords: Cc: spma@…

Description

the gyros have two distinct speed-modes that need to be taken account of. see  http://wiibrew.org/wiki/Wiimote/Extension_Controllers#Wii_Motion_Plus

The factor between low and high speed seems to be 4, so the code to be added should read like this:

if (!data[3]&0x02) { motionplus_mesg->angle_rate[CWIID_PHI]*=4;}

if (!data[4]&0x02) { motionplus_mesg->angle_rate[CWIID_THETA]*=4;}

if (!data[3]&0x01) { motionplus_mesg->angle_rate[CWIID_PSI]*=4;}

Attachments

motionplus-speed.patch Download (1.4 KB) - added by JGebart 4 years ago.
Added high/low speed bit detection, fixed incorrect bitmask on angle rate reading

Change History

follow-up: ↓ 2   Changed 4 years ago by JGebart

  • cc spma@… added

Actually according to the wiibrew page, the factor seems to be 5. I might implement this in libcwiid sometime soon if I have the time because I need the gyros in the M+ in a project I'm working on.

in reply to: ↑ 1   Changed 4 years ago by JGebart

Replying to JGebart:

Actually according to the wiibrew page, the factor seems to be 5. I might implement this in libcwiid sometime soon if I have the time because I need the gyros in the M+ in a project I'm working on.

... And when I looked at libcwiid/process.c I realized that the only change needed is the one mentioned by dsmith. I will test it tonight.

When I wrote the previous post I thought it might need some more tweaking in other parts but it seems really straightforward.

/JG

Changed 4 years ago by JGebart

Added high/low speed bit detection, fixed incorrect bitmask on angle rate reading

  Changed 4 years ago by JGebart

Attached the changes, will test them tonight, don't have time right now. I fixed a bug too. The bitmask when reading the angle rate was 0xFA, which means 11111010 in binary, the correct is 0xFC which is 11111100. This bug has messed upp all gyro readings to the degree that they only had 5 bits precision instead of 14.

/JG

  Changed 3 years ago by Chimrod

I disagree with this patch : it mult by 5 the raw data sent by the captor ! The solution would be to mult by 5 the difference between the raw value and the calibration value for each axe as described in the wiibrew homepage. The patch gives wrong values as soon as we are in speed mode !

This is not cwiid job to do this ( cwiid send the raw data and let the developer interpret them ), but it is cwiid job to give all the informations for calculate if the raws values should be interpreted as speed or as low values ( the python code does not provide it. )

Note: See TracTickets for help on using tickets.