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

Incoming Mavlink telemetry affects outgoing telemetry rate #8132

Closed
RomanLut opened this issue Jun 17, 2022 · 3 comments · Fixed by #8274
Closed

Incoming Mavlink telemetry affects outgoing telemetry rate #8132

RomanLut opened this issue Jun 17, 2022 · 3 comments · Fixed by #8274

Comments

@RomanLut
Copy link
Contributor

RomanLut commented Jun 17, 2022

Mavlink RC command have been implemented recently: #6738 👏

It allows to use single UART for RC and telemetry ✔️

Unfortunately RC_CHANNELS_OVERRIDE can not be sent with rate comparable to SBUS because incoming telemetry messages affect outgoing telemetry rate ❌

At 50 Hz, outgoing telemetry is not emited at all.

telemetry\mavlink.h:

#define TELEMETRY_MAVLINK_MAXRATE       50
#define TELEMETRY_MAVLINK_DELAY         ((1000 * 1000) / TELEMETRY_MAVLINK_MAXRATE)


    // If we did serve data on incoming request - skip next scheduled messages batch to avoid link clogging
    if (processMAVLinkIncomingTelemetry()) {
        incomingRequestServed = true;
    }

    if ((currentTimeUs - lastMavlinkMessage) >= TELEMETRY_MAVLINK_DELAY) {
        // Only process scheduled data if we didn't serve any incoming request this cycle
        if (!incomingRequestServed) {
            processMAVLinkTelemetry(currentTimeUs);
        }
        lastMavlinkMessage = currentTimeUs;
        incomingRequestServed = false;
    }

I gues code above was added to support half-duplex links.

I would like to fix this and do a PR, but first I would like to discuss how to handle this problem.

I see the following solutions:

  1. Remove incomingRequestServed flag completely.
  2. Add a setting mavlink_half_duplex default true. If set to false, incomingRequestServed will be disabled.
  3. let RC_CHANNELS_OVERRIDE not affect incomingRequestServed flag.

Which solution would be appropriate?

@RomanLut
Copy link
Contributor Author

RomanLut commented Jul 5, 2022

Ok I rephrase: which pull request will be accepted? 😃

@payor-ma
Copy link

payor-ma commented Jul 7, 2022

Based on a quick search of github the mavlink_maxrate seems to come from cleanflight and has been carried on since then. Seems like a bit of a hack that worked in the context of it being used for mostly unidirectional telemetry and not being fully utilised in cleanflight.

@RomanLut
Copy link
Contributor Author

Ok, there is "Receiver protocol half-duplex" box in configuratior:

image

It can be used to set mavlink protocol half/full duplex if RC protocol is "Mavlink".

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