Wiimote[n].ahrs wrong behavior

Official forum for open source FreePIE discussion and development.
Post Reply
neonflux
One Eyed Hopeful
Posts: 2
Joined: Tue Oct 31, 2017 6:30 pm

Wiimote[n].ahrs wrong behavior

Post 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
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Wiimote[n].ahrs wrong behavior

Post 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.
neonflux
One Eyed Hopeful
Posts: 2
Joined: Tue Oct 31, 2017 6:30 pm

Re: Wiimote[n].ahrs wrong behavior

Post 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 :/
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Wiimote[n].ahrs wrong behavior

Post 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 :lol:
WestleyTwain
One Eyed Hopeful
Posts: 13
Joined: Mon Jan 29, 2018 4:41 pm

Re: Wiimote[n].ahrs wrong behavior

Post 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.
WestleyTwain
One Eyed Hopeful
Posts: 13
Joined: Mon Jan 29, 2018 4:41 pm

Re: Wiimote[n].ahrs wrong behavior

Post 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!
Post Reply

Return to “FreePIE”