You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DKPY2: Exiting script does not send last command and may report exception #325
I've updated simple_goto.py (see branch tmp_getting_started_dkpy2 which will be merged in #320).
The last action in the script is RTL:
print "Returning to Launch"
vehicle.mode = VehicleMode("RTL")
vehicle.flush()
However the RTL does not occur (the command is probably not sent - certainly the MAVProxy prompt was still reporting "guided".
I ran this a few times. In one case I got an exception reported:
Altitude: 18.9200000763
Reached target altitude
Going to first point...
Going to second point...
Returning to Launch
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
E:\deleteme\dronekit-python\examples\simple_goto>
Is there any way to ensure that the last command is fully completed (ie flush completes) before the thread exits?
Otherwise, what is the best way to deal with this? I'd prefer not to add documentation that scripts should wait a second before completing.
@tcr3dr I added vehicle.close() to end of simple_goto.py. The last sent RTL now completes, but I still get exception.
Last few lines of simple_goto.py:
# sleep so we can see the change in map
time.sleep(20)
print "Returning to Launch"
vehicle.mode = VehicleMode("RTL")
vehicle.flush()
#Close vehicle object before exiting script
print "\nClose vehicle object"
vehicle.close()
Output is:
Returning to Launch
Close vehicle object
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Activity
tcr3dr commentedon Oct 14, 2015
We need an explicit
vehicle.close()command. This also addresses the "how do you properly terminate a script?" question.hamishwillee commentedon Oct 15, 2015
Looks like that went in - see #347. Needs to be documented (#348. )
hamishwillee commentedon Oct 15, 2015
@tcr3dr I added
vehicle.close()to end of simple_goto.py. The last sent RTL now completes, but I still get exception.Last few lines of simple_goto.py:
Output is:
tcr3dr commentedon Nov 7, 2015
@hamishwillee Can you check that this issue still occurs on rc8?
hamishwillee commentedon Nov 9, 2015
I can't replicate now after two or three tries. Lets "hope" this is fixed. Closing.