def printPublishConfigurationResult(self):
        """Prints and potentially publishes the anchor configuration result in a human-readable way."""
        list_size = SingleRegister()

        self.pozyx.getDeviceListSize(list_size, self.remote_id)
        print("List size: {0}".format(list_size[0]))
        if list_size[0] != len(self.anchors):
            self.printPublishErrorCode("configuration")
            return
        device_list = DeviceList(list_size=list_size[0])
        self.pozyx.getDeviceIds(device_list, self.remote_id)
        print("Calibration result:")
        print("Anchors found: {0}".format(list_size[0]))
        print("Anchor IDs: ", device_list)

        for i in range(list_size[0]):
            anchor_coordinates = Coordinates()
            self.pozyx.getDeviceCoordinates(device_list[i], anchor_coordinates,
                                            self.remote_id)
            print("ANCHOR, 0x%0.4x, %s" %
                  (device_list[i], str(anchor_coordinates)))
            if self.osc_udp_client is not None:
                self.osc_udp_client.send_message("/anchor", [
                    device_list[i],
                    int(anchor_coordinates.x),
                    int(anchor_coordinates.y),
                    int(anchor_coordinates.z)
                ])
                sleep(0.025)
Beispiel #2
0
def get_device_list(pozyx):
    """"""
    device_list_size = SingleRegister()
    pozyx.getDeviceListSize(device_list_size)
    device_list = DeviceList(list_size=device_list_size[0])
    pozyx.getDeviceIds(device_list)
    return device_list
Beispiel #3
0
    def printPublishConfigurationResult(self):
        list_size = SingleRegister()

        status = self.pozyx.getDeviceListSize(list_size, self.remote_id)
        rospy.loginfo("List size: {0}".format(list_size[0]))
        if list_size[0] != len(self.anchors):
            self.printPublishErrorCode("configuration")
            return
        device_list = DeviceList(list_size=list_size[0])
        status = self.pozyx.getDeviceIds(device_list, self.remote_id)
        rospy.loginfo("Calibration result: ")
        rospy.loginfo("Anchors found: {0}".format(list_size[0]))
def all_device_coordinates_in_device_list(pozyx, remote_id=None):
    list_size = SingleRegister()
    status = pozyx.getDeviceListSize(list_size, remote_id=remote_id)

    if list_size.value == 0:
        return

    device_list = DeviceList(list_size=list_size.value)
    status &= pozyx.getDeviceIds(device_list, remote_id=remote_id)

    for device_id in device_list:
        coordinates = Coordinates()
        pozyx.getDeviceCoordinates(device_id, coordinates, remote_id=remote_id)
        yield DeviceCoordinates(device_id, 0, pos=coordinates)
Beispiel #5
0
 def DiscoverTags(self):
     status = self.pozyx.doDiscovery(PozyxConstants.DISCOVERY_TAGS_ONLY)
     self.CheckStatus(status)
     count = SingleRegister()
     status = self.pozyx.getDeviceListSize(count)
     self.CheckStatus(status)
     allIds = DeviceList(list_size=count.value)
     status = self.pozyx.getDeviceIds(allIds)
     self.CheckStatus(status)
     tagIds = list()
     for id in allIds:
         any = False
         for tagId in self.anchors:
             if tagId.network_id == id:
                 any = True
         if not any:
             tagIds.append(id)
     return tagIds
Beispiel #6
0
    def printPublishConfigurationResult(self):
        list_size = SingleRegister()

        self.pozyx.getDeviceListSize(list_size, self.remote_id)
        print("List size: {0}".format(list_size[0]))
        if list_size[0] != len(self.anchors):
            pass
            return
        device_list = DeviceList(list_size=list_size[0])
        self.pozyx.getDeviceIds(device_list, self.remote_id)
        print("Calibration result:")
        print("Anchors found: {0}".format(list_size[0]))
        print("Anchor IDs: ", device_list)

        for i in range(list_size[0]):
            anchor_coordinates = Coordinates()
            self.pozyx.getDeviceCoordinates(device_list[i], anchor_coordinates,
                                            self.remote_id)
            print("ANCHOR, 0x%0.4x, %s" %
                  (device_list[i], str(anchor_coordinates)))
Beispiel #7
0
    def printPublishConfigurationResultMore(self, remote_id):
        if not (remote_id is None):
            print("Pozyx ID: 0x%0.4x" % remote_id)
        list_size = SingleRegister()
        self.pozyx.getDeviceListSize(list_size, remote_id)
        print("List size: {0}".format(list_size[0]))
        if list_size[0] != len(self.anchors):
            self.printPublishErrorCode("configuration")
            return
        device_list = DeviceList(list_size=list_size[0])
        self.pozyx.getDeviceIds(device_list, remote_id)
        print("Calibration result:")
        print("Anchors found: {0}".format(list_size[0]))
        print("Anchor IDs: ", device_list)

        for i in range(list_size[0]):
            anchor_coordinates = Coordinates()
            self.pozyx.getDeviceCoordinates(device_list[i], anchor_coordinates,
                                            self.remote_id)
            print("ANCHOR, 0x%0.4x, %s" %
                  (device_list[i], str(anchor_coordinates)))
Beispiel #8
0
    def printConfig(self):
        # prints the anchor configuration result
        list_size = SingleRegister()

        # prints the anchors list size
        self.serial.getDeviceListSize(list_size, None)

        if list_size[0] != len(self.anchors):
            self.printError("configuration")
            return

        # prints the anchors list
        device_list = DeviceList(list_size=list_size[0])
        self.serial.getDeviceIds(device_list, None)

        print("Calibration result:")
        print("Anchors found: {0}".format(list_size[0]))
        print("Anchor IDs: ", device_list)

        for i in range(list_size[0]):
            anchor_coordinates = Coordinates()
            self.serial.getDeviceCoordinates(device_list[i], anchor_coordinates, None)
            print("ANCHOR: 0x%0.4x, %s" % (device_list[i], str(anchor_coordinates)))
            sleep(0.025)