9 from rospy_message_converter
import message_converter
15 with open(filename)
as f:
16 yaml_data = yaml.load(f)
18 column_list = ColumnList()
20 marker_list = MarkerArray()
25 object.name = t[
'name']
26 object.radius = float(t[
'radius'])
27 object.height = float(t[
'height'])
28 object.pose.header.frame_id = t[
'frame_id']
29 object.pose.header.stamp = rospy.Time.now()
30 object.pose.pose.pose = message_converter.convert_dictionary_to_ros_message(
'geometry_msgs/Pose',t[
'pose'])
31 column_list.obstacles.append(object)
35 marker.header = object.pose.header
36 marker.type = Marker.CYLINDER
37 marker.ns =
"column_obstacles" 38 marker.action = Marker.ADD
39 marker.lifetime = rospy.Duration.from_sec(0)
40 marker.pose = copy.deepcopy(object.pose.pose.pose)
41 marker.pose.position.z += object.height/2.0
42 marker.scale.x = object.radius * 2
43 marker.scale.y = object.radius * 2
44 marker.scale.z = object.height
50 marker_list.markers.append(marker)
52 marker_id = marker_id + 1
54 column_pub.publish(column_list)
55 marker_pub.publish(marker_list)
59 if __name__ ==
'__main__':
60 rospy.init_node(
'column_loader')
61 filename = rospy.get_param(
'~filename')
63 marker_pub = rospy.Publisher(
'column_marker', MarkerArray, latch =
True, queue_size=1)
64 column_pub = rospy.Publisher(
'column_pose_list', ColumnList, latch =
True)
66 rospy.loginfo(
'Publishing obstacles and visualization markers.')