I’ve had at least one report of someone’s quadcopter based on Phoebe’s code just flipping onto it’s head at takeoff. I couldn’t really help as I’d not seen such symptoms – until the other day that it.
I have no idea why the flip doesn’t happen each and every time on Phoebe, and does for others; my apologies to those whose quad suffered the problem and I was unable to help.
Anyway, the fix is to replace your version of calibrateGyros() with this one:
def calibrateGyros(self): gx_offset = 0.0 gy_offset = 0.0 gz_offset = 0.0 for iteration in range(0, self.__CALIBRATION_ITERATIONS): [ax, ay, az, gx, gy, gz] = self.readSensors() gx_offset += gx gy_offset += gy gz_offset += gz self.gx_offset = gx_offset / self.__CALIBRATION_ITERATIONS self.gy_offset = gy_offset / self.__CALIBRATION_ITERATIONS self.gz_offset = gz_offset / self.__CALIBRATION_ITERATIONS
Let me know via the comments if this solves your problem too.