fork(2) download
  1. /*
  2.  
  3.  MinIMU-9-Arduino-AHRS
  4.  Pololu MinIMU-9 + Arduino AHRS (Attitude and Heading Reference System)
  5.  
  6.  Copyright (c) 2011 Pololu Corporation.
  7.  http://w...content-available-to-author-only...u.com/
  8.  
  9.  MinIMU-9-Arduino-AHRS is based on sf9domahrs by Doug Weibel and Jose Julio:
  10.  http://code.google.com/p/sf9domahrs/
  11.  
  12.  sf9domahrs is based on ArduIMU v1.5 by Jordi Munoz and William Premerlani, Jose
  13.  Julio and Doug Weibel:
  14.  http://code.google.com/p/ardu-imu/
  15.  
  16.  MinIMU-9-Arduino-AHRS is free software: you can redistribute it and/or modify it
  17.  under the terms of the GNU Lesser General Public License as published by the
  18.  Free Software Foundation, either version 3 of the License, or (at your option)
  19.  any later version.
  20.  
  21.  MinIMU-9-Arduino-AHRS is distributed in the hope that it will be useful, but
  22.  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  23.  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
  24.  more details.
  25.  
  26.  You should have received a copy of the GNU Lesser General Public License along
  27.  with MinIMU-9-Arduino-AHRS. If not, see <http://w...content-available-to-author-only...u.org/licenses/>.
  28.  
  29.  */
  30. void Calibrate(){
  31.  
  32. while (digitalRead(CAL_FIN) == 0){
  33.  
  34. compass.read();
  35.  
  36. running_min.x = min(running_min.x, compass.m.x);
  37. running_min.y = min(running_min.y, compass.m.y);
  38. running_min.z = min(running_min.z, compass.m.z);
  39.  
  40. running_max.x = max(running_max.x, compass.m.x);
  41. running_max.y = max(running_max.y, compass.m.y);
  42. running_max.z = max(running_max.z, compass.m.z);
  43. Serial.print("M min ");
  44. Serial.print("X: ");
  45. Serial.print((int)running_min.x);
  46. Serial.print(" Y: ");
  47. Serial.print((int)running_min.y);
  48. Serial.print(" Z: ");
  49. Serial.print((int)running_min.z);
  50. Serial.print(" M max ");
  51. Serial.print("X: ");
  52. Serial.print((int)running_max.x);
  53. Serial.print(" Y: ");
  54. Serial.print((int)running_max.y);
  55. Serial.print(" Z: ");
  56. Serial.println((int)running_max.z);
  57.  
  58. M_X_MIN = running_min.x;
  59. M_Y_MIN = running_min.y;
  60. M_Z_MIN = running_min.z;
  61. M_X_MAX = running_max.x;
  62. M_Y_MAX = running_max.y;
  63. M_Z_MAX = running_max.z;
  64. delay(100);
  65. }
  66.  
  67. }
  68. void Compass_Heading()
  69. {
  70. float MAG_X;
  71. float MAG_Y;
  72. float cos_roll;
  73. float sin_roll;
  74. float cos_pitch;
  75. float sin_pitch;
  76.  
  77. cos_roll = cos(roll);
  78. sin_roll = sin(roll);
  79. cos_pitch = cos(pitch);
  80. sin_pitch = sin(pitch);
  81.  
  82. // adjust for LSM303 compass axis offsets/sensitivity differences by scaling to +/-0.5 range
  83. c_magnetom_x = (float)(magnetom_x - SENSOR_SIGN[6]*M_X_MIN) / (M_X_MAX - M_X_MIN) - SENSOR_SIGN[6]*0.5;
  84. c_magnetom_y = (float)(magnetom_y - SENSOR_SIGN[7]*M_Y_MIN) / (M_Y_MAX - M_Y_MIN) - SENSOR_SIGN[7]*0.5;
  85. c_magnetom_z = (float)(magnetom_z - SENSOR_SIGN[8]*M_Z_MIN) / (M_Z_MAX - M_Z_MIN) - SENSOR_SIGN[8]*0.5;
  86.  
  87. // Tilt compensated Magnetic filed X:
  88. MAG_X = c_magnetom_x*cos_pitch+c_magnetom_y*sin_roll*sin_pitch+c_magnetom_z*cos_roll*sin_pitch;
  89. // Tilt compensated Magnetic filed Y:
  90. MAG_Y = c_magnetom_y*cos_roll-c_magnetom_z*sin_roll;
  91. // Magnetic Heading
  92. MAG_Heading = atan2(-MAG_Y,MAG_X);
  93. }
  94.  
  95. void Normalize(void)
  96. {
  97. float error=0;
  98. float temporary[3][3];
  99. float renorm=0;
  100.  
  101. error= -Vector_Dot_Product(&DCM_Matrix[0][0],&DCM_Matrix[1][0])*.5; //eq.19
  102.  
  103. Vector_Scale(&temporary[0][0], &DCM_Matrix[1][0], error); //eq.19
  104. Vector_Scale(&temporary[1][0], &DCM_Matrix[0][0], error); //eq.19
  105.  
  106. Vector_Add(&temporary[0][0], &temporary[0][0], &DCM_Matrix[0][0]);//eq.19
  107. Vector_Add(&temporary[1][0], &temporary[1][0], &DCM_Matrix[1][0]);//eq.19
  108.  
  109. Vector_Cross_Product(&temporary[2][0],&temporary[0][0],&temporary[1][0]); // c= a x b //eq.20
  110.  
  111. renorm= .5 *(3 - Vector_Dot_Product(&temporary[0][0],&temporary[0][0])); //eq.21
  112. Vector_Scale(&DCM_Matrix[0][0], &temporary[0][0], renorm);
  113.  
  114. renorm= .5 *(3 - Vector_Dot_Product(&temporary[1][0],&temporary[1][0])); //eq.21
  115. Vector_Scale(&DCM_Matrix[1][0], &temporary[1][0], renorm);
  116.  
  117. renorm= .5 *(3 - Vector_Dot_Product(&temporary[2][0],&temporary[2][0])); //eq.21
  118. Vector_Scale(&DCM_Matrix[2][0], &temporary[2][0], renorm);
  119. }
  120.  
  121. /**************************************************/
  122. void Drift_correction(void)
  123. {
  124. float mag_heading_x;
  125. float mag_heading_y;
  126. float errorCourse;
  127. //Compensation the Roll, Pitch and Yaw drift.
  128. static float Scaled_Omega_P[3];
  129. static float Scaled_Omega_I[3];
  130. float Accel_magnitude;
  131. float Accel_weight;
  132.  
  133.  
  134. //*****Roll and Pitch***************
  135.  
  136. // Calculate the magnitude of the accelerometer vector
  137. Accel_magnitude = sqrt(Accel_Vector[0]*Accel_Vector[0] + Accel_Vector[1]*Accel_Vector[1] + Accel_Vector[2]*Accel_Vector[2]);
  138. Accel_magnitude = Accel_magnitude / GRAVITY; // Scale to gravity.
  139. // Dynamic weighting of accelerometer info (reliability filter)
  140. // Weight for accelerometer info (<0.5G = 0.0, 1G = 1.0 , >1.5G = 0.0)
  141. Accel_weight = constrain(1 - 2*abs(1 - Accel_magnitude),0,1); //
  142.  
  143. Vector_Cross_Product(&errorRollPitch[0],&Accel_Vector[0],&DCM_Matrix[2][0]); //adjust the ground of reference
  144. Vector_Scale(&Omega_P[0],&errorRollPitch[0],Kp_ROLLPITCH*Accel_weight);
  145.  
  146. Vector_Scale(&Scaled_Omega_I[0],&errorRollPitch[0],Ki_ROLLPITCH*Accel_weight);
  147. Vector_Add(Omega_I,Omega_I,Scaled_Omega_I);
  148.  
  149. //*****YAW***************
  150. // We make the gyro YAW drift correction based on compass magnetic heading
  151.  
  152. mag_heading_x = cos(MAG_Heading);
  153. mag_heading_y = sin(MAG_Heading);
  154. errorCourse=(DCM_Matrix[0][0]*mag_heading_y) - (DCM_Matrix[1][0]*mag_heading_x); //Calculating YAW error
  155. Vector_Scale(errorYaw,&DCM_Matrix[2][0],errorCourse); //Applys the yaw correction to the XYZ rotation of the aircraft, depeding the position.
  156.  
  157. Vector_Scale(&Scaled_Omega_P[0],&errorYaw[0],Kp_YAW);//.01proportional of YAW.
  158. Vector_Add(Omega_P,Omega_P,Scaled_Omega_P);//Adding Proportional.
  159.  
  160. Vector_Scale(&Scaled_Omega_I[0],&errorYaw[0],Ki_YAW);//.00001Integrator
  161. Vector_Add(Omega_I,Omega_I,Scaled_Omega_I);//adding integrator to the Omega_I
  162. }
  163. /**************************************************/
  164. /*
  165. void Accel_adjust(void)
  166.  {
  167.  Accel_Vector[1] += Accel_Scale(speed_3d*Omega[2]); // Centrifugal force on Acc_y = GPS_speed*GyroZ
  168.  Accel_Vector[2] -= Accel_Scale(speed_3d*Omega[1]); // Centrifugal force on Acc_z = GPS_speed*GyroY
  169.  }
  170.  */
  171. /**************************************************/
  172.  
  173. void Matrix_update(void)
  174. {
  175. Gyro_Vector[0]=Gyro_Scaled_X(gyro_x); //gyro x roll
  176. Gyro_Vector[1]=Gyro_Scaled_Y(gyro_y); //gyro y pitch
  177. Gyro_Vector[2]=Gyro_Scaled_Z(gyro_z); //gyro Z yaw
  178.  
  179. Accel_Vector[0]=accel_x;
  180. Accel_Vector[1]=accel_y;
  181. Accel_Vector[2]=accel_z;
  182.  
  183. Vector_Add(&Omega[0], &Gyro_Vector[0], &Omega_I[0]); //adding proportional term
  184. Vector_Add(&Omega_Vector[0], &Omega[0], &Omega_P[0]); //adding Integrator term
  185. //Accel_adjust(); //Remove centrifugal acceleration. We are not using this function in this version - we have no speed measuremet
  186. #if OUTPUTMODE==1
  187. Update_Matrix[0][0]=0;
  188. Update_Matrix[0][1]=-G_Dt*Omega_Vector[2];//-z
  189. Update_Matrix[0][2]=G_Dt*Omega_Vector[1];//y
  190. Update_Matrix[1][0]=G_Dt*Omega_Vector[2];//z
  191. Update_Matrix[1][1]=0;
  192. Update_Matrix[1][2]=-G_Dt*Omega_Vector[0];//-x
  193. Update_Matrix[2][0]=-G_Dt*Omega_Vector[1];//-y
  194. Update_Matrix[2][1]=G_Dt*Omega_Vector[0];//x
  195. Update_Matrix[2][2]=0;
  196. #else // Uncorrected data (no drift correction)
  197. Update_Matrix[0][0]=0;
  198. Update_Matrix[0][1]=-G_Dt*Gyro_Vector[2];//-z
  199. Update_Matrix[0][2]=G_Dt*Gyro_Vector[1];//y
  200. Update_Matrix[1][0]=G_Dt*Gyro_Vector[2];//z
  201. Update_Matrix[1][1]=0;
  202. Update_Matrix[1][2]=-G_Dt*Gyro_Vector[0];
  203. Update_Matrix[2][0]=-G_Dt*Gyro_Vector[1];
  204. Update_Matrix[2][1]=G_Dt*Gyro_Vector[0];
  205. Update_Matrix[2][2]=0;
  206. #endif
  207. Matrix_Multiply(DCM_Matrix,Update_Matrix,Temporary_Matrix); //a*b=c
  208. for(int x=0; x<3; x++) //Matrix Addition (update)
  209. {
  210. for(int y=0; y<3; y++)
  211. {
  212. DCM_Matrix[x][y]+=Temporary_Matrix[x][y];
  213. }
  214. }
  215. }
  216. void Euler_angles(void)
  217. {
  218. pitch = -asin(DCM_Matrix[2][0]);
  219. roll = atan2(DCM_Matrix[2][1],DCM_Matrix[2][2]);
  220. yaw = atan2(DCM_Matrix[1][0],DCM_Matrix[0][0]);
  221. }
  222. void I2C_Init()
  223. {
  224. Wire.begin();
  225. }
  226. void Gyro_Init()
  227. {
  228. gyro.writeReg(L3G4200D_CTRL_REG1, 0x0F); // normal power mode, all axes enabled, 100 Hz
  229. gyro.writeReg(L3G4200D_CTRL_REG4, 0x20); // 2000 dps full scale
  230. }
  231. void Read_Gyro()
  232. {
  233. gyro.read();
  234. AN[0] = gyro.g.x;
  235. AN[1] = gyro.g.y;
  236. AN[2] = gyro.g.z;
  237. gyro_x = SENSOR_SIGN[0] * (AN[0] - AN_OFFSET[0]);
  238. gyro_y = SENSOR_SIGN[1] * (AN[1] - AN_OFFSET[1]);
  239. gyro_z = SENSOR_SIGN[2] * (AN[2] - AN_OFFSET[2]);
  240. }
  241. void Accel_Init()
  242. {
  243. compass.writeAccReg(LSM303_CTRL_REG1_A, 0x27); // normal power mode, all axes enabled, 50 Hz
  244. compass.writeAccReg(LSM303_CTRL_REG4_A, 0x30); // 8 g full scale
  245. }
  246. // Reads x,y and z accelerometer registers
  247. void Read_Accel()
  248. {
  249. compass.readAcc();
  250. AN[3] = compass.a.x;
  251. AN[4] = compass.a.y;
  252. AN[5] = compass.a.z;
  253. accel_x = SENSOR_SIGN[3] * (AN[3] - AN_OFFSET[3]);
  254. accel_y = SENSOR_SIGN[4] * (AN[4] - AN_OFFSET[4]);
  255. accel_z = SENSOR_SIGN[5] * (AN[5] - AN_OFFSET[5]);
  256. }
  257. void Compass_Init()
  258. {
  259. for(int j=5;j>0;j--){
  260. Serial.println(j);
  261. delay(1000);
  262. }
  263. compass.init();
  264. compass.enableDefault();
  265. compass.writeMagReg(LSM303_CRB_REG_M, MAG_GAIN);
  266. Serial.println("Wait for compass config");
  267. delay(5000);//neccessary to set the gain of the mag sensor
  268. //remove the above line and the IMU will not work
  269. compass.writeMagReg(LSM303_CRB_REG_M, MAG_GAIN);
  270. // 15 Hz default
  271. }
  272. void Read_Compass()
  273. {
  274. compass.readMag();
  275. magnetom_x = SENSOR_SIGN[6] * compass.m.x;
  276. magnetom_y = SENSOR_SIGN[7] * compass.m.y;
  277. magnetom_z = SENSOR_SIGN[8] * compass.m.z;
  278. }
  279. float Vector_Dot_Product(float vector1[3],float vector2[3])
  280. {
  281. float op=0;
  282.  
  283. for(int c=0; c<3; c++)
  284. {
  285. op+=vector1[c]*vector2[c];
  286. }
  287.  
  288. return op;
  289. }
  290. //Computes the cross product of two vectors
  291. void Vector_Cross_Product(float vectorOut[3], float v1[3],float v2[3])
  292. {
  293. vectorOut[0]= (v1[1]*v2[2]) - (v1[2]*v2[1]);
  294. vectorOut[1]= (v1[2]*v2[0]) - (v1[0]*v2[2]);
  295. vectorOut[2]= (v1[0]*v2[1]) - (v1[1]*v2[0]);
  296. }
  297. //Multiply the vector by a scalar.
  298. void Vector_Scale(float vectorOut[3],float vectorIn[3], float scale2)
  299. {
  300. for(int c=0; c<3; c++)
  301. {
  302. vectorOut[c]=vectorIn[c]*scale2;
  303. }
  304. }
  305.  
  306. void Vector_Add(float vectorOut[3],float vectorIn1[3], float vectorIn2[3])
  307. {
  308. for(int c=0; c<3; c++)
  309. {
  310. vectorOut[c]=vectorIn1[c]+vectorIn2[c];
  311. }
  312. }
  313. void Matrix_Multiply(float a[3][3], float b[3][3],float mat[3][3])
  314. {
  315. float op[3];
  316. for(int x=0; x<3; x++)
  317. {
  318. for(int y=0; y<3; y++)
  319. {
  320. for(int w=0; w<3; w++)
  321. {
  322. op[w]=a[x][w]*b[w][y];
  323. }
  324. mat[x][y]=0;
  325. mat[x][y]=op[0]+op[1]+op[2];
  326.  
  327. float test=mat[x][y];
  328. }
  329. }
  330. }
  331.  
  332. long convert_to_dec(float x)
  333. {
  334. return x*10000000;
  335. }
  336.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void Calibrate()’:
prog.cpp:32: error: ‘CAL_FIN’ was not declared in this scope
prog.cpp:32: error: ‘digitalRead’ was not declared in this scope
prog.cpp:34: error: ‘compass’ was not declared in this scope
prog.cpp:36: error: ‘running_min’ was not declared in this scope
prog.cpp:36: error: ‘min’ was not declared in this scope
prog.cpp:40: error: ‘running_max’ was not declared in this scope
prog.cpp:40: error: ‘max’ was not declared in this scope
prog.cpp:43: error: ‘Serial’ was not declared in this scope
prog.cpp:58: error: ‘M_X_MIN’ was not declared in this scope
prog.cpp:59: error: ‘M_Y_MIN’ was not declared in this scope
prog.cpp:60: error: ‘M_Z_MIN’ was not declared in this scope
prog.cpp:61: error: ‘M_X_MAX’ was not declared in this scope
prog.cpp:62: error: ‘M_Y_MAX’ was not declared in this scope
prog.cpp:63: error: ‘M_Z_MAX’ was not declared in this scope
prog.cpp:64: error: ‘delay’ was not declared in this scope
prog.cpp: In function ‘void Compass_Heading()’:
prog.cpp:77: error: ‘roll’ was not declared in this scope
prog.cpp:77: error: ‘cos’ was not declared in this scope
prog.cpp:78: error: ‘sin’ was not declared in this scope
prog.cpp:79: error: ‘pitch’ was not declared in this scope
prog.cpp:83: error: ‘c_magnetom_x’ was not declared in this scope
prog.cpp:83: error: ‘magnetom_x’ was not declared in this scope
prog.cpp:83: error: ‘SENSOR_SIGN’ was not declared in this scope
prog.cpp:83: error: ‘M_X_MIN’ was not declared in this scope
prog.cpp:83: error: ‘M_X_MAX’ was not declared in this scope
prog.cpp:84: error: ‘c_magnetom_y’ was not declared in this scope
prog.cpp:84: error: ‘magnetom_y’ was not declared in this scope
prog.cpp:84: error: ‘M_Y_MIN’ was not declared in this scope
prog.cpp:84: error: ‘M_Y_MAX’ was not declared in this scope
prog.cpp:85: error: ‘c_magnetom_z’ was not declared in this scope
prog.cpp:85: error: ‘magnetom_z’ was not declared in this scope
prog.cpp:85: error: ‘M_Z_MIN’ was not declared in this scope
prog.cpp:85: error: ‘M_Z_MAX’ was not declared in this scope
prog.cpp:92: error: ‘MAG_Heading’ was not declared in this scope
prog.cpp:92: error: ‘atan2’ was not declared in this scope
prog.cpp: In function ‘void Normalize()’:
prog.cpp:101: error: ‘DCM_Matrix’ was not declared in this scope
prog.cpp:101: error: ‘Vector_Dot_Product’ was not declared in this scope
prog.cpp:103: error: ‘Vector_Scale’ was not declared in this scope
prog.cpp:106: error: ‘Vector_Add’ was not declared in this scope
prog.cpp:109: error: ‘Vector_Cross_Product’ was not declared in this scope
prog.cpp: In function ‘void Drift_correction()’:
prog.cpp:137: error: ‘Accel_Vector’ was not declared in this scope
prog.cpp:137: error: ‘sqrt’ was not declared in this scope
prog.cpp:138: error: ‘GRAVITY’ was not declared in this scope
prog.cpp:141: error: ‘abs’ was not declared in this scope
prog.cpp:141: error: ‘constrain’ was not declared in this scope
prog.cpp:143: error: ‘errorRollPitch’ was not declared in this scope
prog.cpp:143: error: ‘DCM_Matrix’ was not declared in this scope
prog.cpp:143: error: ‘Vector_Cross_Product’ was not declared in this scope
prog.cpp:144: error: ‘Omega_P’ was not declared in this scope
prog.cpp:144: error: ‘Kp_ROLLPITCH’ was not declared in this scope
prog.cpp:144: error: ‘Vector_Scale’ was not declared in this scope
prog.cpp:146: error: ‘Ki_ROLLPITCH’ was not declared in this scope
prog.cpp:147: error: ‘Omega_I’ was not declared in this scope
prog.cpp:147: error: ‘Vector_Add’ was not declared in this scope
prog.cpp:152: error: ‘MAG_Heading’ was not declared in this scope
prog.cpp:152: error: ‘cos’ was not declared in this scope
prog.cpp:153: error: ‘sin’ was not declared in this scope
prog.cpp:155: error: ‘errorYaw’ was not declared in this scope
prog.cpp:157: error: ‘Kp_YAW’ was not declared in this scope
prog.cpp:160: error: ‘Ki_YAW’ was not declared in this scope
prog.cpp: In function ‘void Matrix_update()’:
prog.cpp:175: error: ‘Gyro_Vector’ was not declared in this scope
prog.cpp:175: error: ‘gyro_x’ was not declared in this scope
prog.cpp:175: error: ‘Gyro_Scaled_X’ was not declared in this scope
prog.cpp:176: error: ‘gyro_y’ was not declared in this scope
prog.cpp:176: error: ‘Gyro_Scaled_Y’ was not declared in this scope
prog.cpp:177: error: ‘gyro_z’ was not declared in this scope
prog.cpp:177: error: ‘Gyro_Scaled_Z’ was not declared in this scope
prog.cpp:179: error: ‘Accel_Vector’ was not declared in this scope
prog.cpp:179: error: ‘accel_x’ was not declared in this scope
prog.cpp:180: error: ‘accel_y’ was not declared in this scope
prog.cpp:181: error: ‘accel_z’ was not declared in this scope
prog.cpp:183: error: ‘Omega’ was not declared in this scope
prog.cpp:183: error: ‘Omega_I’ was not declared in this scope
prog.cpp:183: error: ‘Vector_Add’ was not declared in this scope
prog.cpp:184: error: ‘Omega_Vector’ was not declared in this scope
prog.cpp:184: error: ‘Omega_P’ was not declared in this scope
prog.cpp:197: error: ‘Update_Matrix’ was not declared in this scope
prog.cpp:198: error: ‘G_Dt’ was not declared in this scope
prog.cpp:207: error: ‘DCM_Matrix’ was not declared in this scope
prog.cpp:207: error: ‘Temporary_Matrix’ was not declared in this scope
prog.cpp:207: error: ‘Matrix_Multiply’ was not declared in this scope
prog.cpp: In function ‘void Euler_angles()’:
prog.cpp:218: error: ‘pitch’ was not declared in this scope
prog.cpp:218: error: ‘DCM_Matrix’ was not declared in this scope
prog.cpp:218: error: ‘asin’ was not declared in this scope
prog.cpp:219: error: ‘roll’ was not declared in this scope
prog.cpp:219: error: ‘atan2’ was not declared in this scope
prog.cpp:220: error: ‘yaw’ was not declared in this scope
prog.cpp: In function ‘void I2C_Init()’:
prog.cpp:224: error: ‘Wire’ was not declared in this scope
prog.cpp: In function ‘void Gyro_Init()’:
prog.cpp:228: error: ‘gyro’ was not declared in this scope
prog.cpp:228: error: ‘L3G4200D_CTRL_REG1’ was not declared in this scope
prog.cpp:229: error: ‘L3G4200D_CTRL_REG4’ was not declared in this scope
prog.cpp: In function ‘void Read_Gyro()’:
prog.cpp:233: error: ‘gyro’ was not declared in this scope
prog.cpp:234: error: ‘AN’ was not declared in this scope
prog.cpp:237: error: ‘gyro_x’ was not declared in this scope
prog.cpp:237: error: ‘SENSOR_SIGN’ was not declared in this scope
prog.cpp:237: error: ‘AN_OFFSET’ was not declared in this scope
prog.cpp:238: error: ‘gyro_y’ was not declared in this scope
prog.cpp:239: error: ‘gyro_z’ was not declared in this scope
prog.cpp: In function ‘void Accel_Init()’:
prog.cpp:243: error: ‘compass’ was not declared in this scope
prog.cpp:243: error: ‘LSM303_CTRL_REG1_A’ was not declared in this scope
prog.cpp:244: error: ‘LSM303_CTRL_REG4_A’ was not declared in this scope
prog.cpp: In function ‘void Read_Accel()’:
prog.cpp:249: error: ‘compass’ was not declared in this scope
prog.cpp:250: error: ‘AN’ was not declared in this scope
prog.cpp:253: error: ‘accel_x’ was not declared in this scope
prog.cpp:253: error: ‘SENSOR_SIGN’ was not declared in this scope
prog.cpp:253: error: ‘AN_OFFSET’ was not declared in this scope
prog.cpp:254: error: ‘accel_y’ was not declared in this scope
prog.cpp:255: error: ‘accel_z’ was not declared in this scope
prog.cpp: In function ‘void Compass_Init()’:
prog.cpp:260: error: ‘Serial’ was not declared in this scope
prog.cpp:261: error: ‘delay’ was not declared in this scope
prog.cpp:263: error: ‘compass’ was not declared in this scope
prog.cpp:265: error: ‘LSM303_CRB_REG_M’ was not declared in this scope
prog.cpp:265: error: ‘MAG_GAIN’ was not declared in this scope
prog.cpp:266: error: ‘Serial’ was not declared in this scope
prog.cpp:267: error: ‘delay’ was not declared in this scope
prog.cpp: In function ‘void Read_Compass()’:
prog.cpp:274: error: ‘compass’ was not declared in this scope
prog.cpp:275: error: ‘magnetom_x’ was not declared in this scope
prog.cpp:275: error: ‘SENSOR_SIGN’ was not declared in this scope
prog.cpp:276: error: ‘magnetom_y’ was not declared in this scope
prog.cpp:277: error: ‘magnetom_z’ was not declared in this scope
prog.cpp: In function ‘void Matrix_Multiply(float (*)[3], float (*)[3], float (*)[3])’:
prog.cpp:327: warning: unused variable ‘test’
stdout
Standard output is empty