Skip to content

Commit 26d9fec

Browse files
committed
Fixed multitag and version numbers
Fixed multitag and version numbers Was preparing other url
1 parent 7c0e372 commit 26d9fec

File tree

4 files changed

+42
-32
lines changed

4 files changed

+42
-32
lines changed

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
name='pypozyx',
66
packages=['pypozyx', 'pypozyx.definitions',
77
'pypozyx.structures', 'pypozyx.tests'],
8-
version='0.2.0',
8+
version='1.0.0',
99
description='Python library for Pozyx',
1010
author='Laurent Van Acker',
1111
author_email='[email protected]',
12-
url='www.pozyx.io',
13-
download_url='www.pozyx.io',
12+
url = 'https://github.com/pozyxLabs/Pozyx-Python-library',
13+
download_url='https://github.com/pozyxLabs/Pozyx-Python-library/archive/v1.0.tar.gz',
1414
keywords=['pozyx', 'serial', 'positioning', 'localisation'],
1515
classifiers=[
1616
'Programming Language :: Python',
17-
'Development Status :: 4 - Beta',
17+
'Development Status :: 5 - Release',
1818
'Intended audience :: End Users/Developers',
1919
'Operating System :: OS independent',
2020
'Topic :: Software Development :: Libraries :: Python Modules',

tutorials/multitag_positioning.py

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
parameters and upload this sketch. Watch the coordinates change as you move your device around!
1111
1212
"""
13-
from time import sleep
13+
from time import sleep, time
1414

1515
from pypozyx import *
16+
from pypozyx.definitions.registers import POZYX_EUL_HEADING
1617
from pythonosc.osc_message_builder import OscMessageBuilder
1718
from pythonosc.udp_client import SimpleUDPClient
1819

@@ -33,7 +34,7 @@ def __init__(self, pozyx, osc_udp_client, tags, anchors, algorithm=POZYX_POS_ALG
3334

3435
def setup(self):
3536
"""Sets up the Pozyx for positioning by calibrating its anchor list."""
36-
print("------------POZYX MULTITAG POSITIONING V1.0 - -----------\nNOTES: \n- Parameters required:\n\t- Anchors for calibration\n\t- Tags to work with\n\n- System will manually calibration\n\n- System will auto start positioning\n- -----------POZYX MULTITAG POSITIONING V1.0 ------------\nSTART Positioning: ")
37+
print("------------POZYX MULTITAG POSITIONING V1.1 - -----------\nNOTES: \n- Parameters required:\n\t- Anchors for calibration\n\t- Tags to work with\n\n- System will manually calibration\n\n- System will auto start positioning\n- -----------POZYX MULTITAG POSITIONING V1.1 ------------\nSTART Positioning: ")
3738
self.setAnchorsManual()
3839
self.printPublishAnchorConfiguration()
3940

@@ -48,33 +49,38 @@ def loop(self):
4849
else:
4950
self.printPublishErrorCode("positioning", tag)
5051

52+
def printPublishPosition(self, position, network_id):
53+
"""Prints the Pozyx's position and possibly sends it as a OSC packet"""
54+
if network_id is None:
55+
network_id = 0
56+
s = "POS ID: {}, x(mm): {}, y(mm): {}, z(mm): {}".format("0x%0.4x" % network_id, position.x, position.y, position.z)
57+
print(s)
58+
if self.osc_udp_client is not None:
59+
self.osc_udp_client.send_message(
60+
"/position", [network_id, position.x, position.y, position.z])
61+
5162
def setAnchorsManual(self):
5263
"""Adds the manually measured anchors to the Pozyx's device list one for one."""
5364
for tag in self.tags:
5465
status = self.pozyx.clearDevices(tag)
5566
for anchor in self.anchors:
5667
status &= self.pozyx.addDevice(anchor, tag)
5768
if len(anchors) > 4:
58-
status &= self.pozyx.setSelectionOfAnchors(POZYX_ANCHOR_SEL_AUTO, len(anchors))
59-
self.printConfigurationResult(status, tag)
69+
status &= self.pozyx.setSelectionOfAnchors(POZYX_ANCHOR_SEL_AUTO, len(anchors), remote_id=tag)
70+
# enable these if you want to save the configuration to the devices.
71+
# self.pozyx.saveAnchorIds(tag)
72+
# self.pozyx.saveRegisters([POZYX_ANCHOR_SEL_AUTO], tag)
73+
self.printPublishConfigurationResult(status, tag)
6074

6175
def printPublishConfigurationResult(self, status, tag_id):
6276
"""Prints the configuration explicit result, prints and publishes error if one occurs"""
77+
if tag_id is None:
78+
tag_id = 0
6379
if status == POZYX_SUCCESS:
6480
print("Configuration of tag %s: success" % tag_id)
6581
else:
6682
self.printPublishErrorCode("configuration", tag_id)
6783

68-
def printPublishPosition(self, position, network_id):
69-
"""Prints the Pozyx's position and possibly sends it as a OSC packet"""
70-
if network_id is None:
71-
network_id = 0
72-
print("POS ID {}, x(mm): {pos.x}, y(mm): {pos.y}, z(mm): {pos.z}".format(
73-
"0x%0.4x" % network_id, pos=pos))
74-
if self.osc_udp_client is not None:
75-
self.osc_udp_client.send_message(
76-
"/position", [network_id, anchor_coordinates.x, anchor_coordinates.y, anchor_coordinates.z])
77-
7884
def printPublishErrorCode(self, operation, network_id):
7985
"""Prints the Pozyx's error and possibly sends it as a OSC packet"""
8086
error_code = SingleRegister()
@@ -83,10 +89,10 @@ def printPublishErrorCode(self, operation, network_id):
8389
network_id = 0
8490
if status == POZYX_SUCCESS:
8591
print("Error %s on ID %s, error code %s" %
86-
(operation, "0x%0.4x" % (network_id, str(error_code))))
92+
(operation, "0x%0.4x" % network_id, str(error_code)))
8793
if self.osc_udp_client is not None:
8894
self.osc_udp_client.send_message(
89-
"/error_%s" % [operation, network_id, error_code[0]])
95+
"/error_%s" % operation, [network_id, error_code[0]])
9096
else:
9197
# should only happen when not being able to communicate with a remote Pozyx.
9298
self.pozyx.getErrorCode(error_code)
@@ -96,10 +102,10 @@ def printPublishErrorCode(self, operation, network_id):
96102

97103
def printPublishAnchorConfiguration(self):
98104
for anchor in self.anchors:
99-
print("ANCHOR,0x%0.4x,%s" % (anchor.network_id, str(anchor.coordinates)))
105+
print("ANCHOR,0x%0.4x,%s" % (anchor.network_id, str(anchor.pos)))
100106
if self.osc_udp_client is not None:
101107
self.osc_udp_client.send_message(
102-
"/anchor", [anchor.network_id, anchor.coordinates.x, anchor.coordinates.y, anchor.coordinates.z])
108+
"/anchor", [anchor.network_id, anchor.pos.x, anchor.pos.y, anchor.pos.z])
103109
sleep(0.025)
104110

105111

@@ -112,19 +118,23 @@ def printPublishAnchorConfiguration(self):
112118
if not remote:
113119
remote_id = None
114120

115-
use_processing = False # enable to send position data through OSC
121+
use_processing = True # enable to send position data through OSC
116122
ip = "127.0.0.1" # IP for the OSC UDP
117123
network_port = 8888 # network port for the OSC UDP
118124
osc_udp_client = None
119125
if use_processing:
120126
osc_udp_client = SimpleUDPClient(ip, network_port)
121127

122-
tags = [0x0001, 0x0002, 0x0003] # remote tags
128+
#tags = [0x6055]
129+
tags = [0x607a]
130+
# tags = [0x6055, 0x607a] # remote tags
123131
# necessary data for calibration
124-
anchors = [DeviceCoordinates(0x0001, 1, Coordinates(0, 0, 2000)),
125-
DeviceCoordinates(0x0002, 1, Coordinates(3000, 0, 2000)),
126-
DeviceCoordinates(0x0003, 1, Coordinates(0, 3000, 2000)),
127-
DeviceCoordinates(0x0004, 1, Coordinates(3000, 3000, 2000))]
132+
anchors = [DeviceCoordinates(0x6058, 1, Coordinates(0, 0, 2210)),
133+
DeviceCoordinates(0x6005, 1, Coordinates(9200, -700, 2400)),
134+
DeviceCoordinates(0x605C, 1, Coordinates(0, 17000, 2470)),
135+
DeviceCoordinates(0x6027, 1, Coordinates(2700, 17000, 2470)),
136+
DeviceCoordinates(0x682e, 1, Coordinates(2700, 2500, 2350)),
137+
DeviceCoordinates(0x6044, 1, Coordinates(11230, 2750, 2300))]
128138

129139
algorithm = POZYX_POS_ALG_UWB_ONLY # positioning algorithm to use
130140
dimension = POZYX_3D # positioning dimension

tutorials/ready_to_localize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ def __init__(self, pozyx, osc_udp_client, anchors, algorithm=POZYX_POS_ALG_UWB_O
3030

3131
def setup(self):
3232
"""Sets up the Pozyx for positioning by calibrating its anchor list."""
33-
print("------------POZYX POSITIONING V1.0 -------------")
33+
print("------------POZYX POSITIONING V1.1 -------------")
3434
print("NOTES: ")
3535
print("- No parameters required.")
3636
print()
3737
print("- System will auto start configuration")
3838
print()
3939
print("- System will auto start positioning")
40-
print("------------POZYX POSITIONING V1.0 --------------")
40+
print("------------POZYX POSITIONING V1.1 --------------")
4141
print()
4242
print("START Ranging: ")
4343
self.pozyx.clearDevices(self.remote_id)

tutorials/ready_to_range.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ def __init__(self, pozyx, destination_id, range_step_mm=1000, protocol=POZYX_RAN
2424

2525
def setup(self):
2626
"""Sets up both the ranging and destination Pozyx's LED configuration"""
27-
print("------------POZYX RANGING V1.0 - -----------")
27+
print("------------POZYX RANGING V1.1 -------------")
2828
print("NOTES: ")
2929
print(" - Change the parameters: ")
3030
print("\tdestination_id(target device)")
3131
print("\trange_step(mm)")
3232
print()
3333
print("- Approach target device to see range and")
3434
print("led control")
35-
print("- -----------POZYX RANGING V1.0 ------------")
35+
print("- -----------POZYX RANGING V1.1 ------------")
3636
print()
3737
print("START Ranging: ")
3838

0 commit comments

Comments
 (0)