Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,6 @@ mosek_repository(
name = "mosek",
)

load("//tools:soft_failure.bzl", "soft_failure_binary_repository")
soft_failure_binary_repository(
name = "drake_visualizer",
local_path = __workspace_dir__ + "/build/install/bin/drake-visualizer",
)

load("//tools:gfortran.bzl", "gfortran_repository")
gfortran_repository(
name = "gfortran",
Expand Down Expand Up @@ -360,3 +354,8 @@ pkg_config_package(
name = "zlib",
modname = "zlib",
)

load("//tools:director.bzl", "director_repository")
director_repository(
name = "director",
)
2 changes: 1 addition & 1 deletion drake/automotive/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ py_binary(
":automotive_demo",
":lcm-spy",
":steering_command_driver",
"@drake_visualizer//:drake-visualizer",
"//tools:drake_visualizer",
"@lcm//:lcm-logger",
],
main = "automotive_demo.py",
Expand Down
19 changes: 0 additions & 19 deletions drake/automotive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,6 @@ getting started with Bazel, see http://drake.mit.edu/bazel.html.
Note that the *libraries* in this directory subtree support the CMake build
system; only the demo is Bazel-specific.

Prepare the drake-visualizer
----------------------------

The ``drake-visualizer`` is only available via a CMake build. We recommend
that you run a CMake build per the Drake instructions, using the same source
tree as this demo. In that case, the ``drake-visualizer`` will automatically
be discovered and launched by this demo.

Otherwise, you will see a message like:

```
soft_failure.bzl: @drake_visualizer//:drake-visualizer does not work because
drake-distro/build/install/bin/drake-visualizer was missing
```

In this case, the automotive demo must be run with the ``--no-visualizer``
switch, and you will have to manually launch some other build of the
``drake-visualizer``.

Running the demos
-----------------

Expand Down
2 changes: 1 addition & 1 deletion drake/automotive/automotive_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def receive(channel, data):
def main():
demo_path = "drake/automotive/automotive_demo"
steering_command_driver_path = "drake/automotive/steering_command_driver"
drake_visualizer_path = "external/drake_visualizer/drake-visualizer"
drake_visualizer_path = "tools/drake_visualizer"
lcm_spy_path = "drake/automotive/lcm-spy"
lcm_logger_path = "external/lcm/lcm-logger"

Expand Down
9 changes: 9 additions & 0 deletions tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ sh_binary(
data = ["asan.supp"],
)

sh_binary(
name = "drake_visualizer",
srcs = select({
"//tools:apple": ["drake_visualizer_apple.sh"],
"//conditions:default": ["drake_visualizer_linux.sh"],
}),
data = ["@director"],
)

sh_binary(
name = "lsan",
srcs = ["lsan.sh"],
Expand Down
55 changes: 55 additions & 0 deletions tools/director.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# -*- mode: python -*-
# vi: set ft=python :

def _impl(repository_ctx):
if repository_ctx.os.name == "mac os x":
archive = "dd-0.1.0-160-ga50a077-qt-5.8.0-Darwin.tar.gz"
sha256 = "6873427eb417e03688e85ac59955777fda67f89781245f3146470c5156045691"
elif repository_ctx.os.name == "linux":
sed = repository_ctx.which("sed")

if not sed:
fail("Could NOT determine Linux distribution information because" +
" sed is missing")

result = repository_ctx.execute([
sed,
"-n",
"/^\(NAME\|VERSION_ID\)=/{s/[^=]*=//;s/\"//g;p}",
"/etc/os-release"])

if result.return_code != 0:
fail("Could NOT determine Linux distribution information",
attr=result.stderr)

distro = [l.strip() for l in result.stdout.strip().split("\n")]
distro = " ".join(distro)

if distro == "Ubuntu 14.04":
archive = "dd-0.1.0-160-ga50a077-qt-4.8.6-trusty-x86_64.tar.gz"
sha256 = "7d8e5bf66648edffc8f003d0c0a19c80745cdf7b5c9a524069b041dd67c865d1"
elif distro == "Ubuntu 16.04":
archive = "dd-0.1.0-160-ga50a077-qt-5.5.1-xenial-x86_64.tar.gz"
sha256 = "c4dbd896454a293c3bb65761763ce0571e83dd81b6986e1458073d88a7ef55c7"
else:
fail("Linux distribution is NOT supported", attr=distro)
else:
fail("Operating system is NOT supported", attr=repository_ctx.os.name)

url = "https://d2mbb5ninhlpdu.cloudfront.net/director/{}".format(archive)
root_path = repository_ctx.path("")

repository_ctx.download_and_extract(url, root_path, sha256=sha256)

file_content = """
filegroup(
name = "director",
srcs = glob(["**/*"]),
data = ["@vtk"],
visibility = ["//visibility:public"],
)
"""

repository_ctx.file("BUILD", content=file_content, executable=False)

director_repository = repository_rule(implementation = _impl)
7 changes: 7 additions & 0 deletions tools/drake_visualizer_apple.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

export DYLD_LIBRARY_PATH="external/director/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
# TODO(jamiesnape): Do not hard code absolute path to vtk@8.0.
export PYTHONPATH="external/director/lib/python2.7/dist-packages:/usr/local/opt/vtk@8.0/lib/python2.7/site-packages${PYTHONPATH:+:$PYTHONPATH}"

exec "external/director/bin/drake-visualizer" "$@"
6 changes: 6 additions & 0 deletions tools/drake_visualizer_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

export LD_LIBRARY_PATH="external/director/lib:external/vtk/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export PYTHONPATH="external/director/lib/python2.7/dist-packages:external/vtk/lib/python2.7/site-packages${PYTHONPATH:+:$PYTHONPATH}"

exec "external/director/bin/drake-visualizer" "$@"
112 changes: 0 additions & 112 deletions tools/soft_failure.bzl

This file was deleted.

21 changes: 9 additions & 12 deletions tools/vtk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Argument:
name: A unique name for this rule.
"""

VTK_MAJOR_MINOR_VERSION = "7.1"
VTK_MAJOR_MINOR_VERSION = "8.0"

def _vtk_cc_library(os_name, name, hdrs=None, visibility=None, deps=None,
header_only=False):
Expand Down Expand Up @@ -54,7 +54,7 @@ def _vtk_cc_library(os_name, name, hdrs=None, visibility=None, deps=None,

if not header_only:
linkopts = [
"-L/usr/local/opt/vtk@8.0/lib",
"-L/usr/local/opt/vtk@{}/lib".format(VTK_MAJOR_MINOR_VERSION),
"-l{}-{}".format(name, VTK_MAJOR_MINOR_VERSION),
]
else:
Expand All @@ -77,8 +77,8 @@ cc_library(

def _impl(repository_ctx):
if repository_ctx.os.name == "mac os x":
# TODO(jamiesnape): Use VTK_MAJOR_MINOR_VERSION instead of hard-coding.
repository_ctx.symlink("/usr/local/opt/vtk@8.0/include", "include")
repository_ctx.symlink("/usr/local/opt/vtk@{}/include".format(
VTK_MAJOR_MINOR_VERSION), "include")
repository_ctx.file("empty.cc", executable=False)

elif repository_ctx.os.name == "linux":
Expand All @@ -100,11 +100,11 @@ def _impl(repository_ctx):
distro = " ".join(distro)

if distro == "Ubuntu 14.04":
archive = "vtk-v7.1.1-1584-g28deb56-qt-4.8.6-trusty-x86_64.tar.gz"
sha256 = "709fb9a5197ee5a87bc92760c2fe960b89326acd11a0ce6adf9d7d023563f5d4"
archive = "vtk-v8.0.0.rc2-qt-4.8.6-trusty-x86_64.tar.gz"
sha256 = "78880d8b951355a6ad5a6bfc42275ae42f31e2e05f1b52e3a9883226556b1685"
elif distro == "Ubuntu 16.04":
archive = "vtk-v7.1.1-1584-g28deb56-qt-5.5.1-xenial-x86_64.tar.gz"
sha256 = "d21cae88b2276fd59c94f0e41244fc8f7e31ff796518f731e4fffc25f8e01cbc"
archive = "vtk-v8.0.0.rc2-qt-5.5.1-xenial-x86_64.tar.gz "
sha256 = "963f81abd90da4470df1fb20aee8b4ead815f543f3ae9fa00ef2ea6be5cc2c0c"
else:
fail("Linux distribution is NOT supported", attr=distro)

Expand Down Expand Up @@ -487,7 +487,4 @@ filegroup(

repository_ctx.file("BUILD", content=file_content, executable=False)

vtk_repository = repository_rule(
local = True,
implementation = _impl,
)
vtk_repository = repository_rule(implementation = _impl)