IMU different orientation with the same roll and pitch

Hi Guys,

I’m using a Pixhawk4 as a navigation controller
I have a problem taking into consideration the pitch and roll of the pixhawk or in that manner any IMU.
As far I understand the pitch and roll rotation occurs relative to the pixhawk axes.

I did a test in cad software.
I took a box and first rotated it around its center for pitch and then the same rotation around its center for roll. I then took another box and did the opposite. First, roll rotation… and then pitch.

All rotations were around the center of the box along its own symmetrical axes.

I got 2 different orientations.

As when I implement the second rotation I already did it around a rotated coordinated system.
So each test resulted in a different orientation.

Can someone shed some light regarding how pixhawk’s IMU calculates the pitch and roll? And Relative to what?