Hello all,
i try to understand how maghold works. I don´t use Arduino IDE for Programming. I use Bascom on an Atxmega. My MAG is a CMPS10 I2C and i gives me values between 0 and 360.
My Question is:
For example the desired degrees are 0°. How does multiwii code prevent that the actual degrees jump to 360° ? My code use a PID to adjust a PWM. There is no Problem if the desired degrees are for example 100°. But if the desired degrees are 0° the PID Controller adjust the PWM so far that the actual degrees become for a little moment 360 - 355 °. So the Servo ( PWM ) turns on full rotation until the degrees are nearly 0°.
How Multiwii handles this ?
Kind Regards
Kay
How does maghold work ?
Re: How does maghold work ?
You subtract actual direction and wanted direction. Then you norm this to -180 to +180 by subtracting or adding 360. Aint too diffcult.
Nice sensor. Tilt compensated ...
Nice sensor. Tilt compensated ...