Exemple #1
0
    def _write_positions_to_anchors(self):
        lopo = LoPoAnchor(self._helper.cf)

        for id, anchor_pos in self._anchor_pos_ui.items():
            if id in self._anchors:
                position = anchor_pos.get_position()
                lopo.set_position(id, position)
Exemple #2
0
    def osc_reboot(self, address, reboot_bootloader=False, **path_args):
        """
		Set the position of LPS nodes with IDs {nodes}.
		WARNING : Needs a connected drone.

		OSC listen: /{nodes}/reboot

		:param {nodes}: nodes ids separated by a ';'. * for all
		:type {nodes}: str.

		:param reboot_bootloader: default to False.\
			Either it should be rebooted in bootloader mode instead of firmware.
		:type reboot_bootloader: bool.
		:param y: the Y position.
		:type y: float.
		:param z: the Z position.
		:type z: float.
		"""

        node_id = int(path_args['node_id'])
        self._debug('rebooting node', node_id)
        _, drones = self.server.get_module('CRAZYFLIE').get_connected_drones()
        anchor = LoPoAnchor(drones[0]['cf'])
        anchor.reboot(
            node_id, LoPoAnchor.REBOOT_TO_BOOTLOADER
            if reboot_bootloader else LoPoAnchor.REBOOT_TO_FIRMWARE)
    def write_positions_to_anchors(self, anchor_positions):
        lopo = LoPoAnchor(self._helper.cf)

        for _ in range(3):
            for id, position in anchor_positions.items():
                lopo.set_position(id, position)
            time.sleep(0.2)
    def write_positions_to_anchors(self, anchor_positions):
        lopo = LoPoAnchor(self._helper.cf)

        for _ in range(3):
            for id, position in anchor_positions.items():
                lopo.set_position(id, position)
            time.sleep(0.2)
    def _write_positions_to_anchors(self):
        lopo = LoPoAnchor(self._helper.cf)

        for id, anchor_pos in self._anchor_pos_ui.items():
            if id in self._anchors:
                position = anchor_pos.get_position()
                lopo.set_position(id, position)
    def _reboot_thread(self):

        anchors = LoPoAnchor(self._cf)

        print('Sending reboot signal to all anchors 10 times in a row ...')
        for retry in range(10):
            for anchor_id in range(6):
                anchors.reboot(anchor_id, anchors.REBOOT_TO_BOOTLOADER)
                time.sleep(0.1)

        self._cf.close_link()
    def _reboot_thread(self):

        anchors = LoPoAnchor(self._cf)

        print('Sending reboot signal to all anchors 10 times in a row ...')
        for retry in range(10):
            for anchor_id in range(6):
                anchors.reboot(anchor_id, anchors.REBOOT_TO_BOOTLOADER)
                time.sleep(0.1)

        self._cf.close_link()
    def _send_anchor_mode(self):
        lopo = LoPoAnchor(self._helper.cf)

        # Set the mode from the last to the first anchor
        # In TDoA mode this ensures that the master anchor is set last
        for i in reversed(range(8)):
            if self._current_requested_mode == self.LOCO_MODE_TDOA:
                lopo.set_mode(i, lopo.MODE_TWR)
            elif self._current_requested_mode == self.LOCO_MODE_TWR:
                lopo.set_mode(i, lopo.MODE_TDOA)
            else:
                pass
Exemple #9
0
        def update_in_drone(
                self):  # The self arg is used because of the decorator only
            drones_ids, drones = zip(
                *self.server.get_module('CRAZYFLIE').get_connected_drones())

            anchor = LoPoAnchor(drones[0]['cf'])
            anchor.set_position(node_id, (x, y, z))

            crazyflie_module = self.server.get_module('CRAZYFLIE')
            for drone_id in drones_ids:
                crazyflie_module.osc_update_lps_pos('',
                                                    drones=drone_id,
                                                    nodes=node_id)
    def _send_anchor_mode(self, mode):
        lopo = LoPoAnchor(self._helper.cf)

        mode_translation = {
            self.LOCO_MODE_TWR: lopo.MODE_TWR,
            self.LOCO_MODE_TDOA2: lopo.MODE_TDOA,
            self.LOCO_MODE_TDOA3: lopo.MODE_TDOA3,
        }

        # Set the mode from the last to the first anchor
        # In TDoA 2 mode this ensures that the master anchor is set last
        # Note: We only switch mode of anchor 0 - 7 since this is what is
        # supported in TWR and TDoA 2
        for j in range(5):
            for i in reversed(range(8)):
                lopo.set_mode(i, mode_translation[mode])
    def _send_anchor_mode(self, mode):
        lopo = LoPoAnchor(self._helper.cf)

        mode_translation = {
            self.LOCO_MODE_TWR: lopo.MODE_TWR,
            self.LOCO_MODE_TDOA2: lopo.MODE_TDOA,
            self.LOCO_MODE_TDOA3: lopo.MODE_TDOA3,
        }

        # Set the mode from the last to the first anchor
        # In TDoA 2 mode this ensures that the master anchor is set last
        # Note: We only switch mode of anchor 0 - 7 since this is what is
        # supported in TWR and TDoA 2
        for j in range(5):
            for i in reversed(range(8)):
                lopo.set_mode(i, mode_translation[mode])
    def _send_anchor_mode(self):
        lopo = LoPoAnchor(self._helper.cf)

        # Set the mode from the last to the first anchor
        # In TDoA mode this ensures that the master anchor is set last
        for i in reversed(range(8)):
            if self._current_requested_mode == self.LOCO_MODE_TDOA:
                lopo.set_mode(i, lopo.MODE_TWR)
            elif self._current_requested_mode == self.LOCO_MODE_TWR:
                lopo.set_mode(i, lopo.MODE_TDOA)
            else:
                pass