Skip to content

Commit

Permalink
[geometry] Establish Meshcat in C++ (step 3)
Browse files Browse the repository at this point in the history
Implements the most essential elements of the Meshcat API:
- Added SceneTree data structure.
- Added stduuid (to create the uuid's required by meshcat)
- Added SetObject from Shape, Rgba
  - Supports all shapes that meshcat_visualizer.py supports (more, in fact)
  - Does not support texture maps yet.
- Added SetTransform
- Added Delete
- Added SetProperty<double>
- Added HasPath, GetPacked* methods, primarily for testing.

This PR is > 500 lines, but a significant portion of this commit is relatively boilerplate management of the msgpack data structures used to communicate with the javascript client.

Updated the meshcat_manual_test to step the user through the checks.
Updated meschat_test to hammer on the new API.
  • Loading branch information
RussTedrake committed Aug 24, 2021
1 parent febbb91 commit 0ffc214
Show file tree
Hide file tree
Showing 11 changed files with 1,122 additions and 79 deletions.
28 changes: 26 additions & 2 deletions geometry/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,18 @@ drake_cc_library(
],
)

drake_cc_library(
name = "meshcat_types",
hdrs = ["meshcat_types.h"],
install_hdrs_exclude = ["meshcat_types.h"],
tags = [
"exclude_from_libdrake",
"exclude_from_package",
],
visibility = ["//:__subpackages__"],
deps = ["@msgpack"],
)

drake_cc_library(
name = "meshcat",
srcs = ["meshcat.cc"],
Expand All @@ -352,10 +364,15 @@ drake_cc_library(
"@meshcat//:dist/main.min.js",
],
deps = [
":meshcat_types",
":rgba",
":shape_specification",
"//common:essential",
"//common:find_resource",
"//common:unused",
"//math:geometric_transform",
"@msgpack",
"@stduuid",
"@uwebsockets",
],
)
Expand All @@ -364,6 +381,7 @@ drake_cc_binary(
name = "meshcat_manual_test",
testonly = True,
srcs = ["test/meshcat_manual_test.cc"],
data = ["//systems/sensors:test_models"],
visibility = ["//visibility:private"],
deps = [":meshcat"],
)
Expand All @@ -377,11 +395,17 @@ drake_py_binary(

drake_cc_googletest(
name = "meshcat_test",
data = [":meshcat_websocket_client"],
data = [
":meshcat_websocket_client",
"//systems/sensors:test_models",
],
# Disable valgrind because it currently fails on the system call to python.
# TODO(russt): Make it possible to pass --trace-children=no to valgrind.sh.
tags = ["no_memcheck"],
deps = [":meshcat"],
deps = [
":meshcat",
"//common/test_utilities:eigen_matrix_compare",
],
)

# -----------------------------------------------------
Expand Down
Loading

0 comments on commit 0ffc214

Please sign in to comment.