-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INTEGRATION] prepare 7.6.0-rc1 release
Change-Id: I3e37f6f0d5582af6bb8ce3f71cc1b10deea52f80 Reviewed-on: https://gerrit-doc.parrot.biz/c/drones/sdk/olympe/+/204949 Reviewed-by: Nicolas Dessart <nicolas.dessart@parrot.com>
- Loading branch information
Showing
14 changed files
with
1,280 additions
and
399 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
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
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
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,63 @@ | ||
import os | ||
|
||
import olympe | ||
from olympe.messages.drone_manager import connection_state | ||
from olympe.messages import network | ||
from olympe.enums.network import LinkType, LinkStatus | ||
|
||
|
||
olympe.log.update_config({"loggers": {"olympe": {"level": "WARNING"}}}) | ||
|
||
SKYCTRL_IP = os.environ.get("SKYCTRL_IP", "192.168.53.1") | ||
|
||
|
||
def test_cellular(): | ||
""" | ||
This script allows to pair in cellular a SkyController and a Drone previously paired together in wifi. | ||
""" | ||
|
||
print("Test of cellular pairing") | ||
|
||
# Create a skycontroller | ||
skyctrl = olympe.SkyController(SKYCTRL_IP) | ||
# Connect to skycontroller | ||
assert skyctrl.connect() | ||
print("- SkyController connected") | ||
|
||
# Wait for the skycontroller and the drone to be connected | ||
skyctrl(connection_state(state="connected")).wait() | ||
print("- Drone connected") | ||
|
||
# Get the cellular link status before pairing | ||
assert skyctrl(network.Command.GetState() >> network.Event.State()).wait().success() | ||
links = skyctrl.get_state(network.Event.State)["links_status"]["links"] | ||
cellular_link = next( | ||
filter(lambda link: link["type"] == LinkType.LINK_TYPE_CELLULAR, links), None | ||
) | ||
print(f" cellular link status: {cellular_link['status']}") | ||
# Should be different from LinkStatus.running | ||
|
||
# Pair the SkyController and the Drone in cellular | ||
print("- Cellular pairing of the SkyController and the Drone") | ||
assert skyctrl.cellular.pair() | ||
|
||
print("- Waiting for cellular link to be running") | ||
|
||
# Wait for cellular link status pass to Link Status.running | ||
while cellular_link["status"] != LinkStatus.running: | ||
skyctrl(network.Event.State(_policy="wait")) | ||
links = skyctrl.get_state(network.Event.State)["links_status"]["links"] | ||
cellular_link = next( | ||
filter(lambda link: link["type"] == LinkType.LINK_TYPE_CELLULAR, links), | ||
None, | ||
) | ||
|
||
# Log cellular link status | ||
print(f" cellular link status: {cellular_link['status']}") | ||
|
||
# Disconnect the skycontroller | ||
skyctrl.disconnect() | ||
print("- SkyController disconnected") | ||
|
||
if __name__ == "__main__": | ||
test_cellular() |
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
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
Oops, something went wrong.