Fat Tony
Posts: 9 Joined: Tue Sep 13, 2011 2:27 pm
Post
by Fat Tony » Wed Sep 14, 2011 7:54 am
Hello,
On my copter shield I turned the Acc (BMA020) about 90°, so I have to change the x- and y-direction.
Is it enough to change it in the source code under the point "Sensors/default board orientation" ?
Code: Select all
// ************************************************************************************************************ // board orientation and setup // ************************************************************************************************************ //default board orientation #if !defined(ACC_ORIENTATION) #define ACC_ORIENTATION(X, Y, Z) {accADC[ROLL] = X; accADC[PITCH] = Y; accADC[YAW] = Z;} #endif
Fat Tony
Posts: 9 Joined: Tue Sep 13, 2011 2:27 pm
Post
by Fat Tony » Wed Sep 14, 2011 8:04 am
Oh now, I think I find the right Code part
I have to change it in the config.h right ?
Code: Select all
//****** end of advanced users settings ************* //if you want to change to orientation of individual sensor //#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] = X; magADC[PITCH] = Y; magADC[YAW] = Z;}
Niclas Hedlund
Posts: 16 Joined: Wed Sep 14, 2011 7:00 am
Location: Sweden
Post
by Niclas Hedlund » Fri Sep 16, 2011 7:20 am
Thats correct!
Just watch out if you use the "#define GYRO_ORIENTATION()" in config.h because it seems to be altered compared to the "#define GYRO_ORIENTATION" that is used by default in Sensors.pde. X and Y are mixed up in the 1.8 patch1 release.
Code: Select all
config.h -->//#define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] = -Y; gyroADC[PITCH] = X; gyroADC[YAW] = Z;} Sensors.pde --> #define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] = X; gyroADC[PITCH] = Y; gyroADC[YAW] = Z;}