hi,
to make my FC (Flip Mega from readytoflyquads) fit in my plane, I've had to rotate it 90 degrees around the roll axis. The mag sensor is on the GPS board, so it's orientation remains flat. I fixed the new sensor orientations for GYRO and ACC via FORCE_[GYRO|ACC]_ORIENTATION (the plane flies great , but I can't get the heading info from the MAG right. Do I miss anything regarding board rotation?
problem with rotated FC but MAG still horizontal
-
- Posts: 31
- Joined: Tue Jun 25, 2013 1:41 pm
problem with rotated FC but MAG still horizontal
Last edited by schnupperm on Tue Jun 16, 2015 6:54 am, edited 1 time in total.
Re: problem with rotated FC but MAG still horizontal
Find the place in Sensors.cpp with the following:
and change SENSORS_TILT_45DEG_LEFT and SENSORS_TILT_45DEG_RIGHT to MAG_TILT_45DEG_LEFT and MAG_TILT_45DEG_RIGHT.
Then you should end up with your sensors tilted but not your external mag.
I have an external mag tilted 45 degrees right but my on-board sensors not tilted, so I #define MAG_TILT_45DEG_RIGHT in config.h
In your case you will not #define it so no tilt will be applied to your mag.
Code: Select all
#if defined(SENSORS_TILT_45DEG_LEFT)
int16_t temp = ((imu.magADC[PITCH] - imu.magADC[ROLL] )*7)/10;
imu.magADC[ROLL] = ((imu.magADC[ROLL] + imu.magADC[PITCH])*7)/10;
imu.magADC[PITCH] = temp;
#endif
#if defined(SENSORS_TILT_45DEG_RIGHT)
int16_t temp = ((imu.magADC[PITCH] + imu.magADC[ROLL] )*7)/10;
imu.magADC[ROLL] = ((imu.magADC[ROLL] - imu.magADC[PITCH])*7)/10;
imu.magADC[PITCH] = temp;
#endif
and change SENSORS_TILT_45DEG_LEFT and SENSORS_TILT_45DEG_RIGHT to MAG_TILT_45DEG_LEFT and MAG_TILT_45DEG_RIGHT.
Then you should end up with your sensors tilted but not your external mag.
I have an external mag tilted 45 degrees right but my on-board sensors not tilted, so I #define MAG_TILT_45DEG_RIGHT in config.h
In your case you will not #define it so no tilt will be applied to your mag.
-
- Posts: 31
- Joined: Tue Jun 25, 2013 1:41 pm
Re: problem with rotated FC but MAG still horizontal
for clarification: my FC is not rotated around the yaw axis, but the roll axis: from "_" to "|". Only the MAG on the GPS stays in the original orientation "_".
The code you quoted is for the special case of 45 degree rotation, so I think it would not help in my case.
The code you quoted is for the special case of 45 degree rotation, so I think it would not help in my case.