Auto-departure with course hold

Is there a way to automatically take off so that the copter holds the compass heading without using gps, I only need a YAW axis course, I have already implemented this using a lua script, but I wonder if it can be done with built-in functions

  1. It isn’t course hold but heading hold if you aren’t using position control
  2. It isn’t possible to do course hold without position information at least from optical flow
  3. Ardupilot either does navigation (with a position source) or it doesn’t (without a position source)
  4. You can use other sources of position than GPS but autonomous ones typically.provide inferior results outside of GPS denied environments

I only need to keep the compass heading, no location

Then Lua is your only option other than mofyging the code.

I understand you, thank you very much