Problem with roll and pitch

Hi everyone, we are a university team and are trying to create a custom flight mode.
For this aim, we copied the code for Althold inside the Acro mode (following the instructions in the link http://ardupilot.org/dev/docs/apmcopter-adding-a-new-flight-mode.html ).
The problem is that, now that we have uploaded the new firmware, when we use this flight mode, the roll stick modify the pitch value (es. the roll to the left correspond to an effective pitch above). It seems like the commands are rotated of 90 degrees, but this situation happens only with the modified flight mode.
Besides, from the Mission Planner the commands sent from the radio controller seem correct. We use a Pixhawk 2, the drone is the DJI F450 and the radio controller is the Taranis X9D Plus.
I hope that the situation is well explained and that you can help us with some ideas about that problem.

Thank you all!