0

I am trying to add a custom mesh (a torus) .dae file for collision and visual to my .sdf model.

When I run my program, drake visualizer gives the following error

  File "/opt/drake/lib/python2.7/site-packages/director/lcmUtils.py", line 119, in handleMessage
    callback(msg)
  File "/opt/drake/lib/python2.7/site-packages/director/drakevisualizer.py", line 352, in onViewerLoadRobot
    self.addLinksFromLCM(msg)
  File "/opt/drake/lib/python2.7/site-packages/director/drakevisualizer.py", line 376, in addLinksFromLCM
    self.addLink(Link(link), link.robot_num, link.name)
  File "/opt/drake/lib/python2.7/site-packages/director/drakevisualizer.py", line 299, in __init__
    self.geometry.extend(Geometry.createGeometry(link.name + ' geometry data', g))
  File "/opt/drake/lib/python2.7/site-packages/director/drakevisualizer.py", line 272, in createGeometry
    polyDataList, visInfo = Geometry.createPolyDataFromFiles(geom)
  File "/opt/drake/lib/python2.7/site-packages/director/drakevisualizer.py", line 231, in createPolyDataFromFiles
    polyDataList = [ioUtils.readPolyData(filename)]
  File "/opt/drake/lib/python2.7/site-packages/director/ioUtils.py", line 25, in readPolyData
    raise Exception('Unknown file extension in readPolyData: %s' % filename)
Exception: Unknown file extension in readPolyData: /my_path/model.dae

Since prius.sdf also uses prius.dae, I assume this is possible. What am I doing wrong?

Rufus
  • 5,111
  • 4
  • 28
  • 45

1 Answers1

1

tl;dr drake_visualizer doesn't load dae files. If you put a similarly named .obj file in the same folder it will load that (and you can leave your sdf file still referencing the dae file).

Long answer:

drake_visualizer has a very specific, arbitrary protocol for loading files. Given an arbitrary file name (e.g., my_geometry.dae) it will

  1. Strip off the extension.
  2. Try the following files (in order), loading the first one it finds:
    • my_geometry.vtm
    • my_geometry.vtp
    • my_geometry.obj
    • original extension.

It can load: vtm, vtp, ply, obj, and stl files.

The worst thing is if you have both a vtp and an obj file in the same folder with the same name and you specify the obj, it'll still favor the vtp file.

Sean Curtis
  • 1,425
  • 7
  • 8