9 from rospy_message_converter
import message_converter
15 with open(filename)
as f:
16 yaml_data = yaml.load(f)
18 wall_list = WallList()
20 marker_list = MarkerArray()
25 object.name = t[
'name']
26 object.length = float(t[
'length'])
27 object.width = float(t[
'width'])
28 object.height = float(t[
'height'])
29 object.pose.header.frame_id = t[
'frame_id']
30 object.pose.header.stamp = rospy.Time.now()
31 object.pose.pose.pose = message_converter.convert_dictionary_to_ros_message(
'geometry_msgs/Pose',t[
'pose'])
32 wall_list.obstacles.append(object)
36 marker.header = object.pose.header
37 marker.type = Marker.CUBE
38 marker.ns =
"wall_obstacles" 39 marker.action = Marker.ADD
40 marker.lifetime = rospy.Duration.from_sec(0)
41 marker.pose = copy.deepcopy(object.pose.pose.pose)
42 marker.pose.position.z += object.height/2.0
43 marker.scale.x = object.width
44 marker.scale.y = object.length
45 marker.scale.z = object.height
51 marker_list.markers.append(marker)
53 marker_id = marker_id + 1
55 wall_pub.publish(wall_list)
56 marker_pub.publish(marker_list)
60 if __name__ ==
'__main__':
61 rospy.init_node(
'wall_loader')
62 filename = rospy.get_param(
'~filename')
64 marker_pub = rospy.Publisher(
'wall_marker', MarkerArray, latch=
True, queue_size=1)
65 wall_pub = rospy.Publisher(
'wall_pose_list', WallList, latch =
True)
67 rospy.loginfo(
'Publishing obstacles and visualization markers.')