from pymavlink import mavutil
from time import sleep
from time import time as TM
from datetime import datetime as dt
pixhawk = mavutil.mavlink_connection('udpin:192.168.2.1:14550')
pixhawk.wait_heartbeat()
print("heartbeat found!")
def pwm_gonder(channel_id, pwm=1500):
rc_channel_values = [65535 for _ in range(18)]
rc_channel_values[channel_id - 1] = pwm
pixhawk.mav.rc_channels_override_send(
pixhawk.target_system,
pixhawk.target_component,
*rc_channel_values)
pixhawk.arducopter_arm()
def on_saniye():
endtime = TM()+5
while TM() < endtime:
pwm_gonder(3,1100)
endtime = TM()+5
print("Test11")
while TM() < endtime:
pwm_gonder(3,1200)
endtime = TM()+5
print("Test12")
while TM() < endtime:
pwm_gonder(3,1300)
endtime = TM()+5
print("Test13")
while TM() < endtime:
pwm_gonder(3,1400)
endtime = TM()+5
print("Test14")
while TM() < endtime:
pwm_gonder(3,1500)
endtime = TM()+5
print("Test15")
while TM() < endtime:
pwm_gonder(3,1600)
endtime = TM()+5
print("Test16")
while TM() < endtime:
pwm_gonder(3,1700)
endtime = TM()+5
print("Test17")
while TM() < endtime:
pwm_gonder(3,1800)
endtime = TM()+5
print("Test18")
while TM() < endtime:
pwm_gonder(3,1900)
endtime = TM()+5
on_saniye()
pixhawk.arducopter_disarm()
I am trying to run my T200 thrusters with pymavlink code. But I am having trouble with thruster speeds.
My Setup
I am using an adapter to give 12V to the Thruster.
Using Windows10 computer, Raspi3b as companion comp.Px4 as autopilot.
A single thruster is connected to mainpin5 on the servo rail.
ardusub firmware latest version (upgraded recently)
I have the basic ESC from bluerobotics. Wires are correctly connected.
Qgroundcontrol can use the thrusters perfectly – Both directions and all speed configs, all 6 motors at once and also with joystick. So I don’t believe power is the problem. It seems that my code has some problem. Any solutions?
Expected behaviour and what happened instead
I started by sending 1100 pwm for 5 seconds and then increased the pwm signal to 1900 – with 5 seconds increments. I was expecting it to start fast in reverse direction, slow down and stop at 1500 and begin speeding up the other way until it reahed 1900.
Instead at 1100 the thrusters didn’t rotate at all, at 1200 the thruster began to spin slowly, 1300 and 1400 had a significant increase in speed (same direction as before), at 1500 the T200 didn’t stop and increased speed even more. From 1500 onwards the thruster speed was relatively stable and still very high. At 1900 the thruster disarmed and the test was over.
Other Tests
I sent a 1500 signal for 10 seconds. The thruster -instead of doing nothing- spun significantly fast.
I tried sending a 1900 pwm signal that gradually dampened to 1500, the motor speed started high and stayed that way.