getYawPitchRoll()
描述
以偏擺(Yaw)、俯仰(Pitch)、翻滾(Roll)角度回傳目前感測到的慣性姿態,其中偏擺角是以地球北方為軸心,俯仰角和翻滾角是以地平面為軸心。
語法
FreeIMU1.getYawPitchRoll(ypr)
參數
FreeIMU1
:FreeIMU1
型別的變數
ypr
:ypr
是一個指向浮點數陣列或雙精度浮點數陣列的指標,該陣列應該至少有可以存放三個浮點數或雙精度浮點數元素的空間。在 getYawPitchRoll()
執行完後,該陣列將會依序存放表示目前慣性姿態的偏擺(Yaw)、俯仰(Pitch)、翻滾(Roll)角
回傳
無
範例
#include <FreeIMU1.h> #include <Wire.h> FreeIMU1 myIMU; void setup() { Serial.begin(115200); Wire.begin(); delay(500); myIMU.init(); delay(500); } void loop() { double ypr[3]; char str[512]; myIMU.getYawPitchRoll(ypr); sprintf(str, "%f\t%f\t%f\t", ypr[0], ypr[1], ypr[2]); Serial.print(str); Serial.print('\n'); delay(20); }
See also
The text of the 86Duino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.