Skip to content

Conversation

RussTedrake
Copy link
Collaborator

See RobotLocomotion/drake#17861 for a detailed description and analysis. We've seen approximately a 10x speed up in demarshalling approximately 30 MB of scene data.

This includes a small refactor of the handle_command to allow decode() to be called directly (since consumers of the Viewer might want to use the additionally defined msgpack types).

Also fixes a small bug with accumulating camera/light controllers.

See RobotLocomotion/drake#17861 for a
detailed description and analysis. We've seen approximately a 10x
speed up in demarshalling approximately 30 MB of scene data.

This includes a small refactor of the handle_command to allow decode() to be called directly (since consumers of the Viewer might want to use the additionally defined msgpack types).

Also fixes a small bug with accumulating camera/light controllers.
RussTedrake added a commit to RussTedrake/drake that referenced this pull request Oct 29, 2022
Resolves RobotLocomotion#17861.

Depends on meshcat-dev/meshcat#132.  Importantly,
I've also exported the msgpack requirement via meshcat.js, so that we
don't need to build it again ourselves here.  msgpack-lite included
the msgpack.min.js in it's github distribution, but msgpack-javascript
does not.  I would have needed to pull it from some CDN or NPM server,
or build it locally (which would require node as a dependency).

Also fixes a bug when setting PerspectiveCameras.
Copy link
Collaborator

@rdeits rdeits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! I'm glad there's a better option nowadays

const to_return = new Uint32Array(data.byteLength / 4);
let dataview = new DataView(data.buffer, data.byteOffset, data.byteLength);
for (let i = 0; i < to_return.length; i++) {
to_return[i] = dataview.getUint32(i * 4, true); // true b.c. littleEndian
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still surprising that a JS loop over every byte of data could somehow be performant but 🤷 V8 is magic

@rdeits rdeits merged commit 946026b into meshcat-dev:master Nov 5, 2022
RussTedrake added a commit to RussTedrake/drake that referenced this pull request Nov 5, 2022
This update includes my recent meshcat PR
meshcat-dev/meshcat#132, which switches meshcat to
using msgpack-javascript instead of msgpack-lite.  Resolves RobotLocomotion#17861.

Importantly, I've also exported the msgpack requirement via
meshcat.js, so that we don't need to build it again ourselves here.
msgpack-lite included the msgpack.min.js in it's github distribution,
but msgpack-javascript does not.  I would have needed to pull it from
some CDN or NPM server, or build it locally (which would require node
as a dependency).
RussTedrake added a commit to RussTedrake/drake that referenced this pull request Nov 5, 2022
This update includes my recent meshcat PR
meshcat-dev/meshcat#132, which switches meshcat to
using msgpack-javascript instead of msgpack-lite.  Resolves RobotLocomotion#17861.

Importantly, I've also exported the msgpack requirement via
meshcat.js, so that we don't need to build it again ourselves here.
msgpack-lite included the msgpack.min.js in its github distribution,
but msgpack-javascript does not.  I would have needed to pull it from
some CDN or NPM server, or build it locally (which would require node
as a dependency).
jwnimmer-tri pushed a commit to RobotLocomotion/drake that referenced this pull request Nov 7, 2022
This update includes my recent meshcat PR
meshcat-dev/meshcat#132, which switches meshcat to
using msgpack-javascript instead of msgpack-lite.  Resolves #17861.

Importantly, I've also exported the msgpack requirement via
meshcat.js, so that we don't need to build it again ourselves here.
msgpack-lite included the msgpack.min.js in its github distribution,
but msgpack-javascript does not.  I would have needed to pull it from
some CDN or NPM server, or build it locally (which would require node
as a dependency).
RussTedrake added a commit to RussTedrake/meshcat that referenced this pull request Nov 18, 2022
It turns out that meshcat-python was using the
`handle_command_bytearray` entry point for the static html content. My
PR meshcat-dev#132 broke that (sorry!). This restores that interface and
functionality.
yzqin pushed a commit to yzqin/meshcat that referenced this pull request Jan 10, 2023
It turns out that meshcat-python was using the
`handle_command_bytearray` entry point for the static html content. My
PR meshcat-dev#132 broke that (sorry!). This restores that interface and
functionality.
xuchen-han pushed a commit to xuchen-han/drake that referenced this pull request Feb 6, 2023
…omotion#18269)

This update includes my recent meshcat PR
meshcat-dev/meshcat#132, which switches meshcat to
using msgpack-javascript instead of msgpack-lite.  Resolves RobotLocomotion#17861.

Importantly, I've also exported the msgpack requirement via
meshcat.js, so that we don't need to build it again ourselves here.
msgpack-lite included the msgpack.min.js in its github distribution,
but msgpack-javascript does not.  I would have needed to pull it from
some CDN or NPM server, or build it locally (which would require node
as a dependency).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants