Skip to content

Commit b65660a

Browse files
committed
Updated/linted tutorials
1 parent 294ad27 commit b65660a

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

tutorials/multitag_positioning.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +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, time
13+
from time import sleep
1414

15-
from pypozyx import *
16-
from pypozyx.definitions.registers import POZYX_EUL_HEADING
17-
from pythonosc.osc_message_builder import OscMessageBuilder
15+
from pypozyx import (POZYX_POS_ALG_UWB_ONLY, POZYX_3D, Coordinates, POZYX_SUCCESS, POZYX_ANCHOR_SEL_AUTO,
16+
DeviceCoordinates, PozyxSerial, get_first_pozyx_serial_port, SingleRegister)
1817
from pythonosc.udp_client import SimpleUDPClient
1918

2019

@@ -143,8 +142,8 @@ def printPublishAnchorConfiguration(self):
143142
if use_processing:
144143
osc_udp_client = SimpleUDPClient(ip, network_port)
145144

146-
#tags = [0x6055]
147145
tags = [0x607a]
146+
148147
# tags = [0x6055, 0x607a] # remote tags
149148
# necessary data for calibration
150149
anchors = [DeviceCoordinates(0x6058, 1, Coordinates(0, 0, 2210)),

tutorials/orientation_3D.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"""
2121
from time import time
2222

23-
from pypozyx import *
23+
from pypozyx import SensorData, SingleRegister, POZYX_SUCCESS, get_first_pozyx_serial_port, PozyxSerial
2424
from pypozyx.definitions.bitmasks import POZYX_INT_MASK_IMU
2525
from pythonosc.osc_message_builder import OscMessageBuilder
2626
from pythonosc.udp_client import SimpleUDPClient
@@ -55,7 +55,7 @@ def publishSensorData(self, sensor_data, calibration_status):
5555
"""Makes the OSC sensor data package and publishes it"""
5656
self.msg_builder = OscMessageBuilder("/sensordata")
5757
self.msg_builder.add_arg(int(1000 * (time() - self.current_time)))
58-
current_time = time()
58+
self.current_time = time()
5959
self.addSensorData(sensor_data)
6060
self.addCalibrationStatus(calibration_status)
6161
self.osc_udp_client.send(self.msg_builder.build())
@@ -83,6 +83,7 @@ def addCalibrationStatus(self, calibration_status):
8383
self.msg_builder.add_arg((calibration_status[0] & 0x30) >> 4)
8484
self.msg_builder.add_arg((calibration_status[0] & 0xC0) >> 6)
8585

86+
8687
if __name__ == '__main__':
8788
# shortcut to not have to find out the port yourself
8889
serial_port = get_first_pozyx_serial_port()

tutorials/ready_to_localize.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"""
1111
from time import sleep
1212

13-
from pypozyx import *
14-
from pythonosc.osc_message_builder import OscMessageBuilder
13+
from pypozyx import (POZYX_POS_ALG_UWB_ONLY, POZYX_3D, Coordinates, POZYX_SUCCESS, POZYX_ANCHOR_SEL_AUTO,
14+
DeviceCoordinates, PozyxSerial, get_first_pozyx_serial_port, SingleRegister, DeviceList)
1515
from pythonosc.udp_client import SimpleUDPClient
1616

1717

@@ -106,21 +106,20 @@ def printPublishConfigurationResult(self):
106106
"""Prints and potentially publishes the anchor configuration result in a human-readable way."""
107107
list_size = SingleRegister()
108108

109-
status = self.pozyx.getDeviceListSize(list_size, self.remote_id)
109+
self.pozyx.getDeviceListSize(list_size, self.remote_id)
110110
print("List size: {0}".format(list_size[0]))
111111
if list_size[0] != len(self.anchors):
112112
self.printPublishErrorCode("configuration")
113113
return
114114
device_list = DeviceList(list_size=list_size[0])
115-
status = self.pozyx.getDeviceIds(device_list, self.remote_id)
115+
self.pozyx.getDeviceIds(device_list, self.remote_id)
116116
print("Calibration result:")
117117
print("Anchors found: {0}".format(list_size[0]))
118118
print("Anchor IDs: ", device_list)
119119

120120
for i in range(list_size[0]):
121121
anchor_coordinates = Coordinates()
122-
status = self.pozyx.getDeviceCoordinates(
123-
device_list[i], anchor_coordinates, self.remote_id)
122+
self.pozyx.getDeviceCoordinates(device_list[i], anchor_coordinates, self.remote_id)
124123
print("ANCHOR, 0x%0.4x, %s" % (device_list[i], str(anchor_coordinates)))
125124
if self.osc_udp_client is not None:
126125
self.osc_udp_client.send_message(
@@ -133,9 +132,10 @@ def printPublishAnchorConfiguration(self):
133132
print("ANCHOR,0x%0.4x,%s" % (anchor.network_id, str(anchor.coordinates)))
134133
if self.osc_udp_client is not None:
135134
self.osc_udp_client.send_message(
136-
"/anchor", [anchor.network_id, int(anchor_coordinates.x), int(anchor_coordinates.y), int(anchor_coordinates.z)])
135+
"/anchor", [anchor.network_id, int(anchor.coordinates.x), int(anchor.coordinates.y), int(anchor.coordinates.z)])
137136
sleep(0.025)
138137

138+
139139
if __name__ == "__main__":
140140
# shortcut to not have to find out the port yourself
141141
serial_port = get_first_pozyx_serial_port()

0 commit comments

Comments
 (0)