diff --git a/launch/display_highbay_swarm.launch b/launch/display_highbay_swarm.launch new file mode 100644 index 0000000..98428c6 --- /dev/null +++ b/launch/display_highbay_swarm.launch @@ -0,0 +1,8 @@ + + + map + $(find lab_gazebo)/worlds/highbay_swarm_world/meshes + + + + diff --git a/launch/display_with_params.launch b/launch/display_with_params.launch new file mode 100644 index 0000000..105586b --- /dev/null +++ b/launch/display_with_params.launch @@ -0,0 +1,12 @@ + + + + + + + $(arg frame) + $(arg visualizer_path) + + + + diff --git a/scripts/object_visualizer.py b/scripts/object_visualizer.py index 07aa01b..cada6ff 100755 --- a/scripts/object_visualizer.py +++ b/scripts/object_visualizer.py @@ -5,10 +5,14 @@ from visualization_msgs.msg import MarkerArray, Marker rospy.init_node("object_visualizer") -rate = rospy.Rate(1) +rate = rospy.Rate(0.5) rospy.loginfo('Initializing object visualizer') rp = rospkg.RosPack() visualizer_path = os.path.join(rp.get_path('object_visualizer'), 'meshes') + +visualizer_path = rospy.get_param("~visualizer_path", visualizer_path) +frame = rospy.get_param("~frame", "map") + markerArray = MarkerArray() publisher = rospy.Publisher('visualization_marker', MarkerArray, queue_size=1) @@ -19,7 +23,7 @@ if len(files) != current_file_count: # if the number of valid meshed in the 'meshes' folder has changed if len(files) < current_file_count: # if some markers are removed from the 'meshes' folder, delete them in RViz marker = Marker() - marker.header.frame_id = 'map' + marker.header.frame_id = frame marker.action = marker.DELETEALL # send the DELETEALL marker to delete all marker in RViz markerArray.markers.append(marker) publisher.publish(markerArray) @@ -29,16 +33,16 @@ rospy.loginfo('Loading file: %s', file) marker = Marker() marker.id = marker_id - marker.mesh_resource = 'package://object_visualizer/meshes/' + file + marker.mesh_resource = "file://" + visualizer_path + "/" + file marker.mesh_use_embedded_materials = True # Need this to use textures for mesh marker.type = marker.MESH_RESOURCE - marker.header.frame_id = "map" + marker.header.frame_id = frame marker.scale.x = 1.0 marker.scale.y = 1.0 marker.scale.z = 1.0 marker.pose.orientation.w = 1.0 markerArray.markers.append(marker) - rospy.loginfo('Published %d objects. ', len(markerArray.markers)) + # rospy.loginfo('Published %d objects. ', len(markerArray.markers)) publisher.publish(markerArray) rate.sleep()