Today feels like very slow progress. I guess its the end of the week and I'm not thinking straight. I have a question regrading the binary Message protocol used in the main loop in ArduIMU. I am trying to send the Gyro Rate values through to another micro but somewhere along the way the numbers get jumbled. I can say right now that I am receiving the data fine. I think I am just not formatting it correctly. The format I am sending the Gyro_vector out of ArduIMU in is below:
tempint = ToDeg(Gyro_Vector[0])*100; //X Rate
IMU_buffer[8] = tempint&0xff;
IMU_buffer[9]=(tempint>>8)&0xff;
tempint = ToDeg(Gyro_Vector[1])*100; //Y Rate
IMU_buffer[10] = tempint&0xff;
IMU_buffer[11]=(tempint>>8)&0xff;
tempint = ToDeg(Gyro_Vector[2])*100; //Z Rate
IMU_buffer[12] = tempint&0xff;
IMU_buffer[13]=(tempint>>8)&0xff;
And I am assembling it on the other side with this code:
//Storing Z Rate
intUnion.byte[0] = buffer[8];
intUnion.byte[1] = buffer[9];
Xrate = intUnion.word/100;
//Storing Z Rate
intUnion.byte[0] = buffer[10];
intUnion.byte[1] = buffer[11];
Yrate = intUnion.word/100;
//Storing Z Rate
intUnion.byte[0] = buffer[12];
intUnion.byte[1] = buffer[13];
Zrate = intUnion.word/100;
Assuming I have received it correctly (I use all the checksums etc just too much code to put here) then what is wrong. Instead of getting values from -355 to 600 when reading directly off ArduIMU I now get values like -416 and 555.
Thanks in advance,
Will
Replies
Cheers,
Will
Also there is lots of potential for error in how your parser decodes the message. Without looking at your code that cannot be discounted. Do the buffer indexes line up? The tx buffer may include package length and message ID, while the rx buffer may not (assuming you are reusing a lot of the existing code). Just hard code values in for tempint and verify the basics.