SOLVED: Copter MAV_CMD_NAV_TAKEOFF succeeds in Mission Planner but fails from code

Log

I have a copter that flies fine in Loiter and can be armed in Guided mode for an automatic takeoff from Mission Planner, but when I issue a MAV_CMD_NAV_TAKEOFF from code the takeoff command returns a failure result. I can’t figure out why. The last takeoff in this log file is an example. We have code that initiates a motor spin test and issues a takeoff command. From what I can tell in the log the takeoff commands are the same on the wire as issued from MP vs my code.

Similar to this comment, this system is using custom firmware, so reviewing certain params in mission planner might not line up with expectations. However, my main question is regarding feeback as to why Copter is ignoring certain takeoff commands and not others, as I can’t find any consistent smoking gun.
.
The ACE module present in the logs is a vision based landing system and occasionally says “Takeoff not ready” for various reasons, but the system will still fail to take off even without this message. It will consistently take off when commanded to do so in Mission Planner, by setting the system to guided mode, arming via a game pad, right-clicking the map menu, selecting Takeoff, and specifying an altitude.

I am aware of what looks like spurious vibrations when the system is resting on the ground and will investigate.

SOLVED

The DISARM_DELAY was set to 1 second. During our automated startup procedure, this would cause the craft to disarm before the launch command would be issued.