# Why did I fail to change flight mode like this?

**URL:** <https://discuss.bluerobotics.com/t/why-did-i-fail-to-change-flight-mode-like-this/11858>\
**Category:** Blue Robotics Products\
**Tags:** ardusub, pymavlink\
**Created:** [March 31, 2022, 6:13pm UTC](https://discuss.bluerobotics.com/t/why-did-i-fail-to-change-flight-mode-like-this/11858 "2022-03-31T18:13:18Z")\
**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:** [March 31, 2022, 6:52pm UTC](https://discuss.bluerobotics.com/t/why-did-i-fail-to-change-flight-mode-like-this/11858/2 "2022-03-31T18:52:57Z")

</div>

Hi @robotmark, welcome to the forum 🙂

Your code seems to `disarm` the vehicle right after you set depth hold mode, so even if the mode change is successful the thrusters would then turn off immediately when the vehicle is disarmed.

You also seem to try to make the same mavlink connection in multiple files, which may cause issues.

> [@Pymavlink Send\_RC issue](https://discuss.bluerobotics.com/t/pymavlink-send-rc-issue/11302/2):
>
> Note also the various failsafes that are built in. MAVLink connections expect to receive a heartbeat message at least every second (if not received the communication may be stopped), and when you’re controlling the vehicle it’s subject to the [heartbeat failsafe](https://www.ardusub.com/reference/ardusub/safety-setup-page.html#gcs-ground-control-station-heartbeat), and rc override commands are subject to the [pilot input failsafe](https://www.ardusub.com/reference/ardusub/safety-setup-page.html#pilot-input) and to [`RC_OVERRIDE_TIME`](https://www.ardusub.com/developers/full-parameter-list.html#rcoverridetime-rc-override-timeout).

* * *

In future, I would recommend you post code in code blocks, so that it’s easier to read and test with. You can learn more about that in the [How to Use the Blue Robotics Forums](https://discuss.bluerobotics.com/t/how-to-use-the-blue-robotics-forums-please-read/10521) post 🙂

---

_[View the full topic](https://discuss.bluerobotics.com/t/why-did-i-fail-to-change-flight-mode-like-this/11858)._
