Shop OBEX P1 Docs P2 Docs Learn Events
ArduIMU 6DOF IMU Driver — Parallax Forums

ArduIMU 6DOF IMU Driver

KschulzKschulz Posts: 11
edited 2010-04-24 07:39 in Propeller 1
I am working on a driver to connect the ArduIMU+ V2 (flat) supplied by DIY Drones to the Propeller.· The ArduIMU has an ATMEGA processor programed in C.· This IMU with processor outputs filtered pitch, roll, yaw and GPS data via a UART serial port at 38400 baud. (perfect for an autopilot)
http://store.diydrones.com/product_p/kt-arduimu-20.htm
I am having issues getting the binary data from the IMU into the propeller chip.· The open source program from DIY drones will output ASCII data or binary data.· The ASCII data runs at 10hz and is easily passed into the propeller.· The binary seems trickier.· The binary stream runs at 50hz which is best for updating servos which also run at 50 hz.· I need help getting the binary data into the propeller.
Here is an excerpt of the C program that lives in the ATMEGA processor:
tempint=ToDeg(roll)*100;· //Roll (degrees) * 100 in 2 bytes
····· IMU_buffer[noparse][[/noparse]3]=tempint&0xff;
· ····IMU_buffer[noparse][[/noparse]4]=(tempint>>8)&0xff;
·····
····· tempint=ToDeg(pitch)*100;·· //Pitch (degrees) * 100 in 2 bytes
····· IMU_buffer[noparse][[/noparse]5]=tempint&0xff;
····· IMU_buffer[noparse][[/noparse]6]=(tempint>>8)&0xff;
·····
····· tempint=ToDeg(yaw)*100;· //Yaw (degrees) * 100 in 2 bytes
····· IMU_buffer[noparse][[/noparse]7]=tempint&0xff;
····· IMU_buffer[noparse][[/noparse]8]=(tempint>>8)&0xff;
·····
····· templong=convert_to_dec(lon); //Longitude *10**6 in 4 bytes
····· IMU_buffer[noparse][[/noparse]9]=templong&0xff;
····· IMU_buffer[noparse][[/noparse]10]=(templong>>8)&0xff;
····· IMU_buffer[noparse][[/noparse]11]=(templong>>16)&0xff;
····· IMU_buffer[noparse][[/noparse]12]=(templong>>24)&0xff;
·····
····· templong=convert_to_dec(lat); //Latitude *10**6 in 4 bytes
····· IMU_buffer[noparse][[/noparse]13]=templong&0xff;
····· IMU_buffer[noparse][[/noparse]14]=(templong>>8)&0xff;
····· IMU_buffer[noparse][[/noparse]15]=(templong>>16)&0xff;
····· IMU_buffer[noparse][[/noparse]16]=(templong>>24)&0xff;
·
As you can see the roll data consists of two binary bytes.· I think these bites have to be combined once received by the propeller to represent a word of binary roll data.· When I try to use the FullDuplexSerialPlus object to get this binary data it gives me an output like this:
203
4
137
0
8
145
54
111
24
4
100
The output should float near zero because there was no movement in the sensor while the data was recorded.
I think what is happening is I am only getting the first byte.· I need to get two bytes and then combine them, convert to a decimal, and then output them.· I attached two Spin programs that both create this output.·· One program tries to move bytes into a word variable and the second program uses the fullduplex GetBin command.· Both aren’t working.· A good driver for this sensor would be very useful for a lot of projects due to the low cost and ease of use.· Please let me know if you have any suggestions on how to get the binary data.
·

Comments

Sign In or Register to comment.