View Single Post
Old Nov 19, 2012, 04:50 PM
shufflez is offline
Find More Posts by shufflez
Registered User
The Netherlands, NH, Amsterdam
Joined Mar 2008
136 Posts
Quote:
Originally Posted by whiteturbo View Post
...Yep everthing is shifted 90 degrees anti clockwise(i think?) but i cant find any option to move it back. Im useless with changing the orientation code...
EDIT: Sorry, I was confusing your problem with someone else's who has they sensors upside down! The below is actually also somewhat true for your problem, but with 90 deg rotation (instead of inverting) you do(!) have to change ROLL to PITCH and vise versa and you might not have to change the values from neg to pos

If you have a look at def.h in your sketch (I assumed for the sake of it that the board below is actually the sensorboard you have), you'll find the 'normal' sensor orientation below. So let's say you've inverted the board, whilst keeping front pointing forward.
ACC measures roll on negative Y, GYRO measures roll on negative X. So two axes for different sensors, but as they are still the same place on the board, it'll still measure the same axis, but the wrong way up/round (or so I believe ).

If you'd put a dot on the right lower corner of the top-side of a cube, and you'd rotate the cube so top becomes bottom, the dot would be on the lower left of bottom. Or at least that is my way of thinking about sensor orientation.

That would mean roll axis would be positive now your board is upside down. Pitch would be negative for ACC, positive for Gyro. Yaw (Z value for both) would be negative on ACC, positive on gyro...

Please back-up your original code and test/verify in GUI before flight!!!

Code:
#if defined(DROTEK_6DOFv2)
  #define ITG3200
  #define BMA180
  #define ACC_ORIENTATION(X, Y, Z) {accADC[ROLL]  = -Y; accADC[PITCH]  =  X; accADC[YAW]  =  Z;}
  #define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] = -X; gyroADC[PITCH] = -Y; gyroADC[YAW] = -Z;}
  #define ITG3200_ADDRESS 0X69
#endif
shufflez is offline Find More Posts by shufflez
Last edited by shufflez; Nov 20, 2012 at 02:21 AM.
Reply With Quote