Ask Your Question

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

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

AlexROS gravatar image

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


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

1 Answer

Sort by ยป oldest newest most voted

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

gvdhoorn gravatar image

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

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 -0500 )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 -0500 )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 -0500 )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 -0500 )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 -0500 )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 -0500 )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 -0500 )edit

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

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

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 -0500

Seen: 5,044 times

Last updated: Jul 31 '17