[PD] gimbal lock solution?

2013-02-09 Thread Fero Kiraly
Iam trying to rotate GEM object with my android phone, sending from acc
sensor througth OSC

Gem object rotateXYZ is not the solution for that, maybe because of gimbal
lock effect...

Did anybody similar working patch in pd ? Or can somebody hel me ?
many thanks.

fk.
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] gimbal lock solution?

2013-02-09 Thread Roman Haefeli
On Sam, 2013-02-09 at 13:07 +0100, Fero Kiraly wrote:
 
 Iam trying to rotate GEM object with my android phone, sending from
 acc sensor througth OSC
 
 
 
 Gem object rotateXYZ is not the solution for that, maybe because of
 gimbal lock effect...
 
 
 Did anybody similar working patch in pd ? Or can somebody hel me ?
 many thanks.

If I understand the gimbal lock correctly (I only read about it now),
your problem seems not related to it. With accelerometer data only, you
can only calculate two axis of orientation (pitch and roll), while yaw
is still missing. You cannot measure the angle of rotation along the
direction of gravity with accelerometers. You'd need something else for
yaw, a compass or a gyroscope (while the latter is giving you only
relative measurements).

Roman 


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] gimbal lock solution?

2013-02-09 Thread Fero Kiraly
I have 3 axis accelerometer and 3 axis orientation sensor in my device.
So i can get 0 - 360 deg on X, Y and Z.


When I draw in GEM a rectangle, I am able to rotate it with each of 3 axes,
but only separately. When I try it  with all three axes together
it has strange movements, so I guess it has something with gimbal lock.
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] gimbal lock solution?

2013-02-09 Thread Cyrille Henry

hello,

rotateXYZ is doing : rotation X then  rotation Y then rotation Z

this is not the same than :
rotation Z
rotation Y
rotation X

So, depending on how works your orientation sensors, you could have to change 
the rotation order.

you can try, using 3 rotateXYZ object.

cheers
c



Le 09/02/2013 14:45, Fero Kiraly a écrit :

I have 3 axis accelerometer and 3 axis orientation sensor in my device.
So i can get 0 - 360 deg on X, Y and Z.


When I draw in GEM a rectangle, I am able to rotate it with each of 3 axes, but 
only separately. When I try it  with all three axes together
it has strange movements, so I guess it has something with gimbal lock.




___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list



___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] gimbal lock solution?

2013-02-09 Thread Roman Haefeli
I believe it is (unfortunately) not as simple as that. When you rotate
with [rotateXYZ], the three axis are not always perpendicular to each
other. For instance, if you set Y to 90, the X and the Z rotate around
the same axis. 

However, the gyroscope (at least the one from Wiimote MotionPlus and
most likely also the one from your phone) consists of three separate
sensor which are perpendicular to each other at any time. 

If I understand Fero correctly, he would like to use the sensors so he
can control an object in Gem that follows exactly the orientation of his
phone. I also tried that once with a Wiimote and Gem but I couldn't wrap
my head around the two concepts of [rotateXYZ] and the gyro sensors.

Anyone enlightened might be able to shed some light on this confusion?

Roman


 

On Sam, 2013-02-09 at 15:18 +0100, Cyrille Henry wrote:
 hello,
 
 rotateXYZ is doing : rotation X then  rotation Y then rotation Z
 
 this is not the same than :
 rotation Z
 rotation Y
 rotation X
 
 So, depending on how works your orientation sensors, you could have to change 
 the rotation order.
 
 you can try, using 3 rotateXYZ object.
 
 cheers
 c
 
 
 
 Le 09/02/2013 14:45, Fero Kiraly a écrit :
  I have 3 axis accelerometer and 3 axis orientation sensor in my device.
  So i can get 0 - 360 deg on X, Y and Z.
 
 
  When I draw in GEM a rectangle, I am able to rotate it with each of 3 axes, 
  but only separately. When I try it  with all three axes together
  it has strange movements, so I guess it has something with gimbal lock.
 
 
 
 
  ___
  Pd-list@iem.at mailing list
  UNSUBSCRIBE and account-management - 
  http://lists.puredata.info/listinfo/pd-list
 
 
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list



___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] gimbal lock solution?

2013-02-09 Thread Fero Kiraly
Roman, thank you, that is exactly what I mean.

Google said to me that it has something with:

kalman or complementary filter,
gimbal lock,
quaternions
arithmetic with matrixes ( there I can use iemmatrix library)


my input data are:
accX, accY, accZ, pitch yaw, roll (from HTC desire)

how to get this together ?



fk.
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] gimbal lock solution?

2013-02-09 Thread Cyrille Henry



Le 09/02/2013 15:49, Fero Kiraly a écrit :

Roman, thank you, that is exactly what I mean.

Google said to me that it has something with:

kalman or complementary filter,
gimbal lock,
quaternions
arithmetic with matrixes ( there I can use iemmatrix library)

translate/rotate/scale/shear are matrix operation!




my input data are:
accX, accY, accZ, pitch yaw, roll (from HTC desire)

how to get this together ?

use pitch, yaw, roll in 3 rotateXYZ and connect the 3 rotate object in the 
correct order.
(not X, Y, Z, since it did not work)


cheers
c





fk.


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list



___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] gimbal lock solution?

2013-02-09 Thread Cyrille Henry



Le 09/02/2013 15:39, Roman Haefeli a écrit :

I believe it is (unfortunately) not as simple as that. When you rotate
with [rotateXYZ], the three axis are not always perpendicular to each
other. For instance, if you set Y to 90, the X and the Z rotate around
the same axis.



every rotation keep the 3 axes perpendicular.
but rotateXYZ do 3 rotations, X, Y and Z, in this order.

if you rotate 90° in Y, Z axe became what use to be the X axe.
so rotation in Z after a 90° rotation in Y is the same than a rotation in X 
before the Y rotation.
that's the gimbal lock.

but after the Y rotation, a X rotation is not the same than a Z rotation.

if you don't believe me, you can try :
gemhead
rotate X 0 Z
rotate 0 90 0
cube

X and Z are still (and will always be) perpendicular.





However, the gyroscope (at least the one from Wiimote MotionPlus and
most likely also the one from your phone) consists of three separate
sensor which are perpendicular to each other at any time.

If I understand Fero correctly, he would like to use the sensors so he
can control an object in Gem that follows exactly the orientation of his
phone. I also tried that once with a Wiimote and Gem but I couldn't wrap
my head around the two concepts of [rotateXYZ] and the gyro sensors.

gyro sensors give rotation speed. not absolute rotation.
in theory (with infinite acurate sensors, no drift etc), you have to do a 
feedback loop (using gemlist_info), so that the current rotation is modify by 
the sensors value.
(rotation did not sums up)

cheers
c




Anyone enlightened might be able to shed some light on this confusion?

Roman




On Sam, 2013-02-09 at 15:18 +0100, Cyrille Henry wrote:

hello,

rotateXYZ is doing : rotation X then  rotation Y then rotation Z

this is not the same than :
rotation Z
rotation Y
rotation X

So, depending on how works your orientation sensors, you could have to change 
the rotation order.

you can try, using 3 rotateXYZ object.

cheers
c



Le 09/02/2013 14:45, Fero Kiraly a écrit :

I have 3 axis accelerometer and 3 axis orientation sensor in my device.
So i can get 0 - 360 deg on X, Y and Z.


When I draw in GEM a rectangle, I am able to rotate it with each of 3 axes, but 
only separately. When I try it  with all three axes together
it has strange movements, so I guess it has something with gimbal lock.




___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list



___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list




___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list





___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] gimbal lock solution?

2013-02-09 Thread Roman Haefeli
On Sam, 2013-02-09 at 16:41 +0100, Cyrille Henry wrote:
 
 Le 09/02/2013 15:39, Roman Haefeli a écrit :
  I believe it is (unfortunately) not as simple as that. When you rotate
  with [rotateXYZ], the three axis are not always perpendicular to each
  other. For instance, if you set Y to 90, the X and the Z rotate around
  the same axis.
 
 
 every rotation keep the 3 axes perpendicular.
 but rotateXYZ do 3 rotations, X, Y and Z, in this order.
 
 if you rotate 90° in Y, Z axe became what use to be the X axe.
 so rotation in Z after a 90° rotation in Y is the same than a rotation in X 
 before the Y rotation.
 that's the gimbal lock.
 
 but after the Y rotation, a X rotation is not the same than a Z rotation.
 
 if you don't believe me, you can try :
 gemhead
 rotate X 0 Z
 rotate 0 90 0
 cube
 
 X and Z are still (and will always be) perpendicular.

Ok, this makes sense to me now. Thanks.


  However, the gyroscope (at least the one from Wiimote MotionPlus and
  most likely also the one from your phone) consists of three separate
  sensor which are perpendicular to each other at any time.
 
  If I understand Fero correctly, he would like to use the sensors so he
  can control an object in Gem that follows exactly the orientation of his
  phone. I also tried that once with a Wiimote and Gem but I couldn't wrap
  my head around the two concepts of [rotateXYZ] and the gyro sensors.
 gyro sensors give rotation speed. not absolute rotation.

Yeah, right. But you can add the values up to get rotation (of course,
it's always rotation relative to itself, which will obviously drift from
reality over time).

 in theory (with infinite acurate sensors, no drift etc), you have to
 do a feedback loop (using gemlist_info), so that the current rotation
 is modify by the sensors value.
 (rotation did not sums up)

...parsing solution  beep.. stack overflow (in my head)!

You mean you add each increment (gyro measurement) to the rotation
separately, then get the orientation with gem_list info, add the next
increment to the orientation, get orientation again, add increment etc?
Can you cast that into a little Gem example patch, if it is not too much
trouble?

Roman



___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list