ArduIMU 6DOF IMU Driver
Kschulz
Posts: 11
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.
·
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
This line repeat while Rx <>= "D" I think should be repeat while Rx <> "D"
What I would do initially to get used to the prop is make sure your code is working by sending each character you receive out to the pc via fdx using hex. You can then see the data coming in. Next, you can force a couple of characters together to ensure you are packing the binary correctly and once again output in hex (and maybe also in decimal). These functions are available in fdx.
We are building a whole 10DOF+ prop pcb at the moment - see http://forums.parallax.com/showthread.php?p=890157
And here is another related thread with the prop and sensors http://forums.parallax.com/showthread.php?p=841207
It is certainly interesting times ahead.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
Post Edited (Cluso99) : 4/24/2010 7:44:25 AM GMT