LOCAL_POSITION_NED's z position and other mavlink altitude messages didn't reset to zero after being armed

I’m trying to use ROS to control my quadcopter movement in GUIDED mode. The positional data seem to be working correctly except for the altitude or z position value sent through mavlink. After constantly decreasing while disarmed, the altitude value in the status tab on Mission Planner resets to near zero every time the quadcopter is being armed, however this is not reflected on the altitude value sent by mavlink messages, such as LOCAL_POSITION_NED’s z position, GLOBAL_POSITION_INT’s alt value, and so on.

Below is a timeseries graph of LOCAL_POSITION_NED’s z position. Note that the quadcopter was stationary during these times.


My quadcopter is using a Pixhawk Cube Orange FC with the Copter-4.4.2 Firmware, and a T265 VIO for xy positional data, and a rangefinder for z positional data. Here are the parameters that I used:

212023.param (17.3 KB)

Any help would be appreciated.

Nevermind, guys. It turns out the altitude was drifting because of a MavProxy command that sets the EKF origin that I sent. After setting the EKF origin manually, it seems that the barometer driver updates the altitude calibration repeatedly and causing the altitude to drifts.

Not sending the set EKF origin command removes the drifting the behavior, and the mavlink altitude related messages resets to zero after the quadcopter was armed.