question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot set to AUTO mode ?

See original GitHub issue

Good 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:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tdardcommented, Apr 25, 2018

It worked, thank you.

Have a nice day !

0reactions
PGSK1234commented, Jul 18, 2021

Hi… I was able to set to “Guided Mode”… but unable to use command on the web host …any help is much appreciated image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scene can't set thermostat to Auto mode
My thermostat has the ability to automatically switch between the heat and cool modes. This is particularly helpful during the spring and ...
Read more >
Unable to change mode to "AUTO" - Rover 3.3 / 3.4
Everything seems alright in “manual” mode but I cannot make it to change mode to “auto” or “guided” (from QGC).
Read more >
Returning to Auto Mode - Medtronic Diabetes
Select Options. Select SmartGuard. Select Auto Mode to access the Auto Mode screen. Select Auto Mode again to turn Auto Mode on.
Read more >
Cannot set auto-commit mode when using distributed ...
org.apache.openjpa.persistence.PersistenceException : Cannot set auto-commit mode when using distributed transactions ; Provide github code plz.
Read more >
Not able to change auto to trunk mode on switch
You have to specifically set the encapsulation type first "switchport encapsulation dot1q" then try youir command... 35 Helpful. Share.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found