Acceleration data in estimated body coordinate frame

How would be possible to get acceleration data in the body frame coordinate system, aligned regarding to estimated ATTITUDE message (Arduplane 4.3.x)?

My goal is to remove gravity from acceleration data, where gravity can be estimated from ATTITUDE data. At the moment, I am using SCALED_IMU message to get raw IMU data, but the problem is that it is not aligned with the estimated coordinate system which is receiving with ATTITUDE message. Is there any chance to align acceleration data with ATTITUDE orientation? For example, when autopilot is still, there is some difference between them (due to calibration I guess). And also while moving, estimated ATTITUDE can fall behind a little in comparison to frame and therefore SCALED_IMU/RAW_IMU data is not aligned with it in that case.