64 from radar_pa_msgs.msg
import radar_msg_A
65 from radar_pa_msgs.msg
import radar_msg_B
75 if ((data[0] & 0b00000001) == 0b00000001):
78 msg.message = extract_bit (0, 1, data)
79 msg.ID = extract_bit (1, 6, data)
92 msg.angle_deviation =
extract_bit( 7, 6, data) * 0.001
93 msg.velocity_deviation =
extract_bit(13, 6, data) * 0.0625
94 msg.distance_deviation =
extract_bit(19, 6, data) * 0.0625
95 msg.proability_target =
extract_bit(25, 5, data) * 0.03125
110 if ((bitNum + length) <= 8):
111 fisrt_byte = data[byteNum] >>(bitNum) &
mask_value(length)
112 new_data = fisrt_byte
114 elif ((bitNum + length) <= 16):
115 fisrt_byte = data[byteNum] >>(bitNum) &
mask_value(8-bitNum)
116 second_byte = data[byteNum+1] <<(8-bitNum) &
mask_value(length)
117 new_data = fisrt_byte | second_byte
119 elif ((bitNum + length) <= 24):
120 fisrt_byte = data[byteNum] >>(bitNum) &
mask_value(8-bitNum)
121 second_byte = data[byteNum+1] <<(8-bitNum) &
mask_value(8+bitNum)
122 third_byte = data[byteNum+2] <<(8+(8-bitNum)) &
mask_value(length)
123 new_data = fisrt_byte | second_byte |third_byte
126 print (
'out of range')
141 return ((1 << length)-1)
156 for i
in range(len(data)):
157 if ((type(data[i])
is str)):
159 result.append(ord(data[i]))
162 result.append(data[i])
170 if (input_data & (1<<(length-1))):
171 input_data -= (1<<length)