Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
689aa22
commit 9f6572a
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
from __future__ import print_function | ||
|
||
from dronekit import connect | ||
import time | ||
|
||
# Set up option parsing to get connection string | ||
import argparse | ||
parser = argparse.ArgumentParser(description='Reboots vehicle') | ||
parser.add_argument('--connect', | ||
help="Vehicle connection target string. If not specified, SITL automatically started and used.") | ||
args = parser.parse_args() | ||
|
||
connection_string = args.connect | ||
sitl = None | ||
|
||
|
||
# Start SITL if no connection string specified | ||
if not connection_string: | ||
import dronekit_sitl | ||
sitl = dronekit_sitl.start_default() | ||
connection_string = sitl.connection_string() | ||
|
||
|
||
# Connect to the Vehicle | ||
print('Connecting to vehicle on: %s' % connection_string) | ||
vehicle = connect(connection_string, wait_ready=True) | ||
|
||
vehicle.reboot() | ||
time.sleep(1) | ||
|
||
# Shut down simulator if it was started. | ||
if sitl: | ||
sitl.stop() |