90 degrees board rotation

This forum is dedicated to all issues and questions related to your individual setups and configurations
Post Reply
handsomejackuk
Posts: 97
Joined: Mon Sep 08, 2014 12:25 am

90 degrees board rotation

Post by handsomejackuk »

Hi i have built my own flight controller suing mpu 6050 and an atmega 328 pro min board, i would ideall like for the boards orientation to be 90 degrees turned CW how can i do this in software,

ihave tried this command by swapping x, and y hoping it would swap the roll and pitch axis but does not work

#define FORCE_ACC_ORIENTATION(X, Y, Z) {imu.accADC[ROLL] = Y; imu.accADC[PITCH] = -X; imu.accADC[YAW] = Z;}
#define FORCE_GYRO_ORIENTATION(X, Y, Z) {imu.gyroADC[ROLL] = -Y; imu.gyroADC[PITCH] = X; imu.gyroADC[YAW] = Z;}
//#define FORCE_MAG_ORIENTATION(X, Y, Z) {imu.magADC[ROLL] = X; imu.magADC[PITCH] = Y; imu.magADC[YAW] = Z;}

also tried this command

//#define SENSORS_TILT_45DEG_RIGHT // rotate the FRONT 45 degres clockwise
//#define SENSORS_TILT_45DEG_LEFT // rotate the FRONT 45 degres counterclockwise

and altered the 45 degrees to 90 degrees but this did not work either

i have no mag so did not need to define the mag statement, is there a way of doing a 90 degree board rotation ?

handsomejackuk
Posts: 97
Joined: Mon Sep 08, 2014 12:25 am

Re: 90 degrees board rotation

Post by handsomejackuk »

Anyone ?

Kbev5709
Posts: 451
Joined: Mon Aug 17, 2015 5:56 pm

Re: 90 degrees board rotation

Post by Kbev5709 »

handsomejackuk wrote:Anyone ?

If by 90 degrees you mean one quarter turn of the FC, did you try reversing the negatives AND the x and y. Or, did you try and make the positives negatives and the negatives positives?

You can always get it by trial and error. Hook up to your GUI or Conf. and move the craft around to see how it's doing.
- Make your drone left side up, right side down:
The curves of MAG_ROLL, ACC_ROLL and GYRO_ROLL will go up immediately.
The curves of MAG_Z and ACC_Z will go down immediately.

- Back up, front down:
The curves of MAG_PITCH, ACC_PITCH and GYRO_PITCH will go up immediately.
The curves of MAG_Z and ACC_Z will go down immediately.

- Rotate in clockwise direction:
The curve of GYRO_YAW will go up immediately.

- Keep your drone staying on the floor:
The values of MAG_Z and ACC_Z are both positive.

These are the moves that should happen when things are correct. Using the guide above you can make changes in the order of the force commands to get the results you want. You need to try stuff until you get it. As soon as you get one axis right the others will be easier. Lets say you do back up, front down. If your graph curves go down instead of up change the - sign position. If your roll is changing instead of pitch, you need to change things until only the pitch is affected by this movement. Etc. Etc.
Just moving the X and Y axis might not be what you need to do. The - signs are there and can be changed around as well.

handsomejackuk
Posts: 97
Joined: Mon Sep 08, 2014 12:25 am

Re: 90 degrees board rotation

Post by handsomejackuk »

i have not got a mag installed and dont wish to... i found it easier to turn the flight controller... i will do as you suggest when i have more time i know i spent about 2 days trying to sort out odd mag and acc behaviour when i built my first flight controller so just did the easy approach thanks for the answer...

Kbev5709
Posts: 451
Joined: Mon Aug 17, 2015 5:56 pm

Re: 90 degrees board rotation

Post by Kbev5709 »

handsomejackuk wrote:i have not got a mag installed and dont wish to... i found it easier to turn the flight controller... i will do as you suggest when i have more time i know i spent about 2 days trying to sort out odd mag and acc behaviour when i built my first flight controller so just did the easy approach thanks for the answer...


The mag info is only there because it was part of the copy and paste I did. Just ignore the mag movement info and try and make your roll and pitch work like the outline says. Also when it is sitting still the ACC should be +.

Quantanon
Posts: 3
Joined: Sat Jun 04, 2016 3:40 pm

Re: 90 degrees board rotation

Post by Quantanon »

Have same hiccup. Have you any progress on this ?

Post Reply