mirror of
https://github.com/YikeStone/ros_arduino_bridge.git
synced 2025-08-03 19:24:09 +05:30
Added fusionGetOrientation function to Adafruit 9-dof imu in imu.ino
This commit is contained in:
parent
9bcf7fff88
commit
b8931b271d
@ -43,21 +43,30 @@
|
||||
data.gx = event.gyro.x;
|
||||
data.gy = event.gyro.y;
|
||||
data.gz = event.gyro.z;
|
||||
|
||||
/*
|
||||
if (dof.accelGetOrientation(&accel_event, &orientation))
|
||||
{
|
||||
/* 'orientation' should have valid .roll and .pitch fields */
|
||||
data.roll = orientation.roll;
|
||||
data.pitch = orientation.pitch;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/* Calculate the heading using the magnetometer */
|
||||
mag.getEvent(&mag_event);
|
||||
|
||||
/*
|
||||
if (dof.magGetOrientation(SENSOR_AXIS_Z, &mag_event, &orientation))
|
||||
{
|
||||
/* 'orientation' should have valid .heading data now */
|
||||
data.mz = orientation.heading;
|
||||
}
|
||||
*/
|
||||
|
||||
if (dof.fusionGetOrientation(&accel_event, &mag_event, &orientation))
|
||||
{
|
||||
data.roll = orientation.roll;
|
||||
data.pitch = orientation.pitch;
|
||||
data.ch = orientation.heading;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user