Skip to content
Snippets Groups Projects
Commit 59219930 authored by Arnaud Taffanel's avatar Arnaud Taffanel
Browse files

Closes #65: Implement support for setting LPS anchor mode

parent 88d91300
No related branches found
No related tags found
No related merge requests found
...@@ -30,10 +30,14 @@ import struct ...@@ -30,10 +30,14 @@ import struct
class LoPoAnchor(): class LoPoAnchor():
LPP_TYPE_POSITION = 1 LPP_TYPE_POSITION = 1
LPP_TYPE_REBOOT = 2 LPP_TYPE_REBOOT = 2
LPP_TYPE_MODE = 3
REBOOT_TO_BOOTLOADER = 0 REBOOT_TO_BOOTLOADER = 0
REBOOT_TO_FIRMWARE = 1 REBOOT_TO_FIRMWARE = 1
MODE_TWR = 1
MODE_TDOA = 2
def __init__(self, crazyflie): def __init__(self, crazyflie):
""" """
:param crazyflie: A crazyflie object to be used as a bridge to the LoPo :param crazyflie: A crazyflie object to be used as a bridge to the LoPo
...@@ -57,3 +61,11 @@ class LoPoAnchor(): ...@@ -57,3 +61,11 @@ class LoPoAnchor():
def reboot(self, anchor_id, mode): def reboot(self, anchor_id, mode):
data = struct.pack('<BB', LoPoAnchor.LPP_TYPE_REBOOT, mode) data = struct.pack('<BB', LoPoAnchor.LPP_TYPE_REBOOT, mode)
self.crazyflie.loc.send_short_lpp_packet(anchor_id, data) self.crazyflie.loc.send_short_lpp_packet(anchor_id, data)
def set_mode(self, anchor_id, mode):
"""
Send a packet to set the anchor mode. If the anchor receive the packet,
it will change mode and resets.
"""
data = struct.pack('<BB', LoPoAnchor.LPP_TYPE_MODE, mode)
self.crazyflie.loc.send_short_lpp_packet(anchor_id, data)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment