From 506b3cccfe62448d10e58d3a089f62a63a9d604e Mon Sep 17 00:00:00 2001 From: Burak Aksoy Date: Sat, 11 Mar 2023 13:51:24 -0500 Subject: [PATCH 1/7] Add mesh folder path and frame parameters instead of hardcoding them --- launch/display_with_params.launch | 12 ++++++++++++ scripts/object_visualizer.py | 12 ++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 launch/display_with_params.launch 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..a959be0 100755 --- a/scripts/object_visualizer.py +++ b/scripts/object_visualizer.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#! /usr/bin/env python import os import rospy import rospkg @@ -9,6 +9,10 @@ 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,10 +33,10 @@ 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 From 6cb1cd324498a5a92e5687ccdf0e7853bd26a589 Mon Sep 17 00:00:00 2001 From: Burak Aksoy Date: Sat, 11 Mar 2023 15:18:46 -0500 Subject: [PATCH 2/7] disable verbouse log info --- scripts/object_visualizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/object_visualizer.py b/scripts/object_visualizer.py index a959be0..8c1a1b9 100755 --- a/scripts/object_visualizer.py +++ b/scripts/object_visualizer.py @@ -43,6 +43,6 @@ 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() From b3680a134912e9b4990014ca8b164f97cc251a41 Mon Sep 17 00:00:00 2001 From: Burak Aksoy Date: Tue, 14 Mar 2023 23:00:15 -0400 Subject: [PATCH 3/7] add a test launcher --- launch/display_highbay_swarm.launch | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 launch/display_highbay_swarm.launch diff --git a/launch/display_highbay_swarm.launch b/launch/display_highbay_swarm.launch new file mode 100644 index 0000000..e920721 --- /dev/null +++ b/launch/display_highbay_swarm.launch @@ -0,0 +1,8 @@ + + + map + $(find lab_gazebo)/worlds/highbay_swarm_world/meshes + + + + From e8d5de038c09f0a5c8fa8a2ed9f6dda8f2920f3a Mon Sep 17 00:00:00 2001 From: Burak Aksoy Date: Mon, 12 Jun 2023 10:48:28 -0400 Subject: [PATCH 4/7] make python3 --- scripts/object_visualizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/object_visualizer.py b/scripts/object_visualizer.py index 8c1a1b9..6e2c29f 100755 --- a/scripts/object_visualizer.py +++ b/scripts/object_visualizer.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 import os import rospy import rospkg From 68e8b54d8c7420c50f546a9cef1a30fe3c14bf63 Mon Sep 17 00:00:00 2001 From: Burak Aksoy Date: Thu, 5 Oct 2023 17:23:01 -0400 Subject: [PATCH 5/7] decrease rate --- launch/display_highbay_swarm.launch | 6 +++--- scripts/object_visualizer.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/launch/display_highbay_swarm.launch b/launch/display_highbay_swarm.launch index e920721..98428c6 100644 --- a/launch/display_highbay_swarm.launch +++ b/launch/display_highbay_swarm.launch @@ -1,8 +1,8 @@ - map - $(find lab_gazebo)/worlds/highbay_swarm_world/meshes - + map + $(find lab_gazebo)/worlds/highbay_swarm_world/meshes + diff --git a/scripts/object_visualizer.py b/scripts/object_visualizer.py index 6e2c29f..cada6ff 100755 --- a/scripts/object_visualizer.py +++ b/scripts/object_visualizer.py @@ -5,7 +5,7 @@ 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') From 7705e1cb09dab6ea792c7136dea01e3473625007 Mon Sep 17 00:00:00 2001 From: Burak Aksoy Date: Thu, 5 Oct 2023 17:49:58 -0400 Subject: [PATCH 6/7] debug --- scripts/object_visualizer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/object_visualizer.py b/scripts/object_visualizer.py index cada6ff..d2ede29 100755 --- a/scripts/object_visualizer.py +++ b/scripts/object_visualizer.py @@ -33,7 +33,8 @@ rospy.loginfo('Loading file: %s', file) marker = Marker() marker.id = marker_id - marker.mesh_resource = "file://" + visualizer_path + "/" + file + # marker.mesh_resource = "file://" + visualizer_path + "/" + file + marker.mesh_resource = "file:/" + os.path.join(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 = frame From bb3d8435a2d83481ed19941f289fb371f25c5de7 Mon Sep 17 00:00:00 2001 From: Burak Aksoy Date: Thu, 5 Oct 2023 17:55:41 -0400 Subject: [PATCH 7/7] debug --- scripts/object_visualizer.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/object_visualizer.py b/scripts/object_visualizer.py index d2ede29..cada6ff 100755 --- a/scripts/object_visualizer.py +++ b/scripts/object_visualizer.py @@ -33,8 +33,7 @@ rospy.loginfo('Loading file: %s', file) marker = Marker() marker.id = marker_id - # marker.mesh_resource = "file://" + visualizer_path + "/" + file - marker.mesh_resource = "file:/" + os.path.join(visualizer_path, 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 = frame