Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera: allow camera managed by an autopilot #11574

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

julianoes
Copy link
Contributor

@julianoes julianoes commented May 30, 2024

Description

By querying autopilot for the CAMERA_INFORMATION message, we allow an autopilot to be a proxy for a MAVLink or non-MAVLink camera.

The idea is similar to a gimbal manager implemented by an autopilot.

Test Steps

Test it with ArduPilot managing a camera. FYI @rmackay9.

Checklist:

Related Issue

mavlink/mavlink#2121

By querying autopilot for the CAMERA_INFORMATION message, we allow an
autopilot to be a proxy for a MAVLink or non-MAVLink camera.

The idea is similar to a gimbal manager implemented by an autopilot.
@@ -78,7 +78,8 @@ void QGCCameraManager::_vehicleReady(bool ready)
void QGCCameraManager::_mavlinkMessageReceived(const mavlink_message_t& message)
{
//-- Only pay attention to camera components, as identified by their compId
if(message.sysid == _vehicle->id() && (message.compid >= MAV_COMP_ID_CAMERA && message.compid <= MAV_COMP_ID_CAMERA6)) {
if(message.sysid == _vehicle->id() && (message.compid == MAV_COMP_ID_AUTOPILOT1 ||
(message.compid >= MAV_COMP_ID_CAMERA && message.compid <= MAV_COMP_ID_CAMERA6))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically the component ID for a mavlink camera can be ANYTHING except 0 (broadcast) and 1-6 (autopilot connected). We shouldn't be restricting against the MAV_COMP_ID_CAMERA - MAV_COMP_ID_CAMERA6 but instead against a MAV_TYPE of https://mavlink.io/en/messages/minimal.html#MAV_TYPE_CAMERA

I appreciate that is harder since you'd have to maintain the type vs component mappings somewhere, but if we were never going to do that, why did everyone (other than me) agree using the MAV_TYPE made sense?

If we are using this id (1-6) for anything, such as sending commands to a specific camera, then we presumably also need to make sure that any messages to that camera are either broadcast or addressed to the autopilot, and that the id of the message (if present) is also set.

Just a brain dump, you surely understand all this better than me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, correct, we could not filter it at all. It would mean traffic is increased to other components that unlikely have cameras attached.

MAV_TYPE would be nice but we only have one heartbeat sent out by the autopilot. Otherwise we'd have to send out duplicate heartbeats which would be an alternative to this implementation but it's unlikely to gain traction.

Those messages would just be addressed to the autopilot. The autopilot will then do whatever proxying is required, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants