QuadCopter behaving abnormally

Hello all ,
I made my quadcopter with Pixhawk 2.4.8 , I was flying well. Wanting to take it to the next step , I added Raspberry as onboard computer to control the drone.( I control the Raspberry through SSH connection ), The python script checks for all the prearm conditions , once they are satisfied the drone will be armed and taken to a height of 10 meters , it stays there for 10 seconds and then lands. The above has been done multiple times and everything went well.

The last time I tried doing it ,only one motor spinned { (let’s call it motor X) } they rest of them didn’t and I wasn’t able to disarm the drone too(even after pressing the hardware safety switch on the drone). So we resorted to disconnecting the power supply to stop the motor from spinning , We were confused why that happened , but nevertheless we continued forward in the process, The second time when we tried running the same script , something very strange happened. This time except the motor X, all three were spinning at full speed and the drone flipped over , but all the 3 motors continued spinning, To stop the motors spinning we had to disconnect the battery while the motors with props are spining at full speed!. We am not sure what really happened. The drone has been calibrated fine(both axle and compass) everything was similar to the previous good flight, (I mean all the parameters , settings of drone , weather condition , the place we flew the drone etc), There are even no much interferences present in the area too.

Below is the link of all the log files {all_log_files - Google Drive}. hoping to get some help on what really happned and what has to be done to prevent this kind of things from happening again.

Thank you

You can take a look at: When Problems Arise — Copter documentation

But it is usually one of two Problems:

  1. Not correctly tuned vehicle. You should use GitHub - ArduPilot/MethodicConfigurator: A clear ArduPilot configuration sequence and follow ALL instructions
  2. Hardware defect

I have followed all those insctructions @amilcarlucas sir , they are fine , I even calibrated it again.