#### Bosch Sensortec Community

cancel
Showing results for
Did you mean:
SOLVED

## Scaled Quaternion Data Exceeding "1"

Member

Hello everyone,

Recently, I have been working on a project using 9DoF IMU (BHI260AP & BMM150). When I read through the data I got from 9 DoF quaternion, at the edges ( -180 to 180 edges) (If edges are not clear, you might follow the given data below) of axees (roll,pitch,yaw), I see that the data is changing its sign 2 times (negative to positive to negative). And when I look at its scaled (by 2^14) quaternion at positive area, one of three quaternion value (qx,qy or qz) exceeds 1. Also, the raw quaternion data is jumping from around 16639 to around -16127. I am putting a sample data that explains the situation clearly.

First paranthesis is raw quaternion data,
Second paranthesis is normalized quaternion data and
Third paranthesis is the euler angles (roll,pitch,yaw) that converted from quaternions.

I rotated the IMU in only yaw axis (keeping roll and pitch constant) in negative (clockwise) direction.

[-403, 178, 168, 16626] [-0.024229402084358042, 0.010701820275473279, 0.010100594417300622, 0.9995981117978581] [1.1276, -1.254, -177.2353]
[-396, 178, 170, 16626] [-0.023808755568279, 0.010701915381701168, 0.010220930420725834, 0.9996069951469866] [1.1419, -1.2539, -177.2837]
[-382, 178, 170, 16627] [-0.022966103726689856, 0.010701482888352864, 0.010220517365280825, 0.9996267190148487] [1.1429, -1.2528, -177.3803]
[-381, 178, 170, 16627] [-0.02290601462213584, 0.010701497644987349, 0.010220531458695782, 0.9996280974337339] [1.143, -1.2528, -177.3871]
[-368, 177, 171, 16627] [-0.02212483446842298, 0.010641564404649096, 0.01028083340788133, 0.9996457138762742] [1.151, -1.2452, -177.4767]
[-326, 177, 171, 16629] [-0.019598394083480457, 0.010640845867411167, 0.010280139227837907, 0.9996984515772899] [1.1541, -1.2422, -177.7663]
[-303, 178, 170, 16630] [-0.018215066291414065, 0.01070059999957658, 0.01021967415689898, 0.9997245954660591] [1.1488, -1.2473, -177.9249]
[-303, 178, 170, 16630] [-0.018215066291414065, 0.01070059999957658, 0.01021967415689898, 0.9997245954660591] [1.1488, -1.2473, -177.9249]
[-251, 177, 169, 16631] [-0.015088945825303714, 0.01064041199632971, 0.010159489420224413, 0.9997779204009007] [1.1459, -1.2367, -178.283]
[-231, 177, 172, 16632] [-0.013886021005728192, 0.010639938173220304, 0.010339374947988091, 0.9997935124124299] [1.168, -1.2355, -178.4211]
[-193, 178, 172, 16633] [-0.011601373515346996, 0.010699712361304483, 0.010339047899687478, 0.9998219983459409] [1.1707, -1.2397, -178.6831]
[-193, 178, 172, 16633] [-0.011601373515346996, 0.010699712361304483, 0.010339047899687478, 0.9998219983459409] [1.1707, -1.2397, -178.6831]
[-149, 178, 170, 16634] [-0.008956217071755106, 0.010699373414579926, 0.010218502699317907, 0.9998504347085533] [1.1601, -1.2365, -178.9861]
[-149, 178, 170, 16634] [-0.008956217071755106, 0.010699373414579926, 0.010218502699317907, 0.9998504347085533] [1.1601, -1.2365, -178.9861]
[-119, 178, 169, 16635] [-0.0071526302809625285, 0.010698892353036386, 0.010157937121703086, 0.9998655859143837] [1.1554, -1.2343, -179.1927]
[-119, 178, 169, 16635] [-0.0071526302809625285, 0.010698892353036386, 0.010157937121703086, 0.9998655859143837] [1.1554, -1.2343, -179.1927]
[-113, 177, 169, 16635] [-0.006792014893907287, 0.01063881978957159, 0.010157969177613552, 0.9998687412402453] [1.1559, -1.227, -179.234]
[-113, 178, 169, 16635] [-0.006792010538418085, 0.010698919255207249, 0.010157962663651826, 0.9998681000582729] [1.1559, -1.2338, -179.234]
[-86, 178, 170, 16636] [-0.005168877122414587, 0.010698373578951122, 0.010217547800121858, 0.9998772070754542] [1.1647, -1.2319, -179.4201]
[-86, 178, 170, 16636] [-0.005168877122414587, 0.010698373578951122, 0.010217547800121858, 0.9998772070754542] [1.1647, -1.2319, -179.4201]
[-71, 178, 170, 16636] [-0.004267346938726148, 0.010698419085820483, 0.010217591261738664, 0.9998814601781436] [1.1658, -1.2309, -179.5235]
[-59, 177, 171, 16636] [-0.0035461152841557374, 0.010638345852467212, 0.01027772395916324, 0.99988430283415] [1.1736, -1.2232, -179.6061]
[-44, 178, 170, 16636] [-0.002644567864007208, 0.010698479086210976, 0.010217648565482393, 0.9998870678550887] [1.1678, -1.229, -179.7094]
[-44, 178, 170, 16636] [-0.002644567864007208, 0.010698479086210976, 0.010217648565482393, 0.9998870678550887] [1.1678, -1.229, -179.7094]
[-24, 177, 170, 16637] [-0.0014424093455491808, 0.010637768923425208, 0.010217066197640031, 0.9998901784125718] [1.1692, -1.2206, -179.8471]
[-15, 177, 170, 16637] [-0.0009015064124477308, 0.010637775666883223, 0.010217072674407615, 0.9998908122595264] [1.1699, -1.22, -179.9091]
[-1, 177, 172, 16637] [-6.0100377566697915e-05, 0.01063776682930553, 0.010337264941472041, 0.9998899815771531] [1.1847, -1.219, 179.9943]
[10, 177, 171, 16637] [0.0006010040405119429, 0.01063777151706139, 0.010277169092754222, 0.9998904221997194] [1.1786, -1.2182, 179.9186]
[14, 177, 171, 16637] [0.0008414055108348455, 0.01063776967269769, 0.010277167310911326, 0.9998902488399517] [1.1789, -1.218, 179.891]
[14, 177, 171, 16637] [0.0008414055108348455, 0.01063776967269769, 0.010277167310911326, 0.9998902488399517] [1.1789, -1.218, 179.891]
[13, 177, 170, 16637] [0.0007813056364741736, 0.010637776742763748, 0.010217073707739194, 0.9998909133862174] [1.172, -1.218, 179.898]
[17, 177, 170, 16637] [0.001021707149345762, 0.010637774437305875, 0.01021707149345762, 0.9998906966862026] [1.1723, -1.2178, 179.8704]
[42, 176, 171, 16638] [0.002524059313927033, 0.010577010458360903, 0.010276527206702921, 0.9998880682170947] [1.1809, -1.209, 179.6983]
[42, 176, 171, 16638] [0.002524059313927033, 0.010577010458360903, 0.010276527206702921, 0.9998880682170947] [1.1809, -1.209, 179.6983]
[58, 176, 171, 16638] [0.0034855956483647414, 0.010576979898486112, 0.010276497515006392, 0.9998851792671133] [1.182, -1.2079, 179.5881]
[62, 176, 170, 16638] [0.0037259806199078905, 0.010576977243609495, 0.01021639847394099, 0.9998849282907658] [1.1754, -1.2076, 179.5606]
[74, 176, 170, 16638] [0.004447125053350477, 0.010576946072833568, 0.01021636836580515, 0.9998819815898006] [1.1763, -1.2068, 179.478]
[79, 177, 170, 16638] [0.004747596891131635, 0.010637020882662019, 0.010216347740409849, 0.9998799629702297] [1.1767, -1.2133, 179.4434]
[92, 177, 170, 16638] [0.005528824818491124, 0.0106369781834014, 0.010216306729820554, 0.9998759492397317] [1.1776, -1.2124, 179.3539]
[100, 176, 171, 16638] [0.006009575655814173, 0.010576853154232943, 0.010276374371442234, 0.999873197614362] [1.1851, -1.2049, 179.2988]
[122, 176, 170, 16639] [0.007331181645397378, 0.010576130898278184, 0.010215580981291428, 0.9998650114571063] [1.1797, -1.2033, 179.1474]
[122, 176, 170, 16639] [0.007331181645397378, 0.010576130898278184, 0.010215580981291428, 0.9998650114571063] [1.1797, -1.2033, 179.1474]
[139, 176, 170, 16639] [0.008352672830378369, 0.010576046173716495, 0.010215499145067069, 0.9998570016162998] [1.1809, -1.2021, 179.0304]
[148, 176, 169, 16639] [0.008893457341719598, 0.01057600332528817, 0.010155366829396028, 0.9998529507356243] [1.1747, -1.2015, 178.9684]
[158, 175, 169, 16639] [0.009494320185047983, 0.010515860964451878, 0.010155317159956385, 0.9998480605000846] [1.1753, -1.1939, 178.8997]
[158, 175, 169, 16639] [0.009494320185047983, 0.010515860964451878, 0.010155317159956385, 0.9998480605000846] [1.1753, -1.1939, 178.8997]
[191, 175, 168, 16639] [0.011477079449061404, 0.010515648709873014, 0.010095022761478093, 0.9998278793347262] [1.1708, -1.1916, 178.6725]
[196, 175, 168, 16639] [0.011777485411785325, 0.010515611974808325, 0.010094987495815992, 0.9998243865647756] [1.1711, -1.1913, 178.638]
[213, 175, 169, 16639] [0.012798833558643568, 0.010515473581045185, 0.010154943058266492, 0.9998112280857762] [1.1792, -1.1899, 178.5209]
[213, 175, 169, 16639] [0.012798833558643568, 0.010515473581045185, 0.010154943058266492, 0.9998112280857762] [1.1792, -1.1899, 178.5209]
[240, 176, 169, 16639] [0.014420893352934151, 0.010575321792151711, 0.010154712402691132, 0.9997885187477973] [1.1812, -1.1949, 178.3349]
[250, 176, 169, 16639] [0.015021631034360449, 0.010575228248189756, 0.010154622579227664, 0.999779675122894] [1.1819, -1.1942, 178.2661]

// in this interval, scaled qz is 16639 / 2**14 = 1.01556 AND -16127/2**14 = -0.984314  which makes me confused. Why is qz >= 1 ? It is also obvious that other elements of quaternion is jumping. (even though not as much as qz does)
[251, 336, 342, -16127] [0.015555205620167661, 0.02082290473456707, 0.02119474231911291, -0.9994374543284616] [-2.3931, 2.4233, -178.2673]
[252, 336, 344, -16127] [0.015617122319955197, 0.02082282975994026, 0.02131861142089122, -0.9994338557695137] [-2.4071, 2.4236, -178.2605]
[240, 336, 344, -16127] [0.014873618459132144, 0.020823065842785003, 0.021318853124756072, -0.9994451870434337] [-2.409, 2.4219, -178.3457]
[240, 336, 344, -16127] [0.014873618459132144, 0.020823065842785003, 0.021318853124756072, -0.9994451870434337] [-2.409, 2.4219, -178.3457]
[232, 336, 344, -16127] [0.014377935435519743, 0.020823216837649285, 0.02131900771473617, -0.9994524343475297] [-2.4102, 2.4207, -178.4026]
[232, 336, 344, -16127] [0.014377935435519743, 0.020823216837649285, 0.02131900771473617, -0.9994524343475297] [-2.4102, 2.4207, -178.4026]
[232, 336, 344, -16127] [0.014377935435519743, 0.020823216837649285, 0.02131900771473617, -0.9994524343475297] [-2.4102, 2.4207, -178.4026]
[233, 336, 344, -16127] [0.014439896400672749, 0.02082319824303023, 0.02131898867738809, -0.9994515418611563] [-2.41, 2.4209, -178.3954]
[233, 336, 345, -16127] [0.014439877294717577, 0.020823170691094874, 0.021380934191749204, -0.9994502194502591] [-2.4171, 2.4209, -178.3956]
[233, 337, 347, -16127] [0.014439820254603037, 0.020885061913309973, 0.021504796688185637, -0.9994462714419878] [-2.4313, 2.4282, -178.3961]
[230, 336, 348, -16127] [0.014253937240579138, 0.02082314309928083, 0.021566826781398, -0.9994488951253033] [-2.4389, 2.4208, -178.4174]
[223, 337, 345, -16127] [0.013820243233118115, 0.020885300311931858, 0.021381093791146857, -0.9994576799125373] [-2.4186, 2.4266, -178.4668]
[210, 337, 344, -16127] [0.013014736739270774, 0.02088555371968691, 0.0213193782776626, -0.9994698066391418] [-2.4135, 2.4246, -178.559]
[205, 337, 343, -16127] [0.012704929445594794, 0.020885664503246075, 0.02125751609677568, -0.9994751081419866] [-2.4071, 2.4237, -178.5944]
[201, 336, 342, -16127] [0.012457099723162265, 0.020823808492450354, 0.021195662215529827, -0.9994808320171038] [-2.4007, 2.416, -178.6225]
[195, 336, 342, -16127] [0.012085301146420464, 0.020823903513832183, 0.021195758933722046, -0.9994853927606299] [-2.4016, 2.4151, -178.6651]
[178, 335, 340, -16127] [0.011031888252220838, 0.020762261598280794, 0.02107214609974767, -0.9995014710312666] [-2.39, 2.4053, -178.7854]
[164, 335, 339, -16127] [0.010164318371432193, 0.020762479600181613, 0.021010389804362886, -0.9995119657078473] [-2.385, 2.4032, -178.8848]
[153, 335, 339, -16127] [0.009482628816843449, 0.02076261865125853, 0.02101053051575117, -0.999518659668198] [-2.3867, 2.4016, -178.9629]
[147, 334, 339, -16127] [0.0091108042240569, 0.02070073884921772, 0.021010630149355707, -0.9995233994650723] [-2.3877, 2.3936, -179.0054]
[137, 335, 339, -16127] [0.008491057029323196, 0.020762803684841392, 0.021010717758690244, -0.9995275672401108] [-2.3891, 2.3993, -179.0766]
[137, 335, 339, -16127] [0.008491057029323196, 0.020762803684841392, 0.021010717758690244, -0.9995275672401108] [-2.3891, 2.3993, -179.0766]
[125, 336, 340, -16127] [0.007747341502675057, 0.020824853959190554, 0.021072768887276157, -0.9995310113091253] [-2.398, 2.4046, -179.1622]
[125, 336, 340, -16127] [0.007747341502675057, 0.020824853959190554, 0.021072768887276157, -0.9995310113091253] [-2.398, 2.4046, -179.1622]
[112, 336, 340, -16126] [0.006942089129790686, 0.020826267389372058, 0.02107419914400744, -0.9995368688125411] [-2.4001, 2.4029, -179.2545]
[112, 336, 340, -16126] [0.006942089129790686, 0.020826267389372058, 0.02107419914400744, -0.9995368688125411] [-2.4001, 2.4029, -179.2545]
[97, 336, 339, -16126] [0.006012389099682352, 0.020826419974157427, 0.021012370152498117, -0.999544191973996] [-2.3952, 2.4006, -179.3609]
[97, 336, 339, -16126] [0.006012389099682352, 0.020826419974157427, 0.021012370152498117, -0.999544191973996] [-2.3952, 2.4006, -179.3609]
[85, 336, 342, -16126] [0.0052685898133533636, 0.020826425615138002, 0.02119832607255118, -0.9995444627074864] [-2.4183, 2.3989, -179.4466]
[80, 336, 342, -16126] [0.00495868062403983, 0.020826458620967287, 0.021198359667770277, -0.9995460467908288] [-2.4191, 2.3982, -179.4822]
[19, 335, 342, -16125] [0.001177774799953916, 0.02076602936760852, 0.021199946399170486, -0.9995588762766787] [-2.4283, 2.3821, -179.9155]
[19, 335, 342, -16125] [0.001177774799953916, 0.02076602936760852, 0.021199946399170486, -0.9995588762766787] [-2.4283, 2.3821, -179.9155]
[2, 335, 341, -16125] [0.00012397654245172883, 0.02076607086066458, 0.021138000488019764, -0.9995608735170636] [-2.4237, 2.3796, 179.9639]
[15, 336, 342, -16125] [0.0009298212547486492, 0.02082799610636974, 0.0211999246082692, -0.9995578488547979] [-2.4289, 2.3886, -179.944]
[2, 336, 341, -16125] [0.00012397638262468964, 0.02082803228094786, 0.021137973237509582, -0.9995595849115603] [-2.4237, 2.3867, 179.9637]
[2, 336, 341, -16125] [0.00012397638262468964, 0.02082803228094786, 0.021137973237509582, -0.9995595849115603] [-2.4237, 2.3867, 179.9637]
[-10, 336, 340, -16125] [-0.0006198826098357786, 0.020828055690482163, 0.021076008734416476, -0.9995607083601932] [-2.4184, 2.3849, 179.8786]
[-15, 337, 342, -16125] [-0.0009298200524838918, 0.020889957179138104, 0.021199897196632737, -0.9995565564201838] [-2.4333, 2.3912, 179.8426]
[-27, 337, 341, -16125] [-0.0016736766700566716, 0.020889964363299936, 0.02113791646256759, -0.9995569001727344] [-2.428, 2.3894, 179.7575]
[-37, 337, 340, -16124] [-0.002293699217794644, 0.020891260443156624, 0.021077236055410245, -0.9995569239924552] [-2.4225, 2.3881, 179.6865]
[-50, 337, 341, -16124] [-0.003099582745604452, 0.020891187705374004, 0.02113915432502236, -0.9995534438025236] [-2.4315, 2.3861, 179.594]
[-50, 337, 341, -16124] [-0.003099582745604452, 0.020891187705374004, 0.02113915432502236, -0.9995534438025236] [-2.4315, 2.3861, 179.594]
[-62, 337, 343, -16124] [-0.003843462576084085, 0.020891078840973173, 0.021263026832207117, -0.9995482351093514] [-2.4475, 2.3842, 179.5084]
[-62, 337, 343, -16124] [-0.003843462576084085, 0.020891078840973173, 0.021263026832207117, -0.9995482351093514] [-2.4475, 2.3842, 179.5084]
[-67, 338, 345, -16124] [-0.0041533977198080435, 0.02095296163127043, 0.021386898706474256, -0.9995430572266403] [-2.4625, 2.3904, 179.4725]
[-77, 338, 344, -16124] [-0.004773300939357218, 0.02095293139613948, 0.0213248769238816, -0.9995416148856596] [-2.4569, 2.389, 179.4015]
[-89, 339, 345, -16123] [-0.005517498270832952, 0.02101608891924012, 0.02138805509480189, -0.9995351080970751] [-2.466, 2.3943, 179.3159]
[-103, 339, 347, -16123] [-0.006385369382073988, 0.02101592447109788, 0.021511875491064793, -0.9995272868658146] [-2.4822, 2.3921, 179.2161]
[-112, 338, 346, -16123] [-0.006943306741084834, 0.020953907843631017, 0.021449858325137076, -0.9995262016652747] [-2.4764, 2.3836, 179.1525]
[-120, 338, 345, -16123] [-0.007439240568508645, 0.02095386093463268, 0.021387816634462355, -0.9995239640505407] [-2.4705, 2.3824, 179.0958]
[-154, 339, 345, -16122] [-0.009547433649552788, 0.021016753293496074, 0.021388731227894232, -0.9995047097278574] [-2.4757, 2.3844, 178.8539]
[-167, 339, 345, -16122] [-0.010353302812205183, 0.021016584750524293, 0.021388559701861005, -0.9994966942417483] [-2.4776, 2.3824, 178.7615]
[-180, 338, 343, -16121] [-0.011159887339854298, 0.020955788449281962, 0.021265785319833468, -0.999491910032173] [-2.4653, 2.3736, 178.6695]
[-187, 338, 343, -16121] [-0.011593825714040986, 0.02095568498045911, 0.02126568032040673, -0.9994869750591163] [-2.4663, 2.3725, 178.6197]
[-209, 338, 342, -16120] [-0.012958408281066624, 0.020956660282299134, 0.02120466809629084, -0.9994714903865741] [-2.4626, 2.3694, 178.4634]
[-221, 337, 341, -16120] [-0.013702331588077042, 0.020894505634307527, 0.02114251163590168, -0.9994641864244431] [-2.4571, 2.3605, 178.3785]
[-237, 338, 342, -16120] [-0.01469411027392191, 0.020956157268293692, 0.02120415912945693, -0.9994475004878531] [-2.4666, 2.365, 178.2644]
[-237, 338, 342, -16120] [-0.01469411027392191, 0.020956157268293692, 0.02120415912945693, -0.9994475004878531] [-2.4666, 2.365, 178.2644]
[-276, 337, 343, -16118] [-0.01711359086442722, 0.020895942468521642, 0.02126797705253093, -0.999408904176949] [-2.4795, 2.352, 177.9871]
[-278, 337, 342, -16118] [-0.01723758837556737, 0.02089592547685685, 0.021205954044762734, -0.9994080915014204] [-2.4727, 2.3519, 177.973]

I can't handle the error that I'm having. I am using my own methods and algorithms (nothing unusual or unexpected) to obtain 9DoF quaternions. Except this situation, everything is OK.