- changed status to open
[Research] Can we write a script to load an SDF in Drake?
A basic program that takes a path with an SDF file and loads it into the Drake visualizer.
02/03/2017 - SP2
Comments (23)
-
-
I got a sample project inside Drake's repository structure at the same level of automotive sample. Also, I included a model like the sample box in the box plugin. From this script, which loads the complete demo, I could only try to load drake_visualizer and then my application but I got no model visualized neither recognized by the visualizer. At this moment what I could get is the following:
- You have this class structure: systems::System <--systems::LeafSystem <-- autormotive::SimpleCar which manages the car states through time. I had a child of LeafSystem with an empty implementation of the methods.
- systems::DiagramBuilder class can add Systems to your simulation. You have to add at least one system and then build them. Once you build it, you get a systems::Diagram which is necessary to get a systems::Simulator. This last class is the one that manages the complete simulation process.
Also, I tried the sdf samples and I got this output console:
[2017-02-06 14:34:10.426] [console] [info] Adding joint chassis_floor_axle to the plant. [2017-02-06 14:34:10.426] [console] [info] Adding joint steering to the plant. [2017-02-06 14:34:10.426] [console] [info] Adding joint left_hub to the plant. [2017-02-06 14:34:10.426] [console] [info] Adding joint left_pin to the plant. [2017-02-06 14:34:10.426] [console] [info] Adding joint left_wheel_joint to the plant. [2017-02-06 14:34:10.426] [console] [info] Adding joint axle_tie_rod_arm to the plant. [2017-02-06 14:34:10.426] [console] [info] Adding joint right_hub to the plant. [2017-02-06 14:34:10.427] [console] [info] Made joint right_pin a loop joint. [2017-02-06 14:34:10.427] [console] [info] Adding joint right_wheel_joint to the plant. [2017-02-06 14:34:10.427] [console] [info] Adding joint chassis_rear_axle to the plant. [2017-02-06 14:34:10.427] [console] [info] Adding joint rear_left_wheel_joint to the plant. [2017-02-06 14:34:10.427] [console] [info] Adding joint rear_right_wheel_joint to the plant. [2017-02-06 14:34:10.427] [console] [info] Adding joint body to the plant.
I guess I'm on the way. I'll take a deeper look in the sample trying to complete the code a bit more to get something visualized.
-
Got a box loaded into Drake but the program fails with a Segmentation fault (core dumped). We need further development on this.
-
Further research show that when calling simulator->Initialize() method the program breaks. I tried to catch any exceptions but got no luck with it.
-
reporter - changed component to SP 3
- edited description
-
-
Using darpa_box.world I could get the following:
Just two minor modifications were made to the world file:
- Removed the plugin node
- Changed the file extension from ".world" to ".sdf" due to Drake's support.
There are some rotated boxes, but this should be easily solved.
-
reporter +100, great job @agalbachicar !
-
Just for the record. Here is some information on how to load meshes into drake visualizer. http://drake.mit.edu/models.html#mesh-file-format
-
I have tested some variations of the mesh, with obj and dae formats and both fail with the following:
ERROR: In /build/buildd/vtk-5.8.0/IO/vtkOBJReader.cxx, line 192 vtkOBJReader (0x32d1b70): Error reading 'v' at line 1 ERROR: In /build/buildd/vtk-5.8.0/Graphics/vtkTransformPolyDataFilter.cxx, line 84 vtkTransformPolyDataFilter (0x32d42c0): No input data ERROR: In /build/buildd/vtk-5.8.0/IO/vtkOBJReader.cxx, line 192 vtkOBJReader (0x32d38a0): Error reading 'v' at line 1 ERROR: In /build/buildd/vtk-5.8.0/Graphics/vtkTransformPolyDataFilter.cxx, line 84 vtkTransformPolyDataFilter (0x32ded10): No input data
I'll need to dive into the examples a bit more to see the differences in code and in the sdf/urdf files.
-
Some tests yesterday ended up in the following:
- VTK is the rendering engine of Drake
- We can do the following:
drake_visualizer
-->File
-->Open data
and open aobj
file. This is totally valid. - VTK uses the locale numeric configuration. So the floating point separator depends on LC_NUMERIC value in your environment. For example, if it is
es_AR.UTF-8
, the separator will be a ' , ', but if it isC
the separator will be ' . '. So files generated with different locales probably will fail due to the env configuration of the system at the running time.
-
reporter Ahh, nice catch! I was seeing that error too! Just form the top of my head, how about running with
$ LC_ALL=C drake-visualizer
? -
In fact it was on of the Drake's developer that realized of that. And your suggestion works perfectly!
-
reporter :+1:
-
Matthew Woehlke, one of the Drake's developers, posted an issue in VTK repository after some tests with bare code from VTK (using a Python console that the project provides). We found there that VTK Python console overrides the locale configuration, so you won't get that error with ',' floating point separator. Here is the link --> https://gitlab.kitware.com/vtk/vtk/issues/16981
From C++ code, VTK uses the current locale, so it will adapt to the environment.
-
This code compiles inside drake's repository structure with Bazel. refs
#80→ <<cset 99c6aa4dc8f3>>
-
Added a script in python that runs the visualizer and our program. refs
#80→ <<cset 0783fb765130>>
-
Loaded a box into Drake but program finished with a Segmentation fault (core dumped). refs
#80→ <<cset 5e1723ee1dbb>>
-
Added logs messages. It breaks when calling Initialize. refs
#80→ <<cset 1f85311504c8>>
-
Added program that loads a sample (box model) SDF into Drake visualizer. refs
#80→ <<cset df885dc6d402>>
-
Sample working and loading DARPA sample inside Drake simulator. refs
#80→ <<cset a86e1a307eb2>>
-
- changed status to closed
-
- changed status to resolved
- Log in to comment