Help " chaning the autopilot orientation during flight "

hi everyone
im working using px4 V5 nano on quadcopter
we want to change the orientation of the autopilot during the flight
we need it to be in level after having more than 45d pitch
the drone will change its orientation so it will fly vertically 90d pitch but the autopilot will consider the front now is down

Are you using PX4 firmware or Ardupilot?
If PX4 then head over to https://discuss.px4.io/

Are you in an Acro mode?

If Ardupilot then please upload a .bin log to a filesharing site like Dropbox or Onedrive
and share the link to it here.

I want the quadcopter to take off while it is in autopilot mode and go a certain distance, then give an angle at the pitch value and go away. How can I do this?