ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to import 3D Model COLLADA (.dae) file to RVIZ

asked 2017-07-27 15:41:17 -0600

AlexROS gravatar image

updated 2017-07-31 04:30:46 -0600


I am new to ROS and I am having problems importing a 3D Model of a formula car (COLLADA file) i got from 3D warehouse to RVIZ. This is the COLLADA file:


This is my code. It is working for a simple cube as marker. Now I wanted to change the cube to this formula car using the marker type "visualization_msgs::Marker::MESH_RESOURCE"

visualization_msgs::Marker marker;
marker.header.frame_id = "/my_frame";
marker.header.stamp = ros::Time::now();
marker.ns = "myns"; = k+current_cone_pos.left.x.size()+current_cone_pos.right.x.size()+1;
marker.type = visualization_msgs::Marker::MESH_RESOURCE;
marker.action = visualization_msgs::Marker::ADD;
marker.mesh_resource = "file://models/v1-01/model.dae";
marker.pose.position.x = 0;
marker.pose.position.y = 0;
marker.pose.position.z = 0;
marker.pose.orientation.x = 0.0;
marker.pose.orientation.y = 0.0;
marker.pose.orientation.z = 0.0;
marker.pose.orientation.w = 1.0;
marker.scale.x = 0.1;
marker.scale.y = 0.5;
marker.scale.z = 0.5;
marker.color.b = 0.0f;
marker.color.g = 0.0f;
marker.color.r = 1.0;
marker.color.a = 1.0;
marker.lifetime = ros::Duration();

The error that i get using "rosrun rviz rviz" while running my C++ Node is:

Could not load resource [file://models/v1-01/model.dae]: Unable to open file "file://models/v1-01/model.dae".

Thank you guys for your support!

Greetings, Alex

edit retag flag offensive close merge delete


Hi, Alex, do you solved this problem?

David_ROS gravatar image David_ROS  ( 2021-11-24 19:51:02 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2017-07-28 03:46:24 -0600

gvdhoorn gravatar image

updated 2017-07-28 03:47:20 -0600

if models is a ROS package, then you should use package://, not file://.

if it's a directory somewhere on your filesystem, use an absolute path (ie: file:///path/to/where/models/is/..).

See the documentation for wiki/rviz/DisplayTypes/Marker - Mesh Resource which explains all of this.

edit flag offensive delete link more


Still not working.

I have tried the absolute path with the following line of code:

marker.mesh_resource = "file://home/alex/catkin_ws/models/v1-01/model.dae";

It still does not work. Do i need any additional urdf file or so? Models ist just a file in which the model is stored, not a ros package

AlexROS gravatar image AlexROS  ( 2017-07-28 04:01:26 -0600 )edit

Note the additional /: this may seem strange, but file:// (with two /) is the scheme, the path starts only after that. So for an absolute path, you need to have three consecutive forward slashes.

gvdhoorn gravatar image gvdhoorn  ( 2017-07-28 04:03:49 -0600 )edit

Okay now the error has gone away. But the car is still not visible in rviz

AlexROS gravatar image AlexROS  ( 2017-07-28 04:10:15 -0600 )edit

one thing to check: ROS uses meters for everything, so make sure your mesh is scaled to that as well (most exports from 3D modellers are in mm).

gvdhoorn gravatar image gvdhoorn  ( 2017-07-28 04:25:08 -0600 )edit

I tried to set the scale parameters to 1000. But that still does not solve the problem. :-/ Did you have a look at the link of the formula car? Is the file format suitable? Do i need an urdf file maybe?

AlexROS gravatar image AlexROS  ( 2017-07-28 06:21:29 -0600 )edit

Let's eliminate some variables here: try to get things to work with a very simple Collada file (a cube with a single colour). Once that works, we can look at the car model.

gvdhoorn gravatar image gvdhoorn  ( 2017-07-28 07:06:03 -0600 )edit

It worked with this simple cube: [LINK] ( )

So maybe it is because of the texture that the car has. I tried to do this with the car:

marker.mesh_use_embedded_materials = true;

But it didnt help.

AlexROS gravatar image AlexROS  ( 2017-07-28 07:57:39 -0600 )edit

Try installing Meshlab. Import the dae then export it as binary.

AndyZe gravatar image AndyZe  ( 2017-08-01 13:45:41 -0600 )edit

answered 2022-08-20 20:31:16 -0600

vonunwerth gravatar image

Based on the visualization_msgs markers of RViz I wrote a small package that makes it easy to load meshes into RViz as textured objects.

It simply loads all files which were put inside its meshes folder and publishes them to the visualization_marker topic. And even dynamically! When a new object is added to the folder, it appears (or is published) in RViz. If an object is deleted, it also disappears from the published models.

It also contains a launch file which just takes everything which is inside the meshes folder, opens up RViz with a suitable perspektive and visualizes the 3D files.

Just check it out here:

image description

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2017-07-27 15:37:08 -0600

Seen: 6,344 times

Last updated: Aug 20