Note: While this package should still work, active development has been moved to MeshCat.jl, which offers more features and a much less complicated set of dependencies.
DrakeVisualizer.jl uses BinDeps.jl to try to automatically install an appropriate copy of Director for you. On Ubuntu (14.04 and higher) and macOS, this package will attempt to download the pre-built binaries of Director from http://people.csail.mit.edu/patmarion/software/director/. On other Linux platforms, it will compile Director from source. If you would like to force Director to build from source on any platform, just set the environment variable
On Ubuntu (14.04 and up) and macOS, all of Director's dependencies will automatically be installed using BinDeps.jl. On other platforms, you'll need to provide them yourself. The required packages are available via
libqt4-dev libqt4-opengl-dev python-numpy python-dev
If you have issues with the Director application itself (like your geometry not showing up), you may have an out-of-date version of the Director binaries. To clear the downloaded binaries, you can run:
After which you will need to re-download the binaries with:
DrakeVisualizer uses LCM for communication, and LCM uses UDP under the hood. Very large LCM messages (like those created when loading a robot with lots of mesh geometries) can result in UDP packets being dropped, which will result in you not seeing anything in the visualizer. If that happens to you, you'll need to follow the instructions in this comment. Edit
/etc/sysctl.conf and add:
You can launch the viewer application with
which is just a convenience wrapper around a call to the
drake-visualizer executable, included in the
director binaries or source installation.
Geometric primitives from GeometryTypes.jl can be visualized directly:
using DrakeVisualizer using GeometryTypes box = HyperRectangle(Vec(0.,0,0), Vec(1.,1,1)) model = Visualizer(box)
sphere = HyperSphere(Point(0., 0, 0), 1.0) model = Visualizer(sphere)
Once a Visualizer model has been created, it can be rendered at arbitrary positions and orientations:
using CoordinateTransformations settransform!(model, Translation(1.0, 0.0, 0.0))
DrakeVisualizer can also render mesh data:
using MeshIO using FileIO cat = load(joinpath(Pkg.dir("GeometryTypes"), "test", "data", "cat.obj")) Visualizer(cat)
And it can even generate 3D contours from functions:
# First, we'll define our function: f = x -> sum(sin, 5 * x) # Then we pick a region of interest in which to sample the function. # This region starts at (-1, -1, -1) and extends to (1, 1, 1): lower_bound = Vec(-1.,-1,-1) upper_bound = Vec(1., 1, 1) # contour_mesh constructs a mesh representing an approximation of # the surface in 3D space for which f(x) = 0 mesh = contour_mesh(f, lower_bound, upper_bound) Visualizer(mesh)
For more visualizations, including moving and rotating visualized elements, and visualizing the level sets of functions, check out demo.ipynb.
14 days ago