# Pymavlink RC Command Issue

**URL:** <https://discuss.bluerobotics.com/t/pymavlink-rc-command-issue/10609>\
**Category:** General Discussion\
**Tags:** pymavlink\
**Created:** [September 15, 2021, 6:32am UTC](https://discuss.bluerobotics.com/t/pymavlink-rc-command-issue/10609 "2021-09-15T06:32:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [September 15, 2021, 12:43pm UTC](https://discuss.bluerobotics.com/t/pymavlink-rc-command-issue/10609/2 "2021-09-15T12:43:36Z")

</div>

Hi @Sena,

As per our [pymavlink docs](https://www.ardusub.com/developers/pymavlink.html#safety):

> All system components that communicate via MAVLink are expected to send a HEARTBEAT message at a constant rate of at least 1 Hz. If the autopilot does not receive a heartbeat from your application after this interval, it will trigger a [failsafe](https://www.ardusub.com/operators-manual/failsafes.html).

There’s some more info about how to deal with that around the forum - there’s a recent example at the bottom of [this comment](https://discuss.bluerobotics.com/t/regarding-pwm-signal-delays-setting-target-depth-type-masks-and-ned-system-setting-target-attitude-heartbeat-message/10492/3):

> [@Regarding: pwm signal delays, setting target depth, type\_masks and NED system, setting target attitude, heartbeat message](https://discuss.bluerobotics.com/t/regarding-pwm-signal-delays-setting-target-depth-type-masks-and-ned-system-setting-target-attitude-heartbeat-message/10492/3):
>
> - I’ve submitted a pull request to pymavlink for a background-thread-based approach [here](https://github.com/ArduPilot/pymavlink/pull/577) which hasn’t yet been accepted, and may not end up being. It does work however, so you’re welcome to use it if you want, but I’d suggest you read the discussion there to better understand when to use that over a synchronous/in-line approach. (Note that you’ll need to change the type parameter to GCS if you’re simulating a ground control station, as in @monsterbacke’s snippet)
> - For a synchronous approach you can instead use the [`periodic_event`](https://github.com/ArduPilot/pymavlink/blob/master/mavutil.py#L1737-L1758) class from mavutil
> - It’s technically also possible to disable the [heartbeat failsafe](https://www.ardusub.com/reference/ardusub/safety-setup-page.html#gcs-ground-control-station-heartbeat) instead of sending a heartbeat, but it’s not recommended to do that because you could end up not being able to turn off your AUV even after losing contact with the control computer

As a more general note, I’d recommend starting with simple bits of code and working your way up to the functionality you actually want. The snippet you provided has some formatting/indentation issues, but also has three while loops that are reliant on a variable that doesn’t change anywhere in the code, which makes it unnecessarily confusing to understand.

When posting examples that you want help with, try to simplify the code down to the simplest example you can that replicates the issue 🙂

---

_[View the full topic](https://discuss.bluerobotics.com/t/pymavlink-rc-command-issue/10609)._
