Esempio n. 1
0
def main():
    
    serial_port = get_first_pozyx_serial_port()
    if serial_port is None:
        print("No Pozyx connected. Check your USB cable or your driver!")
        quit()
    remote_id = 0x1234                 # remote device network ID
    remote = False                     # whether to use a remote device
    if not remote:
        remote_id = None
    use_processing = True              # enable to send position data through OSC
    ip = "127.0.0.1"                   # IP for the OSC UDP
    network_port = 8888                # network port for the OSC UDP
    osc_udp_client = None
    if use_processing:
        osc_udp_client = SimpleUDPClient(ip, network_port)
    anchors = [DeviceCoordinates(0x6E2A, 1, Coordinates(0, 0, 3175)),
               DeviceCoordinates(0x6E0E, 1, Coordinates(0, 4114, 3175)),
               DeviceCoordinates(0x697F, 1, Coordinates(3429, 0, 3175)),
               DeviceCoordinates(0x6E6F, 1, Coordinates(3429, 4114, 3175))]
    algorithm = POZYX_POS_ALG_UWB_ONLY  # positioning algorithm to use
    dimension = POZYX_3D                # positioning dimension
    height = 1000 # height of device, required in 2.5D positioning
    
    pozyx = PozyxSerial(serial_port)
    r = ReadyToLocalize(pozyx, osc_udp_client, anchors, algorithm, dimension, height, remote_id)
    r.setup()
    while 1:
        r.loop()
        if not GPIO.input(buttonPin):
            in_use()
        maintenance = format_time()
        data = {"ID": Id, "X": x, "Y": y, "InUse": inUse, "Maintenance": maintenance}
        firebase.post('/Ventilator', data)
        time.sleep(5)
Esempio n. 2
0
 def __init__(self):
     self.host = '0.0.0.0'
     self.port = 8080
     self.numLeds = 0
     self.Anchors = [
         DeviceCoordinates(0x6971, 1, Coordinates(3790, 4200, 730)),
         DeviceCoordinates(0x6E41, 1, Coordinates(4650, 11400, 500)),
         DeviceCoordinates(0x6E3A, 1, Coordinates(320, 900, 1300)),
         DeviceCoordinates(0x6960, 1, Coordinates(1900, 10950, 450))
     ]
     self.dht = False
Esempio n. 3
0
    def __init__(self, anchors):

        self.serial_port = get_first_pozyx_serial_port()
        print(self.serial_port)
        if self.serial_port is None:
            print("No Pozyx connected. Check your USB cable or your driver!")

        self.pozyx = PozyxSerial(self.serial_port)
        #print(self.serial_port)

        if (anchors.get('count') == 4):

            self.anchors = [
                DeviceCoordinates(
                    0x6110, 1,
                    Coordinates(
                        anchors.get('0x6110')[0],
                        anchors.get('0x6110')[1],
                        anchors.get('0x6110')[2])),
                DeviceCoordinates(
                    0x6115, 1,
                    Coordinates(
                        anchors.get('0x6115')[0],
                        anchors.get('0x6115')[1],
                        anchors.get('0x6115')[2])),
                DeviceCoordinates(
                    0x6117, 1,
                    Coordinates(
                        anchors.get('0x6117')[0],
                        anchors.get('0x6117')[1],
                        anchors.get('0x6117')[2])),
                DeviceCoordinates(
                    0x611e, 1,
                    Coordinates(
                        anchors.get('0x611e')[0],
                        anchors.get('0x611e')[1],
                        anchors.get('0x611e')[2]))
            ]

        self.algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
        self.dimension = PozyxConstants.DIMENSION_3D
        self.height = 1000

        #self.pub = rospy.Publisher('/mavros/mocap/pose', PoseStamped, queue_size=10)
        self.pub = rospy.Publisher('/pose', PoseStamped, queue_size=10)
        self.pose = PoseStamped()

        self.subZ = rospy.Subscriber('range', Int16, self.rangeCallback)
Esempio n. 4
0
    def __init__(self):
        super().__init__("range_debugger")
        self.range_pub = self.create_publisher(String, "range", 10)
        self.position_pub = self.create_publisher(Odometry, "odometry/pozyx",
                                                  1000)
        self.markers_pub = self.create_publisher(MarkerArray,
                                                 "odometry/pozyx/markers", 10)
        # serial port setting
        serial_port = "/dev/ttyACM0"
        seiral_port = get_first_pozyx_serial_port()
        if serial_port is None:
            print("No Pozyx connected. CHeck your USB cable or your driver!")
            quit()

        self.pozyx = PozyxSerial(serial_port)

        # remote and destination
        # But sorry, just 1 tag is useable.
        # "None" is setting for use USB-connected tag, "0xXX"(tag id) is to use remote tag.
        self.tag_ids = [None]  # TODO: To use multiple tags

        self.ranging_protocol = PozyxConstants.RANGE_PROTOCOL_PRECISION
        self.range_timer_ = self.create_timer(0.02, self.range_callback)

        self.anchors = [
            # DeviceCoordinates(0x605b, 1, Coordinates(   0, 0, 0)),  # test
            # DeviceCoordinates(0x603b, 1, Coordinates( 800, 0, 0)),  # test
            DeviceCoordinates(0x6023, 1, Coordinates(-13563, -8838,
                                                     475)),  # ROOM
            DeviceCoordinates(0x6e23, 1, Coordinates(-3327, -8849,
                                                     475)),  # ROOM
            DeviceCoordinates(0x6e49, 1, Coordinates(-3077, -2959,
                                                     475)),  # ROOM
            # DeviceCoordinates(0x6e58, 1, Coordinates( -7238, -3510, 475)),  # ROOM
            DeviceCoordinates(0x6050, 1, Coordinates(-9214, -9102,
                                                     475)),  # ROOM
        ]

        self.algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
        self.dimension = PozyxConstants.DIMENSION_2D
        self.height = 475

        self.setup()
Esempio n. 5
0
    def __init__(self):
        self.x = 0.0
        self.y = 0.0
        self.z = 0.0
        self.roll = 0.0
        self.pitch = 0.0
        self.yaw = 0.0
        self.remote_id = None

        self.tag_ids = [None, 0xA001, 0xA002, 0xA003]
        # self.tag_ids = [None, 0x671a, 0x676e]

        # BARIBARILAB
        #self.anchors = [DeviceCoordinates(0x6714, 1, Coordinates(0, 0, 1500)),
        #                DeviceCoordinates(0x6711, 1, Coordinates(785, 2900, 1200)),
        #                DeviceCoordinates(0x6717, 1, Coordinates(5416, 3670, 2000)),
        #                DeviceCoordinates(0x675b, 1, Coordinates(5000, 0, 1800)),
        #                DeviceCoordinates(0x6743, 1, Coordinates(3140, 4252, 900)),
        #                DeviceCoordinates(0x671b, 1, Coordinates(6050, 1400, 1000))]

        # ETRI EMBEDDED LAB
        self.anchors = [
            DeviceCoordinates(0x6714, 1, Coordinates(0, 0, 2500)),
            DeviceCoordinates(0x6711, 1, Coordinates(1400, 4650, 1500)),
            DeviceCoordinates(0x6717, 1, Coordinates(5600, 4600, 1950)),
            DeviceCoordinates(0x675b, 1, Coordinates(6000, 0, 2000)),
            DeviceCoordinates(0x6743, 1, Coordinates(4000, 6050, 2650)),
            DeviceCoordinates(0x671b, 1, Coordinates(6950, 1500, 900))
        ]
    def setAnchorsManual(self):
        ''' config anchor'''
        status = self.pozyx.clearDevices()
        for temp_anchor in self.anchors:
            anchor = temp_anchor[1:len(temp_anchor) - 1].split(",")
            pozyx_anchor = DeviceCoordinates(
                int(anchor[0], 16), 1,
                Coordinates(int(anchor[1]), int(anchor[2]), int(anchor[3])))
            status &= self.pozyx.addDevice(pozyx_anchor)
            self.anchor_list.append(pozyx_anchor)

        if len(self.anchors) > 4:
            status &= self.pozyx.setSelectionOfAnchors(POZYX_ANCHOR_SEL_AUTO,
                                                       len(self.anchors))
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)
Esempio n. 8
0
    def __init__(self, anchors):

        self.anchors = [DeviceCoordinates()]
        self.anchors = anchors

        self.port = get_first_pozyx_serial_port()
        if self.port is None:
            self.error = "No Pozyx connected"
            return

        self.pozyx = PozyxSerial(self.port)
        networkId = NetworkID()
        status = self.pozyx.getNetworkId(networkId)
        self.id = networkId.id
        self.CheckStatus(status)
        self.ConfigureAnchor(self.id)
Esempio n. 9
0
def read_calibration_file(filepath):
    anchors = []
    try:
        calibration_file = open(filepath)
    except IOError:
        rospy.logerror("File {} can't be opened".format(filepath))
        quit()
    else:
        with calibration_file:
            csv_reader = csv.reader(calibration_file,
                                    delimiter=';',
                                    quotechar='"')
            row_0 = csv_reader.next()
            for row in csv_reader:  #id;hexId;x;y;z;
                id, hexId, x, y, z = row[:5]
                anchors.append(
                    DeviceCoordinates(int(id), 1,
                                      Coordinates(int(x), int(y), int(z))))
    return anchors
        print("No Pozyx connected. Check your USB cable or your driver!")
        quit()

    # enable to send position data through OSC
    use_processing = False

    # configure if you want to route OSC to outside your localhost. Networking knowledge is required.
    ip = "127.0.0.1"
    network_port = 8888

    # IDs of the tags to position, add None to position the local tag as well.
    tag_ids = [0x671a, 0x676e]

    # necessary data for calibration
    anchors = [
        DeviceCoordinates(0x6714, 1, Coordinates(0, 0, 1500)),
        DeviceCoordinates(0x6711, 1, Coordinates(785, 2900, 1200)),
        DeviceCoordinates(0x6717, 1, Coordinates(5416, 3670, 2000)),
        DeviceCoordinates(0x675b, 1, Coordinates(5000, 0, 1800)),
        DeviceCoordinates(0x6743, 1, Coordinates(3140, 4252, 900)),
        DeviceCoordinates(0x671b, 1, Coordinates(6050, 1400, 1000))
    ]

    # positioning algorithm to use, other is PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    #algorithm = PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    # positioning dimension. Others are PozyxConstants.DIMENSION_2D, PozyxConstants.DIMENSION_2_5D
    dimension = PozyxConstants.DIMENSION_3D
    # height of device, required in 2.5D positioning
    height = 1000
        quit()

    remote_id = 0x6069  # remote device network ID
    remote = False  # whether to use a remote device
    if not remote:
        remote_id = None

    use_processing = True  # enable to send position data through OSC
    ip = "127.0.0.1"  # IP for the OSC UDP
    network_port = 8888  # network port for the OSC UDP
    osc_udp_client = None
    if use_processing:
        osc_udp_client = SimpleUDPClient(ip, network_port)
    # necessary data for calibration, change the IDs and coordinates yourself
    anchors = [
        DeviceCoordinates(0xA001, 1, Coordinates(0, 0, 2790)),
        DeviceCoordinates(0xA002, 1, Coordinates(10490, 0, 2790)),
        DeviceCoordinates(0xA003, 1, Coordinates(-405, 6000, 2790)),
        DeviceCoordinates(0xA004, 1, Coordinates(10490, 6500, 2790))
    ]

    algorithm = POZYX_POS_ALG_UWB_ONLY  # positioning algorithm to use
    dimension = POZYX_3D  # positioning dimension
    height = 1000  # height of device, required in 2.5D positioning

    pozyx = PozyxSerial(serial_port)
    r = ReadyToLocalize(pozyx, osc_udp_client, anchors, algorithm, dimension,
                        height, remote_id)
    r.setup()
    while True:
        r.loop()
Esempio n. 12
0
    if not remote:
        remote_id = None

    # enable to send position data through OSC
    use_processing = True

    # configure if you want to route OSC to outside your localhost. Networking knowledge is required.
    ip = "127.0.0.1"
    network_port = 8888

    osc_udp_client = None
    if use_processing:
        osc_udp_client = SimpleUDPClient(ip, network_port)

    # necessary data for calibration, change the IDs and coordinates yourself according to your measurement
    anchors = [DeviceCoordinates(0x6140, 1, Coordinates(0, 0, 250)),
               DeviceCoordinates(0x6112, 1, Coordinates(2750, 0, 2150)),
               DeviceCoordinates(0x6114, 1, Coordinates(0, 3350, 1430)),
               DeviceCoordinates(0x611d, 1, Coordinates(2800, 3150, 2270))]

    # positioning algorithm to use, other is PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    # positioning dimension. Others are PozyxConstants.DIMENSION_2D, PozyxConstants.DIMENSION_2_5D
    dimension = PozyxConstants.DIMENSION_3D
    # height of device, required in 2.5D positioning
    height = 0

    pozyx = PozyxSerial(serial_port)
    r = ReadyToLocalize(pozyx, osc_udp_client, anchors, algorithm, dimension, height, remote_id)
    print(r)
    r.setup()
Esempio n. 13
0
    remote_id = 0x6977  # remote device network ID
    remote = False  # whether to use a remote device
    if not remote:
        remote_id = None

    use_processing = True  # enable to send position data through OSC
    ip = "127.0.0.1"  # IP for the OSC UDP
    network_port = 8888  # network port for the OSC UDP
    osc_udp_client = None

    if use_processing:
        osc_udp_client = SimpleUDPClient(ip, network_port)
    # necessary data for calibration, change the IDs and coordinates yourself
    anchors = [
        DeviceCoordinates(0x6e07, 1, Coordinates(0, 0, -1200)),
        DeviceCoordinates(0x6e51, 1, Coordinates(4780, 0, -1200)),
        DeviceCoordinates(0x6e5e, 1, Coordinates(0, 4070, -1200)),
        DeviceCoordinates(0x6e5f, 1, Coordinates(4780, 4070, -1200))
    ]

    algorithm = POZYX_POS_ALG_TRACKING  # positioning algorithm to use
    dimension = POZYX_3D  # positioning dimension
    height = 0  # height of device, required in 2.5D positioning

    pozyx = PozyxSerial(serial_port)

    pi_serial = serial.Serial(
        port=pi_serial_addr,
        baudrate=pi_serial_rate)  #initialize Raspberry's serial port
Esempio n. 14
0
        print("No Pozyx connected. Check your USB cable or your driver!")
        quit()

    # enable to send position data through OSC
    use_processing = True

    # configure if you want to route OSC to outside your localhost. Networking knowledge is required.
    ip = "127.0.0.1"
    network_port = 8888

    # IDs of the tags to position, add None to position the local tag as well.
    tag_ids = [None, 0x6728]

    # necessary data for calibration
    anchors = [
        DeviceCoordinates(0x6e09, 1, Coordinates(0, 0, 0)),
        DeviceCoordinates(0x674c, 1, Coordinates(1650, 0, 0)),
        DeviceCoordinates(0x6729, 1, Coordinates(0, 480, 0)),
        DeviceCoordinates(0x6765, 1, Coordinates(1650, 480, 0))
    ]

    # positioning algorithm to use, other is PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    # positioning dimension. Others are PozyxConstants.DIMENSION_2D, PozyxConstants.DIMENSION_2_5D
    dimension = PozyxConstants.DIMENSION_2D
    # height of device, required in 2.5D positioning
    height = 1000

    osc_udp_client = None
    if use_processing:
        osc_udp_client = SimpleUDPClient(ip, network_port)
Esempio n. 15
0

if __name__ == "__main__":
    outputfile = 'output/' + str(datetime.datetime.now()).replace(
        ' ', '_') + '_pozywx.csv'
    # shortcut to not have to find out the port yourself
    serial_port = get_first_pozyx_serial_port()
    if serial_port is None:
        print("No Pozyx connected. Check your USB cable or your driver!")
        quit()

    remote_id = None

    # necessary data for calibration, change the IDs and coordinates yourself
    anchors = [
        DeviceCoordinates(0x6733, 1, Coordinates(4577, 0, 277)),
        DeviceCoordinates(0x6765, 1, Coordinates(0, 0, 277)),
        DeviceCoordinates(0x6744, 1, Coordinates(-114, 6105, 277)),
        DeviceCoordinates(0x6745, 1, Coordinates(4681, 6264, 277))
    ]

    algorithm = POZYX_POS_ALG_UWB_ONLY  # positioning algorithm to use
    dimension = POZYX_2D  # positioning dimension
    height = 277  # height of device, required in 2.5D positioning

    pozyx = PozyxSerial(serial_port)
    r = ReadyToLocalize(pozyx, anchors, algorithm, dimension, height,
                        remote_id)
    r.setup()
    with open(outputfile, mode='w') as csvFile:
        csvWriter = csv.writer(csvFile)
Esempio n. 16
0
    # Enable to send position data through OSC
    use_processing = True

    # Configure if you want to route OSC to outside your localhost.
    # Networking knowledge is required.
    ip = "127.0.0.1"
    network_port = 8888

    osc_udp_client = None
    if use_processing:
        osc_udp_client = SimpleUDPClient(ip, network_port)

    # Necessary data for calibration, change the IDs and coordinates
    # yourself according to your measurement.
    anchors = [
        DeviceCoordinates(0x6726, 1, Coordinates(2.0077, 5.8589, 4.0456)),
        DeviceCoordinates(0x6119, 1, Coordinates(5.8979, 0.3834, 4.1429)),
        DeviceCoordinates(0x617e, 1, Coordinates(-4.2850, -7.1688, 4.3153)),
        DeviceCoordinates(0x6735, 1, Coordinates(-7.4586, -2.7238, 3.9999))
    ]

    # Positioning algorithm to use.
    # Other is PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    # positioning dimension.
    # Others are PozyxConstants.DIMENSION_2D, PozyxConstants.DIMENSION_2_5D
    dimension = PozyxConstants.DIMENSION_3D
    # height of device, required in 2.5D positioning
    height = 1000

    pozyx = PozyxSerial(serial_port)
Esempio n. 17
0
        # Get tag ID from arguments passed through launch file
        tag_id = rospy.myargv(argv=sys.argv)[1]

        # Set serial port for detecting the tag
        serial_port = '/dev/ttyACM' + tag_id

        print(serial_port)
        if serial_port is None:
            print("No Pozyx connected. Check your USB cable or your driver!")

        # Set anchors' ID and Coordinates
        # Modify the coordinates with the results of the auto or manual calibration
        anchor_ids = [0x6902, 0x6e7a, 0x6e44, 0x6e6c]
        anchors = [
            DeviceCoordinates(anchor_ids[0], 1, Coordinates(0, 0, 0)),
            DeviceCoordinates(anchor_ids[1], 1, Coordinates(0, 5228.0, 0)),
            DeviceCoordinates(anchor_ids[2], 1, Coordinates(3251, 354, 0)),
            DeviceCoordinates(anchor_ids[3], 1, Coordinates(158, -40, 1326))
        ]

        # necessary data for calibration
        use_processing = False  # enable to send position data through OSC
        osc_udp_client = None  # use the OSC UDP
        remote_id = None
        algorithm = POZYX_POS_ALG_UWB_ONLY  # positioning algorithm to use
        dimension = POZYX_3D  # positioning dimension
        height = 1000  # height of device, required in 2.5D positioning

        # Initialize localizer class
        pozyx = PozyxSerial(serial_port)
Esempio n. 18
0
from pypozyx import PozyxSerial, get_first_pozyx_serial_port, POZYX_SUCCESS, SingleRegister, EulerAngles, Acceleration, UWBSettings, Coordinates, DeviceCoordinates
# initalize the Pozyx as above
serial_port = get_first_pozyx_serial_port()

if serial_port is not None:
    pozyx = PozyxSerial(serial_port)
    uwb_settings = UWBSettings()
    pozyx.getUWBSettings(uwb_settings)
    print(f'UWB Settings: {uwb_settings}')
else:
    print("No Pozyx port was found")

# assume an anchor 0x6140 that we want to add to the device list and immediately save the device list after.
anchor = DeviceCoordinates(0x6140, 0, Coordinates(000, 0000, 0))
print(anchor)
pozyx.addDevice(anchor)
pozyx.saveNetwork()

# after, we can start positioning. Positioning takes its parameters from the configuration in the tag's
# registers, and so we only need the coordinates.
position = Coordinates()
print(f'Position before positioning: {position}')
pozyx.doPositioning(position)
print(f'Position after positioning: {position}')

# initialize the data container
who_am_i = SingleRegister()
# get the data, passing along the container
status = pozyx.getWhoAmI(who_am_i)

# check the status to see if the read was successful. Handling failure is covered later.
Esempio n. 19
0
        osc_udp_client = SimpleUDPClient(ip, network_port)

    # -----------------------------------------------------------------------------------------------------------------------------------------
    """ [PH]: Manually assign TAG IDs (hexadecimal value) for remote positioning """
    # NOTES:
    # If a local tag is connected (ie. to PC via USB), change its tag id to "None"
    #     eg: tag_ids = [None, 0x6720, 0x6729]   # TDMA order: Local, 0x6720, 0x6729
    #     *Locally connected tag may not transmit orientation data
    tag_ids = [0x0001, 0x0002]
    #tag_ids = [0x6720, 0x6729, 0x6735]    # 3 x Tags
    """ [PH]: Manually assign ANCHOR IDs and coordinate data for calibration """
    # Coordinates (x, y, z) are in mm
    # Coordinates last updated 15/11/18
    #    refer C:\Projects\Pozyx\Anchor Location Coordinates\Pozyx_Anchor_Location_Coordinates.xlsx
    anchors = [
        DeviceCoordinates(0x675a, 1, Coordinates(0, 0, 1675)),
        DeviceCoordinates(0x674d, 1, Coordinates(7000, -1810, 1175)),
        DeviceCoordinates(0x675b, 1, Coordinates(7000, 2190, 1990)),
        DeviceCoordinates(0x6717, 1, Coordinates(0, 2190, 2225))
    ]

    # -----------------------------------------------------------------------------------------------------------------------------------------

    # positioning algorithm to use, other is PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    # positioning dimension. Others are PozyxConstants.DIMENSION_2D, PozyxConstants.DIMENSION_2_5D
    dimension = PozyxConstants.DIMENSION_3D
    # height of device, required in 2.5D positioning
    height = 1000

    pozyx = PozyxSerial(serial_port)
Esempio n. 20
0
    remote = False
    if not remote:
        remote_id = None

    use_processing = False  # enable to send position data through OSC
    osc_udp_client = None
    ip = "127.0.0.1"  # configure if you want to route OSC to outside your localhost. Networking knowledge is required.
    network_port = 22

    pozyx = PozyxSerial(serial_port)
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    dimension = PozyxConstants.DIMENSION_2D
    hight = 50
    #necessary data for calibration, change the IDs and coordinates yourself according to your measurement
    anchors = [
        DeviceCoordinates(26426, 1, Coordinates(-(-5177 - 1073), 4781 + 3543,
                                                0)),
        DeviceCoordinates(26381, 1,
                          Coordinates(-(-5750 - 1073), -3316 + 3543, 0)),
        DeviceCoordinates(26386, 1, Coordinates(1123 - 1073, 5479 + 3543, 0)),
        DeviceCoordinates(26429, 1, Coordinates(1073 - 1073, -3543 + 3543, 0))
    ]

    r = uwbProcessing(pozyx,
                      anchors,
                      algorithm,
                      dimension,
                      hight,
                      remote_id=None)
    r.setup()
Esempio n. 21
0
        print("No Pozyx connected. Check your USB cable or your driver!")
        quit()

    # enable to send position data through OSC
    use_processing = True

    # configure if you want to route OSC to outside your localhost. Networking knowledge is required.
    ip = "127.0.0.1"
    network_port = 8888

    # IDs of the tags to position, add None to position the local tag as well.
    tag_ids = [None, 0x6e66]

    # necessary data for calibration
    anchors = [
        DeviceCoordinates(0x6058, 1, Coordinates(0, 0, 2210)),
        DeviceCoordinates(0x6005, 1, Coordinates(9200, -700, 2400)),
        DeviceCoordinates(0x605C, 1, Coordinates(0, 17000, 2470)),
        DeviceCoordinates(0x6027, 1, Coordinates(2700, 17000, 2470)),
        DeviceCoordinates(0x682e, 1, Coordinates(2700, 2500, 2350)),
        DeviceCoordinates(0x6044, 1, Coordinates(11230, 2750, 2300))
    ]

    # positioning algorithm to use, other is PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    # positioning dimension. Others are PozyxConstants.DIMENSION_2D, PozyxConstants.DIMENSION_2_5D
    dimension = PozyxConstants.DIMENSION_3D
    # height of device, required in 2.5D positioning
    height = 1000

    osc_udp_client = None
        quit()

    remote_id = 0x6069  # remote device network ID
    remote = False  # whether to use a remote device
    if not remote:
        remote_id = None

    use_processing = True  # enable to send position data through OSC
    ip = "127.0.0.1"  # IP for the OSC UDP
    network_port = 8888  # network port for the OSC UDP
    osc_udp_client = None
    if use_processing:
        osc_udp_client = SimpleUDPClient(ip, network_port)
    # necessary data for calibration, change the IDs and coordinates yourself
    anchors = [
        DeviceCoordinates(0x6068, 1, Coordinates(28885, 5264, 2173)),
        DeviceCoordinates(0x6063, 1, Coordinates(28885, 10087, 2173)),
        DeviceCoordinates(0x6035, 1, Coordinates(28885, 300, 2167)),
        DeviceCoordinates(0xA004, 1, Coordinates(25805, 11850, 2151))
    ]

    algorithm = POZYX_POS_ALG_UWB_ONLY  # positioning algorithm to use
    dimension = POZYX_3D  # positioning dimension
    height = 1000  # height of device, required in 2.5D positioning

    pozyx = PozyxSerial(serial_port)
    r = ReadyToLocalize(pozyx, osc_udp_client, anchors, algorithm, dimension,
                        height, remote_id)
    r.setup()
    while True:
        r.loop()
Esempio n. 23
0
    if not remote:
        remote_id = None

    # enable to send position data through OSC
    use_processing = True

    # configure if you want to route OSC to outside your localhost. Networking knowledge is required.
    ip = "127.0.0.1"
    network_port = 8888

    osc_udp_client = None
    if use_processing:
        osc_udp_client = SimpleUDPClient(ip, network_port)

    # necessary data for calibration, change the IDs and coordinates yourself according to your measurement
    anchors = [DeviceCoordinates(0x674c, 1, Coordinates(1660, 0, 2750)),
               DeviceCoordinates(0x6765, 1, Coordinates(1660, -520, 2750)),
               DeviceCoordinates(0x6e09, 1, Coordinates(0, 0, 2750)),
               DeviceCoordinates(0x6729, 1, Coordinates(0, -520, 2750))]

    # positioning algorithm to use, other is PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    # positioning dimension. Others are PozyxConstants.DIMENSION_2D, PozyxConstants.DIMENSION_2_5D
    dimension = PozyxConstants.DIMENSION_2D
    # height of device, required in 2.5D positioning
    height = 2750

    pozyx = PozyxSerial(serial_port)
    r = ReadyToLocalize(pozyx, osc_udp_client, anchors, algorithm, dimension, height, remote_id)
    r.setup()
    while True:
    # -----------------------------------------------------------------------------------------------------------------------
    # [PH]: Get Tag ID(s)
    tag_ids = PozyxHardware().SelectTags()

    for tag in tag_ids:
        print("Selected tag: {0}".format(hex(tag)))

    # [PH]: Get Anchor IDs and Co-ordinates
    anchorData = PozyxHardware().GetAnchors()

    anchors = []
    for key in anchorData:
        anchors.append(
            DeviceCoordinates(
                key, 1,
                Coordinates(anchorData[key][0], anchorData[key][1],
                            anchorData[key][2])))
    # -----------------------------------------------------------------------------------------------------------------------

    # positioning algorithm to use, other is PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    # positioning dimension. Others are PozyxConstants.DIMENSION_2D, PozyxConstants.DIMENSION_2_5D
    dimension = PozyxConstants.DIMENSION_3D
    # height of device, required in 2.5D positioning
    height = 1000

    pozyx = PozyxSerial(serial_port)

    runPozyx = PozyxTagPositioning(pozyx, osc_udp_client, tag_ids, anchors,
                                   algorithm, dimension, height)
    runPozyx.setup()
Esempio n. 25
0
"""

import pypozyx
import rospy
import argparse

from pypozyx import (POZYX_POS_ALG_UWB_ONLY, POZYX_3D, Coordinates, POZYX_SUCCESS, PozyxConstants, version,
                     DeviceCoordinates, PozyxSerial, get_first_pozyx_serial_port, SingleRegister, DeviceList, PozyxRegisters)

# Set serial port or leave it empty to make auto connect
serial_port = ''

# adding None will cause the local device to be configured for the anchors as well.
tag_ids = [None]

anchors = [DeviceCoordinates(0x6a11, 1, Coordinates(-108, 12145, 2900)),
            DeviceCoordinates(0x6a19, 1, Coordinates(5113, 11617, 2900)),
            DeviceCoordinates(0x6a6b, 1, Coordinates(0, 0, 2900)),
            DeviceCoordinates(0x676d, 1, Coordinates(4339, 0, 2800)),
            DeviceCoordinates(0x6a40, 1, Coordinates(672, 5127, 100))]


def set_anchor_configuration(port):
    rospy.init_node('uwb_configurator')
    rospy.loginfo("Configuring device list.")

    settings_registers = [0x16, 0x17]  # POS ALG and NUM ANCHORS
    try:
        pozyx = pypozyx.PozyxSerial(port)
    except:
        rospy.loginfo("Pozyx not connected")
Esempio n. 26
0
        remote_id = None

    # enable to send position data through OSC
    use_processing = True

    # configure if you want to route OSC to outside your localhost. Networking knowledge is required.
    ip = "127.0.0.1"
    network_port = 8888

    osc_udp_client = None
    if use_processing:
        osc_udp_client = SimpleUDPClient(ip, network_port)

    # necessary data for calibration, change the IDs and coordinates yourself according to your measurement
    anchors = [
        DeviceCoordinates(0x676C, 1, Coordinates(4000, 4000, 2000)),
        DeviceCoordinates(0x6738, 1, Coordinates(4000, 0, 1500)),
        DeviceCoordinates(0x6E2B, 1, Coordinates(0, 4000, 1800)),
        DeviceCoordinates(0x676E, 1, Coordinates(0, 0, 1600))
    ]

    # positioning algorithm to use, other is PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    # positioning dimension. Others are PozyxConstants.DIMENSION_2D, PozyxConstants.DIMENSION_2_5D
    dimension = PozyxConstants.DIMENSION_3D
    # height of device, required in 2.5D positioning
    height = 1000

    pozyx = PozyxSerial(serial_port)
    r = ReadyToLocalize(pozyx, osc_udp_client, anchors, algorithm, dimension,
                        height, remote_id)
Esempio n. 27
0
        quit()

    remote_id = 0x672d  # remote device network ID
    remote = False  # whether to use a remote device
    if not remote:
        remote_id = None

    use_processing = True  # enable to send position data through OSC
    ip = "127.0.0.1"  # IP for the OSC UDP
    network_port = 8888  # network port for the OSC UDP
    osc_udp_client = None
    if use_processing:
        osc_udp_client = SimpleUDPClient(ip, network_port)
    # necessary data for calibration, change the IDs and coordinates yourself
    anchors = [
        DeviceCoordinates(0x6e4b, 1, Coordinates(0, 0, 300)),
        DeviceCoordinates(0x6e67, 1, Coordinates(3630, 0, 300)),
        DeviceCoordinates(0x6e3a, 1, Coordinates(0, 2430, 300)),
        DeviceCoordinates(0x6e68, 1, Coordinates(3630, 2430, 300))
    ]

    algorithm = POZYX_POS_ALG_UWB_ONLY  # positioning algorithm to use
    dimension = POZYX_3D  # positioning dimension
    height = 1000  # height of device, required in 2.5D positioning

    pozyx = PozyxSerial(serial_port)
    r = ReadyToLocalize(pozyx, osc_udp_client, anchors, algorithm, dimension,
                        height, remote_id)
    r.setup()
    while True:
        r.loop()
        tag_id = None

    # OSC configuration
    ip = "127.0.0.1"
    network_port = 8888
    use_OSC = True  # enable to send position data through OSC
    osc_udp_client = None

    if use_OSC:
        osc_udp_client = SimpleUDPClient(ip, network_port)
    '''*****************************************************************************************************************'''
    # Manually assign anchor ids and coordiante data for calibration
    # Coordinates (x, y, z) are in mm
    # Coordinates last updated 28/11/18 - see C:\Projects\Pozyx\Documentation\Pozyx_Anchor_Location_Coordinates.xlsx
    anchors = [
        DeviceCoordinates(0x675a, 1, Coordinates(
            0, 0, 1150)),  #1150 (desk high) or 750 (desk low)
        DeviceCoordinates(0x674d, 1, Coordinates(3500, -2330, 130)),
        DeviceCoordinates(0x675b, 1, Coordinates(3500, 3850, 2110)),
        DeviceCoordinates(0x6717, 1, Coordinates(0, 4010, 120))
    ]
    '''*****************************************************************************************************************'''

    # positioning algorithm to use, other is PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    # positioning dimension. Others are PozyxConstants.DIMENSION_2D, PozyxConstants.DIMENSION_2_5D
    dimension = PozyxConstants.DIMENSION_3D
    # height of device, required in 2.5D positioning [does not apply for 3D positioning]
    height = 1

    pozyx = PozyxSerial(serial_port)
    r = ReadyToLocalize(pozyx, osc_udp_client, anchors, algorithm, dimension,
        remote_id = None

    # enable to send position data through OSC
    use_processing = True

    # configure if you want to route OSC to outside your localhost. Networking knowledge is required.
    ip = "127.0.0.1"
    network_port = 8888

    osc_udp_client = None
    if use_processing:
        osc_udp_client = SimpleUDPClient(ip, network_port)

    # necessary data for calibration, change the IDs and coordinates yourself according to your measurement
    anchors = [
        DeviceCoordinates(0x670c, 1, Coordinates(5933, 9600, 2200)),
        DeviceCoordinates(0x6711, 1, Coordinates(200, 0, 2989)),
        DeviceCoordinates(0x674b, 1, Coordinates(5409, 0, 2220))
    ]

    # positioning algorithm to use, other is PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    # positioning dimension. Others are PozyxConstants.DIMENSION_2D, PozyxConstants.DIMENSION_2_5D
    dimension = PozyxConstants.DIMENSION_2_5D
    # height of device, required in 2.5D positioning
    height = 1000

    pozyx = PozyxSerial(serial_port)
    r = ReadyToLocalize(pozyx, osc_udp_client, anchors, algorithm, dimension,
                        height, remote_id)
    r.setup()
Esempio n. 30
0
    # enable to send position data through OSC
    use_processing = True

    # configure if you want to route OSC to outside your localhost. Networking knowledge is required.
    ip = "127.0.0.1"
    network_port = 8888

    # IDs of the tags to position, add None to position the local tag as well.
    tag_ids = [
        None,
        #6e66i
    ]

    # necessary data for calibration
    anchors = [
        DeviceCoordinates(0x6743, 1, Coordinates(0, 0, 2210)),
        DeviceCoordinates(0x6725, 1, Coordinates(9200, -700, 2400)),
        #3 DeviceCoordinates(0x605C, 1, Coordinates(0, 17000, 2470)),
        # DeviceCoordinates(0x6027, 1, Coordinates(2700, 17000, 2470)),
        DeviceCoordinates(0x6742, 1, Coordinates(2700, 2500, 2350)),
        DeviceCoordinates(0x674f, 1, Coordinates(11230, 2750, 2300))
    ]

    # positioning algorithm to use, other is PozyxConstants.POSITIONING_ALGORITHM_TRACKING
    algorithm = PozyxConstants.POSITIONING_ALGORITHM_UWB_ONLY
    # positioning dimension. Others are PozyxConstants.DIMENSION_2D, PozyxConstants.DIMENSION_2_5D
    dimension = PozyxConstants.DIMENSION_3D
    # height of device, required in 2.5D positioning
    height = 1000

    osc_udp_client = None