pydrake.visualization.model_visualizer
The model_visualizer
program displays a model file (e.g., *.sdf
) in
Drake’s built-in visualizers (MeshCat and/or Meldis). When viewing in MeshCat,
joint sliders to posture the model are available by clicking on “Open Controls”
in the top right corner.
If the loaded model file is changed, it can be reloaded by pressing the “Reload Model Files” button, which will attempt to maintain slider values once reloading is finished. To exit, press the “Stop Running” button or press the Escape key.
This command-line module is provided for convenience, but the feature is also
available via the library class pydrake.visualization.ModelVisualizer
.
From a Drake source build, run this module as:
bazel run //tools:model_visualizer -- --help
From a Drake binary release (including pip releases), run this module as:
python3 -m pydrake.visualization.model_visualizer --help
For binary releases (except for pip) there is also a shortcut available as:
/opt/drake/bin/model_visualizer
Refer to the instructions printed by --help
for additional details.
An example of viewing an iiwa model file:
python3 -m pydrake.visualization.model_visualizer --open-window \
package://drake_models/iiwa_description/sdf/iiwa7_with_box_collision.sdf
This program respects the ROS_PACKAGE_PATH
; if your model uses external
resources then you will need to set that environment variable.