Hi,
I am having some problems on using pymavlink for controlling the rov thrusters.
I have read the documentations on the ardusub web and found the function set_rc_channel_pwm being useful for the channel control.
However, the thrusters won’t keep working until the the command, for example set_rc_channel_pwm((5, 1550)) be put in a while loop. If it doesn’t, it will only work for once.
The target of my project is to do some positioning control, where the pwm signals sent to each channel may change according to the position calculation. And the vehicle needs to keep running while doing these calculation. My question is that if there are any other functions or solutions that the thrusters could keep working without being written in the while loop.
Here is the code I finished according to the pymavlink:
Thank you in advance!
if __name__ == "__main__":
print('setting flight mode')
change_mode("MANUAL")
print('Start clearing motion')
clear_motion()
time.sleep(1)
arm()
# wait until arming confirmed (can manually check with master.motors_armed())
print("Waiting for the vehicle to arm")
master.motors_armed_wait()
print('Armed!')
set_rc_channel_pwm(5, 1550) # The thruster only worked for once
while True:
set_rc_channel_pwm(5, 1550) # The thrusters keep working but in a while loop