# How to load URDF files with .dae models into MeshCat?

**URL:** <https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509>\
**Category:** Modelling & Simulations\
**Created:** [January 11, 2019, 9:56am UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509 "2019-01-11T09:56:30Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![cserteGT3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csertegt3/32/8283_2.png) [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Post date:** [January 11, 2019, 9:56am UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509/1 "2019-01-11T09:56:30Z")

</div>

I’m trying to use the JuliaRobotics ecosystem with UR robotic arms and can not find a way to open the [official URDF-s](https://github.com/ros-industrial/universal_robot). My problem is, that `.dae` files are not supported, and if I convert those files to `.obj`, then the model is placed wrongly into the scene:

 ![meshcat](https://global.discourse-cdn.com/julialang/original/3X/8/e/8e5e181f8fbdaec56ce94a99f2385c55260c6657.png)  
My question is that, is there a way to load these “original files” without modification? Or I have to modify/build my own URDF-s? I decided to post this question, because that’s the first time I use this format, so I’m not confident with it (yet).

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 11, 2019, 1:25pm UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509/2 "2019-01-11T13:25:11Z")

</div>

Unfortunately, MeshIO.jl doesn’t support native loading of `.dae` files yet (see [More formats · Issue #11 · JuliaIO/MeshIO.jl · GitHub](https://github.com/JuliaIO/MeshIO.jl/issues/11)), so conversion to `.obj` is necessary for now. MechanismGeometries.jl does automatically replace the `.dae` extension with `.obj` though, so you shouldn’t have to edit the URDF, but it prints a warning. If you want to get rid of that warning, you could do

```julia
using Logging # from stdlib
with_logger(ConsoleLogger(stderr, Base.CoreLogging.Error)) do
    # load the URDF
end

```

Some questions to get started:

- exactly which xacro file are you using?
- how are you calling xacro?
- which tool are you using to convert to `.obj`?

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [January 11, 2019, 1:36pm UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509/3 "2019-01-11T13:36:05Z")

</div>

In addition to what Twan said, I do have an experimental branch of MeshIO that adds .dae file support, and you’re welcome to try it out. You can add my branch with: `pkg> add https://github.com/rdeits/MeshIO.jl#rd/dae-support` .

Since this branch is still experimental, you’ll also need to tell `FileIO` that the `.dae` format exists and that `MeshIO` can handle it:

```julia
julia> FileIO.add_format(format"DAE", (), ".dae")
DataFormat{:DAE}

julia> FileIO.add_loader(format"DAE", :MeshIO)
1-element Array{Symbol,1}:
 :MeshIO

```

I’d be really curious to hear if that works well enough to load your UR10 model. If not, we can either try to fix the .dae loader or figure out what went wrong with your conversion to .obj.

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 12, 2019, 5:19am UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509/4 "2019-01-12T05:19:29Z")

</div>

@rdeits, I’ve rebased your MeshIO branch and added LightXML to the `REQUIRE` file: [GitHub - tkoolen/MeshIO.jl at tk/dae-support-updates](https://github.com/tkoolen/MeshIO.jl/tree/tk/dae-support-updates). I’ve also rebased the accompanying `dae-geometry` branch of MechanismGeometries onto master and removed dead code: [GitHub - JuliaRobotics/MechanismGeometries.jl at tk/dae-geometries-updates](https://github.com/JuliaRobotics/MechanismGeometries.jl/tree/tk/dae-geometries-updates). Furthermore, we’ll need [GitHub - tkoolen/FileIO.jl at tk/dae](https://github.com/tkoolen/FileIO.jl/tree/tk/dae).

I created a git repo with my setup (contains URDF, DAE meshes, toml files, and a script): [https://github.com/tkoolen/universal-robot-dae-jl](https://github.com/tkoolen/universal-robot-dae-jl)

It’s not working quite yet:

```julia
Error encountered while loading "ur_description/meshes/ur10/visual/shoulder.dae".
Fatal error:
ERROR: LoadError: MethodError: no method matching read_polylist(::Nothing)
Closest candidates are:
  read_polylist(::LightXML.XMLElement) at /Users/tkoolen/.julia/packages/MeshIO/SVI0R/src/io/dae.jl:28

```

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 12, 2019, 5:33am UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509/5 "2019-01-12T05:33:28Z")

</div>

Converting to `.obj` works fine for me by the way:

 ![meshcat(1)](https://global.discourse-cdn.com/julialang/original/3X/a/2/a29f8d7c4ccbc20171804bd5194ba6805a8c52e6.png)

I used [MeshLab](http://www.meshlab.net/) to do the conversion. Run

```bash
for file in *.dae; do
    meshlabserver -i "$file" -o "${file%.*}.obj" # -om vc
done

```

in the `visuals` directory.

Note: on OSX, following [meshlabserver doesn't load on macOS - dyld: Library not loaded: @rpath/QtOpenGL.framework/Versions/5/QtOpenGL · Issue #64 · cnr-isti-vclab/meshlab · GitHub](https://github.com/cnr-isti-vclab/meshlab/issues/64#issuecomment-280917011), I needed to run

```bash
cd /Applications/meshlab.app/Contents/MacOS
install_name_tool -add_rpath "@executable_path/../Frameworks” meshlabserver

```

and I added the directory containing `meshlabserver` (`/Applications/meshlab.app/Contents/MacOS` for me) to my `PATH`.

---

<div class="post-metadata">

**Author:** ![cserteGT3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csertegt3/32/8283_2.png) [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Post date:** [January 16, 2019, 12:37pm UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509/6 "2019-01-16T12:37:34Z")

</div>

I cloned the repo, then

```shell
$ cd universal_robot/ur_description/urdf
$ xacro --inorder u10_robot.urdf.xacro > ur10_original.urdf

```

(I have a feeling that is not the way that it should be done, but does the trick. Probably I should use ROS’s package environment variable or something like that.)

For converting the files, I used the first online tool I found: [meshconvert.com](https://www.meshconvert.com/). I know it’s not an ideal solution, I will definitely will check MeshLab!  
I assume that this converter hacked the coordinate frames which caused my issue.  
(I will check later your other responses too!)

---

<div class="post-metadata">

**Author:** ![cserteGT3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csertegt3/32/8283_2.png) [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Post date:** [January 16, 2019, 2:02pm UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509/7 "2019-01-16T14:02:31Z")

</div>

I couldn’t get it working. Maybe it’s the issue with the LightXML dependency.  
I got the “same” warning as before:

```julia
┌ Warning: Could not find the mesh file: package://ur_description/meshes/ur10/visual/wrist2.obj. I t
ried substituting the following folders for the 'package://' prefix: ["C:\\Users\\cstamas\\Documents
\\SZTAKI\\juhulia\\Julia-Mesh-Test"]. Note that I replaced the file's original extension with .obj t
o try to find a mesh in a format I can actually load.

```

If it’s not problem I wouldn’t go into debugging this on my installation as @tkoolen merged the “issue” into one repo.

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 16, 2019, 4:22pm UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509/8 "2019-01-16T16:22:05Z")

</div>

To be clear, the repo I created is set up for debugging the native `.dae` file support (not working yet), not for loading the `.obj`s.

Does the file `C:\Users\cstamas\Documents\SZTAKI\juhulia\Julia-Mesh-Test\ur_description\meshes\ur10\visual\wrist2.obj` exist?

You may have to use the `package_path` keyword argument for `URDFVisuals` (see [GitHub - JuliaRobotics/MechanismGeometries.jl: Parsing and generation of 3D geometries for robot mechanisms in Julia](https://github.com/JuliaRobotics/MechanismGeometries.jl#urdf-visuals)), which defaults to `ros_package_path() = split(get(ENV, "ROS_PACKAGE_PATH", ""), ':')` (an empty string array if the `ROS_PACKAGE_PATH` environment variable isn’t set). But then again you were apparently able to load meshes (even if they weren’t the right ones) before, so not sure what’s going wrong now.

---

<div class="post-metadata">

**Author:** ![cserteGT3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csertegt3/32/8283_2.png) [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Post date:** [January 17, 2019, 8:13am UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509/9 "2019-01-17T08:13:53Z")

</div>

> To be clear, the repo I created is set up for debugging the native `.dae` file support (not working yet), not for loading the `.obj` s.

Yes, I’m aware of it, I was just going through every answer and checked them with my configuration.

> Does the file `C:\Users\cstamas\Documents\SZTAKI\juhulia\Julia-Mesh-Test\ur_description\meshes\ur10\visual\wrist2.obj` exist?

No, it doesn’t, I was trying to parse the `.dae` files with @rdeits MeshIO branch.

After that, I tried your repo:

> I created a git repo with my setup (contains URDF, DAE meshes, toml files, and a script): [https://github.com/tkoolen/universal-robot-dae-jl](https://github.com/tkoolen/universal-robot-dae-jl)

As expected I got the same `MethodError` as you.  
I had some troubles with MeshLab, but now it’s working fine and the converted `.obj`-s are also perfect.

I appreciate your help and detailed answers!  
Also thank your for the JuliaRobotics ecosystem, these packages are very helpful for my work!

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 17, 2019, 12:29pm UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509/10 "2019-01-17T12:29:37Z")

</div>

> [@cserteGT3](#):
>
> No, it doesn’t, I was trying to parse the `.dae` files with @rdeits MeshIO branch.

Ah, I thought you meant the `.obj` route wasn’t working.

> [@cserteGT3](#):
>
> I appreciate your help and detailed answers!  
> Also thank your for the JuliaRobotics ecosystem, these packages are very helpful for my work!

Thanks, and glad to hear! I hope we can get the native `.dae` support working soonish. I’m afraid I’m stretched a little thin, so for anybody watching this thread, this would be a great way to contribute.

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [May 15, 2019, 5:17am UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509/11 "2019-05-15T05:17:42Z")

</div>

We’ve made some progress on loading other file formats, also reflected in [https://github.com/tkoolen/universal-robot-dae-jl](https://github.com/tkoolen/universal-robot-dae-jl). The collision geometry for the UR10 (STL files) now loads natively with various experimental branches of packages (be sure to `] instantiate`), but there still seems to be an issue with the visual geometry (DAE files), see [https://github.com/JuliaRobotics/MeshCatMechanisms.jl/pull/32#issuecomment-492505096](https://github.com/JuliaRobotics/MeshCatMechanisms.jl/pull/32#issuecomment-492505096).

---

<div class="post-metadata">

**Author:** ![cserteGT3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csertegt3/32/8283_2.png) [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Post date:** [May 15, 2019, 6:54am UTC](https://discourse.julialang.org/t/how-to-load-urdf-files-with-dae-models-into-meshcat/19509/12 "2019-05-15T06:54:13Z")

</div>

Thank you!  
I’ll definitely test it, but I have to finish my semester before…
