would like verify the behavior for heading hold through a magnetometer.
is positive heading in the clockwise direction like a compass heading and in the range of [-180,180]?
Code: Select all
int16_t dif = heading - magHold;
if (dif <= - 180) dif += 360;
if (dif >= + 180) dif -= 360;
rcCommand[YAW] += dif;
should the code for the yaw correction be
Code: Select all
rcCommand[YAW] -= dif;