diff --git a/Data API/TCP_binary/Python/decoder.py b/Data API/TCP_binary/Python/decoder.py index ebade95..6d1d0ff 100644 --- a/Data API/TCP_binary/Python/decoder.py +++ b/Data API/TCP_binary/Python/decoder.py @@ -41,13 +41,13 @@ def decode(self, data): print('\n\n') print('[RTLOC BINARY API]') - if pkg_type is ord('D'): + if pkg_type == ord('D'): print(' > Data') (version, data_len, msg_id, frame_nr, frame_size, time_cnt) = unpack('> version = " + str(version)) - if version is 3: + if version == 3: i = i+13 else: i = i+12 @@ -91,7 +91,7 @@ def decode(self, data): bytes_remaining -= 1 i = i + 1 - if(tag_type is ord('D')): + if(tag_type == ord('D')): print(" >>> distances") anchor_cnt = unpack('>> quaternions ") tag_tmp[4] = list(unpack('>> raw data ") raw_sample_cnt = unpack('>> positions ") tag_tmp[6] = list(unpack('>>> pos = [" + str(tag_tmp[6][0]) + ", " + str(tag_tmp[6][1]) + ", " + str(tag_tmp[6][2]) + "]") - elif tag_type is ord('U'): + elif tag_type == ord('U'): #TODO: implement userdata parsing # print(" >>> userdata: ") userdata_cnt = unpack('>> impulse response") print(" >>>> ERR - implement IR first ") @@ -178,7 +178,7 @@ def decode(self, data): # print("\n") - elif pkg_type is ord('A'): + elif pkg_type == ord('A'): print(' > Anchorlist') #NOTE: 24/01/2019 - version of this API updated to ver=1. Use cxRTLS40039 to use the following line, otherwise stick to version 0 (whicch doesn't have anchor_cnt) (version, block_length, anchor_cnt) = unpack(' Taglist') #NOTE: 24/01/2019 - version of this API updated to ver=1. Use cxRTLS40039 to use the following line, otherwise stick to version 0 (whicch doesn't have tag_cnt) (version, block_length, tag_cnt) = unpack(' External Impulse") # External Impulse Array (version, block_length, imp_type, ext_imp_frame, ext_imp_offset) = unpack('> date: ' + str(ext_imp_gps_day) + '/' + str(ext_imp_gps_month)+ '/'+ str(ext_imp_gps_year)) print(' >> time: ' + str(ext_imp_gps_hour) + ":" + str(ext_imp_gps_min) + ":"+ str(ext_imp_gps_sec) + "."+ str(ext_imp_gps_milli)) - elif pkg_type is ord('X'): + elif pkg_type == ord('X'): print(' > Node Status') (version, block_length, node_cnt) = unpack('