Cannot set to AUTO mode ?
See original GitHub issueGood Morning Ladies & Gentlemen,
I have some troubles setting my simulated vehicle in AUTO mode, while I have no problem to change it in another one. Here is the code:
# Import DroneKit-Python
from dronekit import connect, VehicleMode, LocationGlobal, Command
import time
import pymavlink.mavutil as mavutil
#For SITL
import dronekit_sitl
sitl = dronekit_sitl.start_default()
connection_string = sitl.connection_string()
vehicle = connect(connection_string, wait_ready = True)
#To change its mode, the vehicle must be armed
while not vehicle.is_armable:
print " Waiting for vehicle to initialise..."
time.sleep(1)
print "\nSet Vehicle.armed=True (currently: %s)" % vehicle.armed
vehicle.armed = True
while not vehicle.armed:
print " Waiting for arming..."
time.sleep(1)
print " Vehicle is armed: %s" % vehicle.armed
print "\nSet Vehicle.mode = AUTO (currently: %s)" % vehicle.mode.name
vehicle.mode = VehicleMode('AUTO')
while vehicle.mode.name != 'AUTO':
print " Waiting for changing mode"
time.sleep(1)
print "Mode: %s" % vehicle.mode.name
Here is what I obtain in the Linux Ubuntu shell:
Starting copter simulator (SITL)
SITL already Downloaded and Extracted.
Ready to boot.
>>> APM:Copter V3.3 (d6053245)
>>> Frame: QUAD
>>> Calibrating barometer
>>> Initialising APM...
>>> barometer calibration complete
>>> GROUND START
Waiting for vehicle to initialise...
Waiting for vehicle to initialise...
Waiting for vehicle to initialise...
Waiting for vehicle to initialise...
Waiting for vehicle to initialise...
Set Vehicle.armed=True (currently: False)
Waiting for arming...
Waiting for arming...
Waiting for arming...
Waiting for arming...
>>> ARMING MOTORS
>>> GROUND START
Waiting for arming...
>>> Link timeout, no heartbeat in last 5 seconds
>>> ...link restored.
>>> Initialising APM...
Vehicle is armed: True
Set Vehicle.mode = AUTO (currently: STABILIZE)
Waiting for changing mode
Waiting for changing mode
Waiting for changing mode
Waiting for changing mode
Waiting for changing mode
Waiting for changing mode
Waiting for changing mode
Waiting for changing mode
Waiting for changing mode
>>> DISARMING MOTORS
Waiting for changing mode
Waiting for changing mode
When I decide to stop the program (with Ctrl + C), here is the issue that I obtain:
^CTraceback (most recent call last):
File "test_auto_mode.py", line 42, in <module>
time.sleep(1)
KeyboardInterrupt
Do you have any idea to what happens, and how could I fix it ?
It seems that the simulated copter cannot be set in AUTO mode (despite it is one of its available modes in theory), and because it takes too much time to switch mode (in facts, the issue shows it is almost certain an infinite loop), it becomes disarmed. But I don’t know why it cannot be changed.
I already know that I could use GUIDED mode + refreshing waypoints, but I would like to use the AUTO mode anyway.
Thank you,
Tristan
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
It worked, thank you.
Have a nice day !
Hi… I was able to set to “Guided Mode”… but unable to use command on the web host …any help is much appreciated