Skip to content

COMMAND_INT: frame is ignored for altitude — DO_SET_ROI_LOCATION always treats z as AMSL #28257

Description

@DonLakeFlyer

Describe the bug

MavlinkReceiver::handle_message_command_int() uses the frame field of COMMAND_INT only to select x/y integer scaling (1e4 for local frames vs 1e7 for global), then discards it. The altitude is copied verbatim (vcmd.param7 = cmd_mavlink.z) with no frame-based conversion, and the internal vehicle_command_s has no frame field, so downstream consumers cannot recover it.

For MAV_CMD_DO_SET_ROI_LOCATION, Commander/navigator then treat param7 as AMSL unconditionally. A command sent in MAV_FRAME_GLOBAL_RELATIVE_ALT is silently misinterpreted: the relative altitude is applied as absolute. PX4 neither converts nor NACKs the unsupported frame.

Per the MAVLink COMMAND_INT spec, frame applies to x/y/z, so this is a spec non-compliance.

To Reproduce

  1. Send COMMAND_INT with MAV_CMD_DO_SET_ROI_LOCATION, frame = MAV_FRAME_GLOBAL_RELATIVE_ALT, z = 50 (intending 50 m above home).
  2. Command is ACCEPTED; gimbal aims at 50 m AMSL instead of home+50 m.

Expected behavior

Either convert relative/terrain altitudes to AMSL at ingest (plumbing the frame through vehicle_command_s or converting in mavlink_receiver.cpp), or reject unsupported frames with MAV_RESULT_DENIED instead of silently misreading the altitude.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-triageAuto-assigned to new issues and removed after maintainers review it and assign the specific label.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions