Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of IMU_code_7_14 by
Diff: IMU_code.cpp
- Revision:
- 2:b00adea2187b
- Parent:
- 1:0672f84101e4
- Child:
- 3:232de5807dac
--- a/IMU_code.cpp Fri Jun 30 18:32:10 2017 +0000
+++ b/IMU_code.cpp Mon Jul 17 14:23:51 2017 +0000
@@ -130,7 +130,8 @@
//PC.printf("\nT: %f SA:(%d) Roll: %9.6f Pitch: %9.6f Yaw:%9.6f\n\n",timestamp,sa_pos,stab_accel[0],stab_accel[1],stab_accel[2]);
//PC.printf("\nT: %f SA:(%d) Roll: %9.6f Pitch: %9.6f Yaw:%9.6f\n",timestamp,sa_pos,stab_accel[0],stab_accel[1],stab_accel[2]);
char char_buffer [60];
- sprintf(char_buffer,"T: %f SA:(%d) Roll: %9.6f Pitch: %9.6f Yaw: %9.6f",timestamp,sa_pos,stab_accel[0],stab_accel[1],stab_accel[2]);
+ //sprintf(char_buffer,"T: %f SA:(%d) Roll: %9.6f Pitch: %9.6f Yaw: %9.6f",timestamp,sa_pos,stab_accel[0],stab_accel[1],stab_accel[2]);
+ sprintf(char_buffer,">imu Time: %6.3f SA:(%d) Roll: %6.3f Pitch: %6.3f Yaw: %6.3f imu<",timestamp,sa_pos,stab_accel[0],stab_accel[1],stab_accel[2]);
//PC.printf("cb: %s\n\n", char_buffer); //TROY: My way to double-check this
//Sanity check
//PC.printf("\nCheck1: %02x == %02x check2 %02x == %02x PL: %d T: %f DT: %f %f %f DV: %f %f %f SA: %f %f %f\n\n",data[packetlength-2],cb1, data[packetlength-1],cb2,packetlength,timestamp,delta_theta[0],delta_theta[1],delta_theta[2],
@@ -149,12 +150,14 @@
}
}
}
+ //else if (IMU.readable() == 0) //doesn't work for some reason
+ //return "no imu";
}
}
float IMU_code::IMU_pitch()
{
- return stab_accel[1];
+ return stab_accel[2]; //using the yaw axis
}
double double_from_le_bytes(unsigned char * p_to_double)
