I am using ArduPilot with IMU and ublox GPS, connected to an XBee telemetry chip. I need acceleration data from the IMU accelerometers, i.e. raw an3, an4, an5 readings. Hence I tried to modify the code in IMU as follows:


In arduimu code, under 'Output', I basically added the bolded code as below:

  // This section outputs the IMU orientatiom message
  Serial.print("DIYd");  // This is the message preamble
  IMU_buffer[1] = 0x02;     

  tempint=ToDeg(roll)*100;  //Roll (degrees) * 100 in 2 bytes
  tempint=ToDeg(pitch)*100;   //Pitch (degrees) * 100 in 2 bytes
  templong=(ToDeg(yaw)+gc_offset)*100;  //Yaw (degrees) * 100 in 2 bytes
  if(templong>18000) templong -=36000;
  if(templong<-18000) templong +=36000;
  tempint = templong;


  tempint=Accel_Vector[0]*1000;   //AccX * 1000 in 2 bytes

  tempint=Accel_Vector[1]*1000;   //AccY * 1000 in 2 bytes

  tempint=Accel_Vector[2]*1000;   //AccZ * 1000 in 2 bytes
  for (int i=0;i<ck+2;i++) Serial.print (IMU_buffer[i]);
  for (int i=0;i<ck+2;i++) {
   IMU_ck_a+=IMU_buffer[i];  //Calculates checksums


Then in ArduPilot, I added in similar code to receive the data. However, when I uploaded the code and tried to start up the system, it seems to keep iterating the start up message, i.e. start up message keeps looping.


Does anyone have any idea whether there's an error in my code or if I did something wrong? I did not change anything else to the codes..


Many thanks in advance!!

Views: 279

Reply to This

Replies to This Discussion

You did not adjust the packet length, so the checksum is probably failing on the receive end....


Need to change;


Does ck=6 correspond to a total of 6bytes sent? Is 0x06 the packet length corresponding to ck=6?


On the receiving end, Ardupilot side I suppose I also have to adjust accordingly?

Reply to Discussion


© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service