Coder Social home page Coder Social logo

weiqiao / drakevisualizer.jl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rdeits/drakevisualizer.jl

0.0 2.0 0.0 168 KB

Interface to the RobotLocomotion Drake Visualizer tool from Julia

License: Other

Jupyter Notebook 49.92% Julia 50.08%

drakevisualizer.jl's Introduction

DrakeVisualizer

Build Status codecov

This package provides a Julia interface to the Drake Visualizer, part of the Drake project and built on top of Director, a highly customizable 3D interface for robotics visualization and interaction.

Installation

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 DIRECTOR_BUILD_FROM_SOURCE=1.

Dependencies

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. Director requires VTK5 with Qt4 and the python bindings. These packages are available via apt-get as:

libvtk5-qt4-dev
python-vtk
python-numpy

On Arch Linux, you can install an appropriate version of VTK by running:

git clone https://aur.archlinux.org/vtk-multi-python.git
cd vtk-multi-python
makepkg -si

Troubleshooting

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:

julia> DrakeVisualizer.delete_director_binaries()

After which you will need to re-download the binaries with:

julia> Pkg.build("DrakeVisualizer")

Linux: Configuring Large UDP Packets

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:

net.core.rmem_max=2097152
net.core.rmem_default=2097152

Launching the Viewer

You can launch the viewer application with

julia> DrakeVisualizer.new_window()

which is just a convenience wrapper around a call to the drake-visualizer executable, included in the director binaries or source installation.

Usage:

This package makes use of GeometryTypes.jl to represent robot geometries and CoordinateTransformations.jl to represent spatial transformations. Check out demo.ipynb for some examples of usage.

Geometric Primitives

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)

box

sphere = HyperSphere(Point(0., 0, 0), 1.0)
model = Visualizer(sphere)

sphere

Once a Visualizer model has been created, it can be rendered at arbitrary positions and orientations:

using CoordinateTransformations
draw(model, [Translation(1.,0,0)])

DrakeVisualizer can also render mesh data:

using MeshIO
using FileIO
cat = load(joinpath(Pkg.dir("GeometryTypes"), "test", "data", "cat.obj"))
Visualizer(cat)

cat mesh

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)

custom function contour mesh

For more visualizations, including moving and rotating visualized elements, and visualizing the level sets of functions, check out demo.ipynb.

drakevisualizer.jl's People

Contributors

rdeits avatar tkoolen avatar blegat avatar tkelman avatar dehann avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.