Code support for the AeroQuad 2.x shield

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download

Code support for the AeroQuad 2.x shield

Postby dpackham » Fri Jul 01, 2011 7:13 pm

I think that the only things that need to be changed for the MultiWii software to work on the AeroQuad 2.x shields in the I2C addresses and sensor orientations.

The hardware is the same basically, but the Sparkfun breakouts that AQ uses use different I2C addresses, and the orientation is (I think) 90 degrees off. Also maybe the MW camera pins are now on 44 and 45 I believe, AQ's are on something else. AQ battery monitor is on A0, Mw is on something different. Might be other pin out differences but they are not needed for flight.

what would you need from me to include the next rev of code a #define AeroQuad2xshield option?

Thanks
dpackham
 
Posts: 16
Joined: Wed Mar 23, 2011 8:50 pm

Re: Code support for the AeroQuad 2.x shield

Postby dpackham » Fri Jul 01, 2011 7:15 pm

A few others have provided me with a copy of V1.prebis7 that works with the AQ shield. does someone have a clean copy of V1.prebis7 that I can make a diff on?
dpackham
 
Posts: 16
Joined: Wed Mar 23, 2011 8:50 pm

Re: Code support for the AeroQuad 2.x shield

Postby PatrikE » Sat Jul 02, 2011 6:11 pm

dpackham wrote:A few others have provided me with a copy of V1.prebis7 that works with the AQ shield. does someone have a clean copy of V1.prebis7 that I can make a diff on?


You have a PM...

/Patrik
PatrikE
 
Posts: 1949
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden

Re: Code support for the AeroQuad 2.x shield

Postby dpackham » Sun Jul 03, 2011 4:47 am

652,656c621,622
< accADC[PITCH] = - (((rawADC_BMA180[1]<<8) | (rawADC_BMA180[0]))>>2)/10; // AeroQuad Orientation
< accADC[ROLL] = + (((rawADC_BMA180[3]<<8) | (rawADC_BMA180[2]))>>2)/10; // AeroQuad Orientation
---
> accADC[ROLL] = - (((rawADC_BMA180[1]<<8) | (rawADC_BMA180[0]))>>2)/10; // opie settings: + ; FFIMU: -
> accADC[PITCH] = - (((rawADC_BMA180[3]<<8) | (rawADC_BMA180[2]))>>2)/10;
729c695
< i2c_rep_start(0XD2+0); // I2C write direction
---
> i2c_rep_start(0XD0+0); // I2C write direction
742c708
< i2c_rep_start(0XD2); // I2C write direction
---
> i2c_rep_start(0XD0); // I2C write direction
744c710
< i2c_rep_start(0XD2 +1); // I2C read direction => 1
---
> i2c_rep_start(0XD0 +1); // I2C read direction => 1
749,753c715,716
< gyroADC[ROLL] = + ((rawADC_ITG3200[0]<<8) | rawADC_ITG3200[1]); // AeroQuad Orientation
< gyroADC[PITCH] = + ((rawADC_ITG3200[2]<<8) | rawADC_ITG3200[3]); // AeroQuad Orientation
---
> gyroADC[ROLL] = + ((rawADC_ITG3200[2]<<8) | rawADC_ITG3200[3]);
> gyroADC[PITCH] = - ((rawADC_ITG3200[0]<<8) | rawADC_ITG3200[1]);
786,792c749,751
< magADC[XAXIS] = ((rawADC_HMC5843[0]<<8) | rawADC_HMC5843[1]);
< magADC[YAXIS] = - ((rawADC_HMC5843[2]<<8) | rawADC_HMC5843[3]);
< magADC[ZAXIS] = - ((rawADC_HMC5843[4]<<8) | rawADC_HMC5843[5]);
---
> magADC[ROLL] = ((rawADC_HMC5843[0]<<8) | rawADC_HMC5843[1]);
> magADC[PITCH] = ((rawADC_HMC5843[2]<<8) | rawADC_HMC5843[3]);
> magADC[YAW] = - ((rawADC_HMC5843[4]<<8) | rawADC_HMC5843[5]);
1095,1097c1054,1055
< for (axis=0;axis<3;axis++) accSmooth[axis] =(accSmooth[axis]*7+accADC[axis])/8;
---
> for (axis=0;axis<3;axis++) accSmooth[axis] =(accSmooth[axis]*7+accADC[axis]+4)/8;
>
1128,1134c1086,1088
< mag[XAXIS] = magADC[XAXIS]*cos_[PITCH]+magADC[YAXIS]*A[ROLL]*A[PITCH]+magADC[ZAXIS]*cos_[ROLL]*A[PITCH];
< mag[YAXIS] = magADC[YAXIS]*cos_[ROLL]-magADC[ZAXIS]*A[ROLL];
< heading = degrees(atan2(-mag[YAXIS],mag[XAXIS]));
---
> mag[PITCH] = -magADC[PITCH]*cos_[PITCH]+magADC[ROLL]*A[ROLL]*A[PITCH]+magADC[YAW]*cos_[ROLL]*A[PITCH];
> mag[ROLL] = magADC[ROLL]*cos_[ROLL]-magADC[YAW]*A[ROLL];
> heading = degrees(atan2(mag[PITCH],mag[ROLL]));
Last edited by dpackham on Sun Jul 03, 2011 5:29 am, edited 1 time in total.
dpackham
 
Posts: 16
Joined: Wed Mar 23, 2011 8:50 pm

Re: Code support for the AeroQuad 2.x shield

Postby dpackham » Sun Jul 03, 2011 5:21 am

Thanks. I Created a patch file that maybe you guys can get into the 1.8 code maybe :)

Its got some serial port stuff that does not need to be in there but the important parts are. the Sensors Address is different and some ROLL/PITCH swapping and orientations

Here to hoping we get a #define AeroquadShield2x

https://p0lardev.it.utah.edu/1.pre7patc ... ld2x.patch

:)

Dave P
dpackham
 
Posts: 16
Joined: Wed Mar 23, 2011 8:50 pm

Re: Code support for the AeroQuad 2.x shield

Postby Alexinparis » Mon Jul 04, 2011 9:56 am

I will try to include this board following these orientation and I2C addresses.
Alexinparis
 
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Code support for the AeroQuad 2.x shield

Postby dpackham » Mon Jul 04, 2011 5:05 pm

great. I just started looking at your new dev code and found the defines in def.h.

i dont quite understand your ACC/GYRO/MAG orientations so you may want to double check them with the diff i posted before.

Let me know when you want to test it and ill grad the dev code and try.

Thanks

#if defined(AEROQUADSHIELDv2)
#define ITG3200
#define BMA180
#define BMP085
#define HMC5843
#define ACC_ORIENTATION(X, Y, Z) {accADC[ROLL] = X; accADC[PITCH] = Y; accADC[YAW] = Z;}
#define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] = X; gyroADC[PITCH] = Y; gyroADC[YAW] = Z;}
#define MAG_ORIENTATION(X, Y, Z) {magADC[ROLL] = -Y; magADC[PITCH] = X; magADC[YAW] = Z;}
#define ITG3200_ADDRESS 0XD2
#endif
dpackham
 
Posts: 16
Joined: Wed Mar 23, 2011 8:50 pm

Re: Code support for the AeroQuad 2.x shield

Postby dpackham » Mon Jul 04, 2011 8:10 pm

This might be closer. added some "-" to the roll access after swapping ROLL with PITCH and PITCH with ROLL

#if defined(AEROQUADSHIELDv2)
#define ITG3200
#define BMA180
#define BMP085
//#define HMC5843
#define ACC_ORIENTATION(X, Y, Z) {accADC[PITCH] = X; accADC[ROLL] = -Y; accADC[YAW] = Z;}
#define GYRO_ORIENTATION(X, Y, Z) {gyroADC[PITCH] = X; gyroADC[ROLL] = -Y; gyroADC[YAW] = Z;}
//#define MAG_ORIENTATION(X, Y, Z) {magADC[ROLL] = -Y; magADC[PITCH] = X; magADC[YAW] = Z;}
#define ITG3200_ADDRESS 0XD2
#endif
dpackham
 
Posts: 16
Joined: Wed Mar 23, 2011 8:50 pm

Re: Code support for the AeroQuad 2.x shield

Postby dpackham » Wed Jul 06, 2011 4:16 am

your code looks better. will try as soon as it stops raining


#if defined(AEROQUADSHIELDv2) // to confirm
#define ITG3200
#define BMA180
#define BMP085
#define HMC5843
#define ACC_ORIENTATION(X, Y, Z) {accADC[ROLL] = -Y; accADC[PITCH] = X; accADC[YAW] = Z;}
#define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] = -Y; gyroADC[PITCH] = X; gyroADC[YAW] = Z;}
#define MAG_ORIENTATION(X, Y, Z) {magADC[ROLL] = -Y; magADC[PITCH] = X; magADC[YAW] = Z;}
#define ITG3200_ADDRESS 0XD2
#endif
dpackham
 
Posts: 16
Joined: Wed Mar 23, 2011 8:50 pm


Return to Software development

Who is online

Users browsing this forum: No registered users and 9 guests

cron