We are using depth hold mode while testing using a wifi connection.
import time
from pymavlink import mavutil
mavutil.set_dialect("ardupilotmega")
autopilot = mavutil.mavlink_connection('/dev/ttyACM0')
msg = None
# wait for autopilot connection
while msg is None:
msg = autopilot.recv_msg()
#print msg
# The values of these heartbeat fields is not really important here
# I just used the same numbers that QGC uses
# It is standard practice for any system communicating via mavlink emit the HEARTBEAT message at 1Hz! Your autopilot may not behave the way you want otherwise!
autopilot.mav.heartbeat_send(
6, # type
8, # autopilot
192, # base_mode
0, # custom_mode
4, # system_status
3 # mavlink_version
)
autopilot.mav.command_long_send(
1, # autopilot system id
1, # autopilot component id
400, # command id, ARM/DISARM
0, # confirmation
1, # arm!
0,0,0,0,0,0 # unused parameters for this command
)
print 'this is arm'
autopilot.mav.manual_control_send(1, 0, 0, -50, 0, 0)
print 'this is down'
time.sleep(2)
#autopilot.set_mode(2)
#print 'Alt HOld'
autopilot.mav.command_long_send(1,1,176,0,2,0,0,0,0,0,0)
print 'Alt HOld'
time.sleep(2)
autopilot.mav.command_long_send(
1, # autopilot system id
1, # autopilot component id
400, # command id, ARM/DISARM
0, # confirmation
0, # disarm!
0,0,0,0,0,0 # unused parameters for this command
)
print 'disarm'
#time.sleep(1)
autopilot.mav.command_long_send(
1, # autopilot system id
1, # autopilot component id
400, # command id, ARM/DISARM
0, # confirmation
1, # arm!
0,0,0,0,0,0 # unused parameters for this command
)
print 'this is arm 2'
t=8
while(t):
autopilot.mav.manual_control_send(1, 2000, 0, 500, 0, 0)
print 'this is forward'
time.sleep(2)
t=t-1
autopilot.mav.manual_control_send(1, 0, 1500, 500, 0, 0)
print 'sway'
autopilot.mav.command_long_send(
1, # autopilot system id
1, # autopilot component id
400, # command id, ARM/DISARM
0, # confirmation
0, # disarm!
0,0,0,0,0,0 # unused parameters for this command
)
print 'disarm'
the bot performs the depth hold mode and after giving a command the bot performs the command and gets disarmed
We cannot use more than one command after going into depth hold.
please revert as soon as possible