Skip to content

Build GUI buttons & sliders in meshcat? #44

Closed

Description

@yijiangh

Hi Robin,

Thanks for this great project! I'm wondering if it's possible (how much efforts it would require) to build some simple graphical interfaces (buttons, sliders) on meshcat?

I'm thinking about having something similar to Qt's signal-slot mechanism. Let's say we launch meshcat through meshcat-python(or .jl), and we want the users to interact with the backend engine (python/Julia) only through the buttons displayed on the meshcat web-browser.

I don't have much experience in three.js but I am curious what would be the engineering effort to achieve this?

Thanks!

Activity

  1. rdeits commented on Feb 5, 2019

    @rdeits
    Collaborator

    That's a great question, and I'm not sure I have the answer yet. One option I've considered is just to say that meshcat itself is only an output, and the way to add controls to it is to compose them as separate elements on the same page. By that I mean that you would render something like:

    <div class="my-robot-GUI">
      <div class="meshcat-viewer">
      <div class="my-sliders">
    </div>

    This is what we chose to do in RigidBodySim.jl: since MeshCat.jl uses WebIO.jl, which already supports creating widgets and combining them together on the same page, we created a simple GUI consisting of a meshcat window and a few buttons by just rendering them together: https://github.com/JuliaRobotics/RigidBodySim.jl/blob/master/src/visualization.jl#L194-L204 In that case, WebIO handles all the messiness of synchronizing the sliders or buttons to the Julia code that they're supposed to control.

    That approach worked pretty well, and I generally like the idea of trying to compose different tools rather than adding more features. The downside, however, is that it only works in Julia. I'm sure something similar could be done in Python, but the widgets and layout would probably be a bit different.

    So, I think that if your goal is to have a meshcat window with some controls that link to backend code, then using WebIO.jl widgets (like we did in https://github.com/JuliaRobotics/RigidBodySim.jl/blob/master/src/visualization.jl#L194-L204 ) in Julia or something similar in Python would work really well and be pretty easy (in particular, it requires absolutely no knowledge of three.js at all).

    On the other hand, if you want widgets that actually live inside the meshcat viewer, that's more of a challenge. What are you actually interested in doing?

  2. yijiangh commented on Feb 5, 2019

    @yijiangh
    Author

    The WebIO.jl widgets seem to fit my needs! I think my pipeline will be very similar to the one used in RigidBodySim.

    I will try that and post question in RigidBodySim. Thank you so much for your comments and helps!

  3. tenhjo commented on May 10, 2023

    @tenhjo

    How can this be done on Python? I am not able to translate the Julia example...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions