Issues loading mesh for Rviz

asked 2021-06-23 16:51:03 -0500

lukefarritor gravatar image

updated 2022-03-25 17:36:20 -0500

lucasw gravatar image

Hello all,

I'm using python with ros2 foxy and am trying to display an rviz mesh marker. I have my mesh as a .dae file exported from blender. I'm getting the following Rviz error: [rviz2]: Could not load resource [package://motor_viz/skid_steer.dae]: Unable to open file "package://motor_viz/skid_steer.dae".. Here is my code that defines the marker:

skid_steer = Marker()
skid_steer.id = 4
skid_steer.header.frame_id = "/laser_data_frame"
skid_steer.type = skid_steer.MESH_RESOURCE
skid_steer.mesh_resource = "package://motor_viz/skid_steer.dae"
skid_steer.action = skid_steer.ADD
skid_steer.scale.x = 1.0
skid_steer.scale.y = 1.0
skid_steer.scale.z = 1.0
skid_steer.color.r = 1.0
skid_steer.color.g = 1.0
skid_steer.color.b = 1.0
skid_steer.color.a = 1.0
skid_steer.pose.orientation.y = 1.5708
skid_steer.pose.orientation.w = 1.0
skid_steer.pose.position.x = 0.0
skid_steer.pose.position.y = 0.0
skid_steer.pose.position.z = 0.0

markers = MarkerArray()
markers.markers = [motor_body, motor_shaft, arm, skid_steer]
self.publisher_.publish(markers)

I have no issues displaying other the other markers (motor_body, motor_shaft, arm) which are primitives like cube and cylinder. I presume the issue is with where I'm placing the .dae file? I've tried placing it in src/motor_viz/skid_steer.dae, src/motor_viz/motor_viz/skid_steer.dae as well as src/motor_viz/resource/skid_steer.dae.

Any help would be greatly appreciated!

edit retag flag offensive close merge delete

Comments

What happens if you pass the absolute path to the file? Like: "file:///motor_viz/skid_steer.dae"

Andromeda gravatar image Andromeda  ( 2022-05-24 08:35:20 -0500 )edit