Problems with copter using pixhawk 2 cube

My problems.

1 - Altitude of GPS and Sonar, never show the real, when on the ground, times the GPS altitude is negative, and sometimes the value is high near 5000, so when I take off and I turn RTL it goes up and not to e does not respect the value of 15 meters difinido for altitude.
2 - I feel that it is accelerating and decelerating in the air, it does not stabilize, in LOITER mode when accelerating and taking your hands off the control it does not stay in the same place times goes up and down times.
3 - The battery always marks 100% when turning the power on and off, even if it is 30% off when the power is turned off and back on to 100%.
4 - Below is the link with photos of my drone and equipment used, along with the logs taken from the card.

https://drive.google.com/open?id=1aRik3Mm2czFdksWTuIvPsAbjeTZCecFr

AVictor,

I don’t own a sonar so I cannot help on issues 1/2 unfortunately.

Issue 3 is not really an issue though. The flight controller assumes your battery has 100% of the capacity you specify in the battery parameter everytime it boots up (as you describe) because there is no way it can know if your battery is full or not. Between shutting down and booting up there could be minutes, days years. You could have left the same battery in, you could have replaced it with a new full one or an empty on, but the FC has no way of knowing anything of that.

The only theoretical solution I am aware of is to use a smart battery that has an integrated battery management system which keeps track of charge level. Those BMS basically stay powered all the time (or write charge state to nio-volatile memory) and therefor retain charge state between FC reboots. I am not aware of purchaseable smart batteries on the market for ardupilot use though.

I work around this by having a timer on my radio and setting the timer to the full available flight time when I put in new battery and then the timer counts down while I am flying and stops counting as soon as throttle on the radio is zero. So my radio keeps track for me of “available time” even if the FC get’s rebooted in between. Only works of course if you don’t switch off the radio also…

Hope somebody else can help in issue 1/2.