The reference frame for the altitude parameter for the MAV_CMD_NAV_LOITER_UNLIM command is not clear in the documentation. Does it depend on MAV_FRAME or is it relative to ground, absolute?
It depends on the frame.
If you say it depends on the Frame, as per Waypoint MAV_FRAME or POSITION_TARGET_GLOBAL_INT. I have seen differences.
Each waypoint can be in different mav frame. For example one waypoint can be in relative alt and next one can be global.
What differences exactly?
Thank you. I was referring to differences in the coordinate frames between MAV_FRAME as reported by the waypoints stored in the flight controller vs. coordinate frame as reporte by POSTION_TARGET_GLOBAL_INT
Target is always AMSL.
Thanks. I made the necessary change and will test with next flight.
I pull the current MSL altitude from Mavlink POSITION_GLOBAL_INT and pass that to the flight controller using MAV_CMD_NAV_LOITER_UNLIM. The drone will hold coordinates but desend.
When I pass 0 for the altitude parameter in MAV_CMD_NAV_LOITER_UNLIM, then the drone still desend. The Arducopter documentation states: Target altitude. If zero, the vehicle will loiter at the current altitude.
The Mavlink message ALTITUDE (#141) is not recognized by the flight controller. I see no other place to pull AMSL and I am not sure if MSL is any different. Right now I need to assume it is either different or there is a bug in the ArduCopter 4.x.x flight controller firmware, since it is not holding when I pass a 0 value for altitude.
I send the instruction using a COMMAND_LONG. The flight controller receive it without error and the drone has been tested being in both auto and guided modes. Behavior is the same.
Do you have a log for that flight?