mirror of
https://github.com/YikeStone/ros_arduino_bridge.git
synced 2025-08-05 20:14:07 +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.gx = event.gyro.x;
|
||||||
data.gy = event.gyro.y;
|
data.gy = event.gyro.y;
|
||||||
data.gz = event.gyro.z;
|
data.gz = event.gyro.z;
|
||||||
|
/*
|
||||||
if (dof.accelGetOrientation(&accel_event, &orientation))
|
if (dof.accelGetOrientation(&accel_event, &orientation))
|
||||||
{
|
{
|
||||||
/* 'orientation' should have valid .roll and .pitch fields */
|
|
||||||
data.roll = orientation.roll;
|
data.roll = orientation.roll;
|
||||||
data.pitch = orientation.pitch;
|
data.pitch = orientation.pitch;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/* Calculate the heading using the magnetometer */
|
/* Calculate the heading using the magnetometer */
|
||||||
mag.getEvent(&mag_event);
|
mag.getEvent(&mag_event);
|
||||||
|
|
||||||
|
/*
|
||||||
if (dof.magGetOrientation(SENSOR_AXIS_Z, &mag_event, &orientation))
|
if (dof.magGetOrientation(SENSOR_AXIS_Z, &mag_event, &orientation))
|
||||||
{
|
{
|
||||||
/* 'orientation' should have valid .heading data now */
|
|
||||||
data.mz = orientation.heading;
|
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;
|
return data;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user