Is there a way to control the mission path of a drone with a program using mavros in auto mode?

Hi. In the ardupilot auto mode, the route specified is to be changed to avoid obstacles.
However, ardupilot does not seem to be controlled by a program using mavros in auto mode.
How do I get control?

Change mode to GUIDED in mavros, go around the obstacle using MavROS, and set mode to AUTO again.

thank you for telling me.