1010"""
1111from 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 )
1515from 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+
139139if __name__ == "__main__" :
140140 # shortcut to not have to find out the port yourself
141141 serial_port = get_first_pozyx_serial_port ()
0 commit comments