9 from uwb_hardware_driver.msg
import AnchorScan
14 ser = serial.Serial(port, baud_rate)
19 0: [2.675, -0.09, 1.94],
20 1: [3.42, 4.58, 2.07],
21 2: [12.475, -0.015, 2.4],
22 3: [12.473, 4.543, 2.35]
30 rospy.init_node(
"hardware_ros_driver", anonymous =
True)
31 pub = rospy.Publisher(
'IPS', AnchorScan, queue_size = 2)
35 anchor_id = list(anchor_info.keys())
36 anchor_coords = list(anchor_info.values())
38 anchor_coords_x = list()
39 anchor_coords_y = list()
40 anchor_coords_z = list()
42 for item
in anchor_coords:
43 anchor_coords_x.append(item[0])
44 anchor_coords_y.append(item[1])
45 anchor_coords_z.append(item[2])
48 while not rospy.is_shutdown():
52 msg.header.stamp = rospy.Time.now()
53 msg.AnchorID = anchor_id
54 msg.x = anchor_coords_x
55 msg.y = anchor_coords_y
56 msg.z = anchor_coords_z
61 parsed_data = (json.loads(data))
62 print(json.dumps(parsed_data))
65 msg.tdoa_of_anchors = [float(parsed_data[
"DCS"])/100, float(parsed_data[
"DBS"])/100, float(parsed_data[
"DAS"])/100]
71 if __name__ ==
'__main__':
74 except rospy.ROSInterruptException: