# T2000 thruster control using Mavlink and Python

**URL:** <https://discuss.bluerobotics.com/t/t2000-thruster-control-using-mavlink-and-python/21290>\
**Category:** Blue Robotics Software\
**Tags:** ardusub, pymavlink\
**Created:** [August 10, 2025, 3:30pm UTC](https://discuss.bluerobotics.com/t/t2000-thruster-control-using-mavlink-and-python/21290 "2025-08-10T15:30:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![radwan](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@radwan](https://discuss.bluerobotics.com/u/radwan)\
**Post date:** [August 10, 2025, 3:30pm UTC](https://discuss.bluerobotics.com/t/t2000-thruster-control-using-mavlink-and-python/21290/1 "2025-08-10T15:30:07Z")

</div>

Hi,

I am using Python code to control the individual thrusters of our AUV. It has 8 thrusters, 4 vertical and 4 horizontal. How can I control the thrusters manually 1 by 1, using Python code?

Also, if there is any other way to control, please mention it. I have tried several approaches, and I have also used some code I found in this community, but none of them have worked.

This is the code I was using:

```python
from pymavlink import mavutil
import time

# Connect to Pixhawk
print(“[INFO] Connecting to Pixhawk…”)
master = mavutil.mavlink_connection(‘udpin:0.0.0.0:14550’)
master.wait_heartbeat()
print(f"[INFO] Connected to system {master.target_system}, component {master.target_component}")

# Set mode to MANUAL
mode_mapping = master.mode_mapping()
if ‘MANUAL’ not in mode_mapping:
    raise Exception("\[ERROR\] MANUAL mode not available in mode mapping.")
mode_id = mode_mapping[‘MANUAL’]
master.set_mode(mode_id)
print(“[INFO] Set to MANUAL mode.”)
time.sleep(1)

# Arm the vehicle
print(“[INFO] Arming the vehicle…”)
master.arducopter_arm()
master.motors_armed_wait()
print(“[SUCCESS] Vehicle armed.”)

# RC override array: 8 channels + 10 spares
rc_override = [1500] * 8 + [65535] * 10

# Apply forward thrust – adjust channels based on your config
# Assuming Thrusters 5 and 6 (MAIN OUT 5 and 6) = index 4 and 5
rc_override[1] = 1550 # Forward thrust
# rc_override[2] = 1550
# rc_override[2] = 1700
# rc_override[3] = 1700

print(“[ACTION] Rolling for 5 seconds…”)
start_time = time.time()
while time.time() - start_time < 8:
    master.mav.rc_channels_override_send(
        master.target_system,
        master.target_component,
        *rc_override
    )
    time.sleep(0.1)

# # Stop motion

# rc_override[4] = 1500
# rc_override[5] = 1500
# master.mav.rc_channels_override_send(
# master.target_system,
# master.target_component,
# *rc_override
# )
# print(“[INFO] Motion stopped.”)

# Disarm the vehicle
print(“[INFO] Disarming the vehicle…”)
master.arducopter_disarm()
master.motors_disarmed_wait()
print(“[SUCCESS] Vehicle disarmed. Done.”)

```

WHEN I RUN THIS CODE, ALL THE VERTICAL THRUSTERS RUNS ONLY.

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/18385_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [August 10, 2025, 6:01pm UTC](https://discuss.bluerobotics.com/t/t2000-thruster-control-using-mavlink-and-python/21290/2 "2025-08-10T18:01:21Z")

</div>

Hi @radwan

Ardusub does not support actuating individual thrusters like this! You can simulate user control input via higher level commands, like going up or forward, but not running each motor individually… sorry for the news! There are some “hacky” [workarounds](https://discuss.bluerobotics.com/t/how-to-control-thrusters-independently/9870/11), that I would not recommend trying…. searching the forum is always a good first step!

---

<div class="post-metadata">

**Author:** ![radwan](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@radwan](https://discuss.bluerobotics.com/u/radwan)\
**Post date:** [August 11, 2025, 2:57pm UTC](https://discuss.bluerobotics.com/t/t2000-thruster-control-using-mavlink-and-python/21290/3 "2025-08-11T14:57:12Z")

</div>

Thank you.

---

<div class="post-metadata">

**Author:** ![radwan](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@radwan](https://discuss.bluerobotics.com/u/radwan)\
**Post date:** [August 11, 2025, 3:50pm UTC](https://discuss.bluerobotics.com/t/t2000-thruster-control-using-mavlink-and-python/21290/4 "2025-08-11T15:50:08Z")

</div>

Anyway can you please help me with the AUV movement? Like basic movements: Forwards, Backward, Left, Right.

Should I control all these movements using the rc\_override = \_\_\_ ?

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/18385_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [August 12, 2025, 4:31pm UTC](https://discuss.bluerobotics.com/t/t2000-thruster-control-using-mavlink-and-python/21290/5 "2025-08-12T16:31:22Z")

</div>

> [@tony-white](#):
>
> workarounds

Hi @radwan  
Yes, that’s correct - you command overall vehicle motion with the appropriate RC\_Override commands. Can you share more about your goals for control? A lua script may be a good solution, or something with pymavlink as you’re doing…

---

<div class="post-metadata">

**Author:** ![radwan](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@radwan](https://discuss.bluerobotics.com/u/radwan)\
**Post date:** [August 15, 2025, 4:15pm UTC](https://discuss.bluerobotics.com/t/t2000-thruster-control-using-mavlink-and-python/21290/6 "2025-08-15T16:15:36Z")

</div>

Sorry for the late reply. So I was doing some unit testing like diving, going forward, then coming back to the surface. Here are some demo:  
```  
print(“[ACTION] 1. Diving DOWN for 4 seconds.”)

set\_neutral()

rc\_override[0] = 1430

rc\_override[1] = 1430

# rc\_override[2] = 1350

# rc\_override[3] = 1350

start\_time = time.time()

while time.time() - start\_time \< 4:

```auto
send_rc_override()

time.sleep(0.1)

```

``  
```  
print(“[ACTION] 3. Moving forward for 10 seconds at 1600 PWM…”)

set\_neutral()

rc\_override[4] = 1600

rc\_override[2] = 1520

start\_time = time.time()

while time.time() - start\_time \< 30:

```auto
send_rc_override()

time.sleep(0.1)

```

```

But the issue I am facing is that it’s moving randomly. Can you give some ideas? I am using 8 thursters, 4 horizontally 45 degree angle placed, and 4 vertical.  
``  
`I am using the Bar30 pressure sensor, Pixhawk’s internal sensors.`  
```

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/18385_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [August 15, 2025, 5:23pm UTC](https://discuss.bluerobotics.com/t/t2000-thruster-control-using-mavlink-and-python/21290/7 "2025-08-15T17:23:24Z")

</div>

Hi @radwan -

What mode is the vehicle in? If in Manual, it won’t automatically try to hold heading, and so can move a bit randomly without user input compensation. You may also need to calibrate your motion sensors?

---

<div class="post-metadata">

**Author:** ![radwan](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@radwan](https://discuss.bluerobotics.com/u/radwan)\
**Post date:** [August 15, 2025, 5:24pm UTC](https://discuss.bluerobotics.com/t/t2000-thruster-control-using-mavlink-and-python/21290/8 "2025-08-15T17:24:11Z")

</div>

This is my full code:  
`  
from pymavlink import mavutil

import time

# -----------------------------

# Connect to Pixhawk

# -----------------------------

print(“[INFO] Connecting to Pixhawk…”)

master = mavutil.mavlink\_connection(‘udpin:0.0.0.0:14550’)

master.wait\_heartbeat()

print(f"[INFO] Connected to system {master.target\_system}, component {master.target\_component}")

# -----------------------------

# Set mode to MANUAL

# -----------------------------

print(“[INFO] Setting mode to STABILIZE…”)

mode\_mapping = master.mode\_mapping()

mode\_id = mode\_mapping[‘STABILIZE’] # Change to STABILIZE for better control

master.set\_mode(mode\_id)

print(“[SUCCESS] Mode set to STABILIZE”)

time.sleep(2)

# -----------------------------

# Arm the vehicle

# -----------------------------

print(“[INFO] Arming the vehicle…”)

master.arducopter\_arm()

master.motors\_armed\_wait()

print(“[SUCCESS] Vehicle armed.”)

# -----------------------------

# RC override: 8 channels + 10 unused

# -----------------------------

rc\_override = [1500] \* 8 + [65535] \* 10

def send\_rc\_override():

```
"""Send the current RC override values"""

master.mav.rc_channels_override_send(

    master.target_system,

    master.target_component,

    \*rc_override

)

```

def set\_neutral():

```
"""Set all channels to neutral position"""

for i in range(8):

    rc_override\[i\] = 1500

```

# -----------------------------

# MISSION SEQUENCE START

# -----------------------------

# 1. DIVING (DOWN) for 3s at 1700 PWM

print(“[ACTION] 1. Diving DOWN for 4 seconds.”)

set\_neutral()

rc\_override[0] = 1430

rc\_override[1] = 1430

# rc\_override[2] = 1350

# rc\_override[3] = 1350

start\_time = time.time()

while time.time() - start\_time \< 4:

```
send_rc_override()

time.sleep(0.1)

```

# 2. REMAIN IDLE for 2s

print(“[ACTION] 2. Remaining idle for 2 seconds…”)

set\_neutral()

start\_time = time.time()

while time.time() - start\_time \< 1:

```
send_rc_override()

time.sleep(0.1)

```

# 3. FORWARD for 5s at 1600 PWM

print(“[ACTION] 3. Moving forward for 10 seconds at 1600 PWM…”)

set\_neutral()

rc\_override[4] = 1600

rc\_override[2] = 1520

start\_time = time.time()

while time.time() - start\_time \< 30:

```
send_rc_override()

time.sleep(0.1)

```

# 4. REMAIN IDLE for 2s

print(“[ACTION] 4. Remaining idle for 2 seconds…”)

set\_neutral()

start\_time = time.time()

while time.time() - start\_time \< 2:

```
send_rc_override()

time.sleep(0.1)

```

# -----------------------------

# MISSION COMPLETE - STOP ALL MOTION

# -----------------------------

print(“[INFO] Mission sequence complete. Stopping all motion…”)

set\_neutral()

send\_rc\_override()

# Clear RC override

rc\_override = [65535] \* 18

send\_rc\_override()

print(“[INFO] RC override cleared.”)

# -----------------------------

# Disarm the vehicle

# -----------------------------

print(“[INFO] Disarming the vehicle…”)

master.arducopter\_disarm()

master.motors\_disarmed\_wait()

print(“[SUCCESS] Vehicle disarmed. Mission complete.”)

# Close connection

master.close()

print(“[INFO] Connection closed.”)  
`
