mavlink / mavlink-devguide

MAVLink Developer Guide
http://mavlink.io
Other
110 stars 135 forks source link

Camera protocol - update with info about camera addressing and missions #517

Closed hamishwillee closed 1 month ago

hamishwillee commented 1 year ago

Work related to https://github.com/mavlink/mavlink/pull/2024

This documents the presence of the id parameter in the image command. I've tried to make it clear how addressing works both before and after, and in the command protocol and missions.

@julianoes @rmackay9 @Davidsastresas A couple of things popped up:

  1. MAVLink cameras send a HEARTBEAT with the camera type, which tells GCS that it should query for CAMERA_INFORMATION using MAV_CMD_REQUEST_MESSAGE. However an autopilot or onboard computer has its own component ID and type so what should trigger GCS to know it should query the onboard computer?

    The obvious answer is that a GCS could choose NOT to wait for heartbeats, but instead fire off MAV_CMD_REQUEST_MESSAGE for camera information to the system ID with component id = 0. Then all components that support cameras should fire back a response. I think this makes sense except:

    • Do we have to worry about multiple ACK?
    • Do we suggest no longer querying cameras individually.

    Alternatively we suggest that a GCS must also query the onboard computer and autopilot. This has the benefit that it is the same query process as currently. However it does mean that if some other component ends up managing a set of cameras we won't know to address it unless it outputs the heartbeat.

    Thoughts?

  2. Each proxied camera has a "camera id". So if I want to send a command to the non-mavlink camera attached to a companion computer, then I send the command to the companion with target address of the companion, and the camera's specific camera id. Similarly, if I want to send the command to a camera attached to the autopilot I an address it.

    However I think we missed the case of a mission command for a camera attached to an onboard computer.

    We can specify the id in a mission of 1-6 but this will be executed by the autopilot on ITS connected cameras. There is no way to say in a mission that you want the command to go to the onboard computer.

    Thoughts? Solutions?

  3. How can a system tell if the id is not supported? Do they need to be able to?

Davidsastresas commented 2 months ago
hamishwillee commented 1 month ago

@Davidsastresas FWIW re 2, the issue can't be addressed by the autopilot, because while it can potentially know that a companion computer has particular connected non-MAVLink cameras there is no way to know in a mission which one you want to send the command to.

Fortunately Julian made a suggestion which fixes this and 1. Agree with you on 3. Will post a summary next.

hamishwillee commented 1 month ago

Discussed this in 20240814-Dev-Meeting.

What we're going to do is make it very clear that only autopilots are allowed to proxy components. A companion computer or other component (except autopilot) that wants to support multiple hardware-connected cameras must emulate it as a MAVLink camera.

Note that the only reason we allow flight stacks to proxy is because they have prior art of connected cameras and they are "unable" to emulate mavlink cameras for them. There is no reason to extend this to companions.

FYI @julianoes says he's going to look into MAVSDK allowing support for multiple camera components on the same companion, so this will not necessarily even be onerous.

I'll update the docs next.

hamishwillee commented 1 month ago

@julianoes OK, I have updated to match https://github.com/mavlink/mavlink-devguide/pull/517#issuecomment-2290360512

Can you please sanity check?

hamishwillee commented 1 month ago

I believe that we now have a clear picture on camera discovery and addressing that also covers device-attached autopilots.

Nothing has changed for MAVLink cameras except that now specific cameras can be targeted in missions by specifying their component ID in the respective command's "Target camera id" parameter. Discovery and identity is done in exactly the same way.

We now allow autopilot-attached cameras. The origin of messages from these is identified by the value 1-6 in message camera_device_id field (0 for mavlink cameras). THese can be targeted in commands and missions using the id in the "Target camera id" parameter.

There is one change for discovery that is a GCS should query all autopilots for camera_information.

Further (just added), the command_ack should include the camera id of an attached camera in the result_param2. That would just be for information.

@julianoes et al, I'm going to merge this. I am happy it matches other discussions on this topic, and I am separated from it enough now to effectively subedit/review.