[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3916)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3916)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4792: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3916)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4793: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3916)
AutoQuad Forum • View topic - The issuses of conversion Quaternion to Euler

The issuses of conversion Quaternion to Euler

News, Setup, Compiling, Flashing, Development

The issuses of conversion Quaternion to Euler

Postby chestnut » Tue Jun 17, 2014 10:14 am

Hi all,

For conversion Quad to euler :
*yaw = atan2f((2.0f * (q0 * q1 + q3 * q2)), (q3*q3 - q2*q2 - q1*q1 + q0*q0));
*pitch = asinf(-2.0f * (q0 * q2 - q1 * q3));
*roll = atanf((2.0f * (q1 * q2 + q0 * q3)) / (q3*q3 + q2*q2 - q1*q1 -q0*q0));

have some issuses
asin returns the angle between -π/2 and π/2 radians (equivalent to -90 and 90 degrees)
atan returns the angle between -π/2 and π/2 radians (equivalent to -90 and 90 degrees)
atan2 returns the angle between -π and π radians (equivalent to -180 and 180 degrees)

If pitch or roll > 90 or <-90, it's will wrong value. Can we fix this issuse?
chestnut
 
Posts: 71
Joined: Wed Oct 23, 2013 3:45 am
Location: VietNam

Re: The issuses of conversion Quaternion to Euler

Postby srinath » Tue Jun 17, 2014 10:19 am

Take a look at
navUkfQuatExtractEuler

The sequence of rotations is important. YPR or RPY or something else.
I think its YPR on AQ.

Also important is whether the quat corresponds to world to Body or Body to world frame.
I don't remember the convention in nav_ukf

Bill can confirm
srinath
 
Posts: 1028
Joined: Mon Jun 25, 2012 5:47 pm

Re: The issuses of conversion Quaternion to Euler

Postby bn999 » Tue Jun 17, 2014 1:57 pm

Can you come up with an example quaternion which fails this conversion to demonstrate the problem?
bn999
 
Posts: 1559
Joined: Thu Jun 21, 2012 11:40 pm

Re: The issuses of conversion Quaternion to Euler

Postby chestnut » Tue Jun 17, 2014 3:08 pm

chestnut
 
Posts: 71
Joined: Wed Oct 23, 2013 3:45 am
Location: VietNam

Re: The issuses of conversion Quaternion to Euler

Postby bn999 » Tue Jun 17, 2014 3:22 pm

Sorry, I meant an example 4 digit quaternion which when passed through this function results in an invalid pitch, roll or yaw. I don't think there is one.
bn999
 
Posts: 1559
Joined: Thu Jun 21, 2012 11:40 pm

Re: The issuses of conversion Quaternion to Euler

Postby srinath » Tue Jun 17, 2014 3:57 pm

The function should specify rotation sequence(ypr/rpy etc) at least in a comment. Otherwise its confusing IMO
srinath
 
Posts: 1028
Joined: Mon Jun 25, 2012 5:47 pm

Re: The issuses of conversion Quaternion to Euler

Postby chestnut » Tue Jun 17, 2014 4:13 pm

Hi Bill

For *pitch = asinf(-2.0f * (q0 * q2 - q1 * q3));

Example:

sinf(PI/4) = sinf(PI/4 + PI/2) = x
-> asinf(x) = PI/4 or 3PI/4
Last edited by chestnut on Tue Jun 17, 2014 4:18 pm, edited 1 time in total.
chestnut
 
Posts: 71
Joined: Wed Oct 23, 2013 3:45 am
Location: VietNam

Re: The issuses of conversion Quaternion to Euler

Postby srinath » Tue Jun 17, 2014 4:16 pm

srinath
 
Posts: 1028
Joined: Mon Jun 25, 2012 5:47 pm

Re: The issuses of conversion Quaternion to Euler

Postby chestnut » Tue Jun 17, 2014 4:20 pm

chestnut
 
Posts: 71
Joined: Wed Oct 23, 2013 3:45 am
Location: VietNam

Re: The issuses of conversion Quaternion to Euler

Postby srinath » Tue Jun 17, 2014 4:25 pm

Yep. So we should definitely use only Quats for control.
Anything that passes through the singularity at pi/2 is doomed to fail

Btw, where does this formula come from i believe it should be slightly different.
Look at page 45, eqn 3.63
Attachments
13587_03.pdf
(1.53 MiB) Downloaded 10685 times
srinath
 
Posts: 1028
Joined: Mon Jun 25, 2012 5:47 pm

Next

Return to AQ Firmware

Who is online

Users browsing this forum: No registered users and 39 guests

cron