Page 1 of 1
Wiimote[n].ahrs wrong behavior
Posted: Thu Nov 02, 2017 4:03 pm
by neonflux
Without moving the Wiimote and letting it lay down on the table the expressions:
wiimote[0].ahrs.yaw
wiimote[0].ahrs.pitch
wiimote[0].ahrs.roll
are not giving a fixed value (as they have to do), instead they give a number that continuosly increse/decrease by a little causing it loose the calibration of 0 spot
I need it stays calibrated cause i want to use it as a steering wheel
There's any workaround?
Thanks for reply
Re: Wiimote[n].ahrs wrong behavior
Posted: Thu Nov 02, 2017 4:21 pm
by zelmon64
neonflux wrote:I need it stays calibrated cause i want to use it as a steering wheel
There's any workaround?
Thanks for reply
You're probably better off calculating the angle from gravity with the acceleration.
Re: Wiimote[n].ahrs wrong behavior
Posted: Thu Nov 02, 2017 4:45 pm
by neonflux
Could you make an example pls?
The expression i use now to obtain the delta is:
yaw = 350*filters.deadband(filters.delta(wiimote[0].ahrs.yaw),0.01)
Thanks
Edit: Lol you are the one that reply at github too, I've noticed now :/
Re: Wiimote[n].ahrs wrong behavior
Posted: Fri Nov 03, 2017 8:44 am
by zelmon64
neonflux wrote:Could you make an example pls?
Sure thing:
Code: Select all
def acc_update():
diagnostics.watch(wiimote[0].acceleration.x)
diagnostics.watch(wiimote[0].acceleration.y)
diagnostics.watch(wiimote[0].acceleration.z)
accx = wiimote[0].acceleration.x
accy = wiimote[0].acceleration.y
if accx == 0:
angle = 0
else:
angle = math.atan(accy/accx)
diagnostics.watch(angle)
if starting:
wiimote[0].acceleration.update += acc_update
neonflux wrote:Edit: Lol you are the one that reply at github too, I've noticed now :/
Yep
Re: Wiimote[n].ahrs wrong behavior
Posted: Fri Feb 09, 2018 2:00 am
by WestleyTwain
zelmon64 wrote:
Code: Select all
def acc_update():
diagnostics.watch(wiimote[0].acceleration.x)
diagnostics.watch(wiimote[0].acceleration.y)
diagnostics.watch(wiimote[0].acceleration.z)
accx = wiimote[0].acceleration.x
accy = wiimote[0].acceleration.y
if accx == 0:
angle = 0
else:
angle = math.atan(accy/accx)
diagnostics.watch(angle)
if starting:
wiimote[0].acceleration.update += acc_update
so I tried this on my wiimote, and this y/x seems to be (or at least emulate) the pitch. I've tried replacing y and x with all combinations of x, y, and z, but for some reason, can't consistently get roll or yaw. If y/x = pitch, then what's roll and yaw? I'm very new to this so all help is welcome and appreciated.
Re: Wiimote[n].ahrs wrong behavior
Posted: Sat Feb 10, 2018 5:51 am
by WestleyTwain
WestleyTwain wrote:
so I tried this on my wiimote, and this y/x seems to be (or at least emulate) the pitch. I've tried replacing y and x with all combinations of x, y, and z, but for some reason, can't consistently get roll or yaw. If y/x = pitch, then what's roll and yaw? I'm very new to this so all help is welcome and appreciated.
I see what this is doing now. Sorry to bother y'all!