Input inversion after guided mode

Dear all,

We tried to test step response on roll axis of test multicopter.
We use Copter-4.0.4 and companion computer (Raspberry Pi4).

First, I set flight mode to Alt_Hold.
When RCIN9 is set under 1500, Pi4 changes to Guided mode and stars sending target roll angle using vehicle.message_factory.set_attitude_target_encode, functon of dronekit.
And when RCIN9 is set over 1500, Pi4 changes the last mode (i.e. Alt_Hold).
We use this sequence to test step resphonse
Also we added 1kg weight changing mount position.
Therefore, the test multicopter tended to vibrate when tilted.

When we changed Guided mode to the last mode, DesRoll and DesPitch sometimes turned in the opposite direction of RCIN1 and RCIN2.

This Figure shows ROLL angle and RCIN1.

Before Guided mode, DesRoll is same direction of RCIN1.

After Guided mode, DesRoll is opposite direction of RCIN1.

And pitch direction acts same.

Before Guided mode:

After Guided mode:

https://drive.google.com/file/d/1y8mfDESvziL9HozXVjbnfosU3irZo5TU/view?usp=sharing

Is there anyone who has had such a phenomenon?

What is the cause?

Thank you.