Giter VIP home page Giter VIP logo

meshcat-python's People

Contributors

danieljfarrell avatar dcambie avatar ericcousineau-tri avatar gizatt avatar gnthibault avatar manifoldfr avatar matthieuvigne avatar mprat avatar plusk01 avatar rdeits avatar russtedrake avatar shensquared avatar stephane-caron avatar trellixvulnteam avatar wxmerkt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meshcat-python's Issues

Silent problem when loading or displaying DAE files

Hi all. Thanks again for the contribution you are bringing with MeshCat.
I have a problem when loading some DAE files, for example the forearm of the UR5 as available here:
https://gepgitlab.laas.fr/gepetto/example-robot-data/-/raw/master/robots/ur_description/meshes/ur5/visual/upperarm.dae
The DAE seems to be properly parsed, and no warning or error is displayed. Yet it does not show in the viewer. Trying the same code on the corresponding STL file (for example obtained by converting it with osgconv) works like a charm.

Am I doing something incorrect? If not, would you have some directions for me to investigate the problem?

Thanks in advance.

import meshcat
viz=meshcat.Visualizer()
viz.open()

# I used the DAE packaged in APT (deb [arch=amd64] http://robotpkg.openrobots.org/packages/debian/pub bionic robotpkg)  robotpkg-py36-example-robot-data
# Change the path if you are using the url above to obtain it.
dae=meshcat.geometry.DaeMeshGeometry.from_file('/opt/openrobots/share/example-robot-data/robots/ur_description/meshes/ur5/visual/upperarm.dae')
material = meshcat.geometry.MeshPhongMaterial()
material.color = 255
material.transparent=False
viz['upperarm'].set_object(dae,material)

Remote access via ssh

How can I access the meshcat server via ssh port forwarding? Right now If I try to access, it gives "404: Not Found" error

feature request: api support for loading textures from obj/mtl file

i asked (via email)

We're making pretty heavy use of meshcat in class again this term. I'm working on getting it into drake proper so the in-tree examples can use it, too:
RobotLocomotion/drake#9833

But the current implementation that we have uses MeshLambertMaterial for all of the objects -- including the ones loaded from obj files. It looks like Meshcat does support texture maps. But if I leave the materials field = None for that call to SetObject, then I still don't see e.g. the kuka's textures.

Is there an easy fix that is right under my nose?

and the response was

The way textures are handled in meshcat is currently pretty manual. You need to set the map field to an ImageTexture, and that texture in turn needs its image field set to a PngImage. This is much
easier to explain with an example: https://github.com/rdeits/meshcat-python/blob/8b24ac3a72ea56fbb64fca5fcdb1782daa0961bf/src/meshcat/tests/test_drawing.py#L50-L57

Currently, I don't try to do something clever like parse the .mtl file to load the texture, but I suspect that would be possible, perhaps with a Mesh.from_file() constructor.

How to save_image through Python?

Hi!
I wonder if there is a way to call the save_scene, load_scene, save_image functions through the Python interface? These functions can be find in the Controls panel of the viewer.

Thanks in advance!

Meshcat does not work when debugging in VSCode

Running Meshcat in debug mode in VSCode:

import meshcat
vis = meshcat.Visualizer()

results the following error:

unknown option --module
usage: /home/q513234/anaconda3/envs/main/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

Traceback (most recent call last):
  File "/home/q513234/.vscode/extensions/ms-python.python-2021.2.633441544/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py", line 416, in evaluate_expression
    compiled = compile(_expression_to_evaluate(expression), '<string>', 'eval')
  File "<string>", line 1
    vis = meshcat.Visualizer()
        ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/q513234/anaconda3/envs/main/lib/python3.8/site-packages/meshcat/visualizer.py", line 78, in __init__
    self.window = ViewerWindow(zmq_url=zmq_url, start_server=(zmq_url is None), server_args=server_args)
  File "/home/q513234/anaconda3/envs/main/lib/python3.8/site-packages/meshcat/visualizer.py", line 17, in __init__
    self.server_proc, self.zmq_url, self.web_url = start_zmq_server_as_subprocess(
  File "/home/q513234/anaconda3/envs/main/lib/python3.8/site-packages/meshcat/servers/zmqserver.py", line 69, in start_zmq_server_as_subprocess
    raise RuntimeError("the meshcat server process exited prematurely with exit code " + str(server_proc.poll()))
RuntimeError: the meshcat server process exited prematurely with exit code 2

does anyone has an idea, what could be causing this problem?

My VScode configuration:

Version: 1.53.1
Commit: 5d424b828ada08e1eb9f95d6cb41120234ef57c7
Date: 2021-02-08T23:30:54.166Z
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Linux x64 5.8.0-41-generic

Point albedo

Is it possible to change the albedo of the rendering of a point in a pointcloud, just like we can change the color and size of the point?

Use another camera from Three.js

Dear all, thank you very much for this tool, it's really amazing. Really empowers python !
I am looking for a way to change the defaut orthographic projection camera, in order to use this class from three.js:
https://threejs.org/docs/#api/en/cameras/PerspectiveCamera

Is there any easy way to change the default camera ?

I wanted to try something like:
self.view3D["/Cameras/default"].set_object(PerspectiveCamer)
But unfortunately, there does not seems to be PerspectiveCamera in https://github.com/rdeits/meshcat-python/blob/7f03547d68976004f721c320b17c7c2204b172e9/src/meshcat/geometry.py#L262

Thank you in advance for your help.

Rendering objects as semi-transparent.

It is possible to render objects as semi-transparent so that the interior remains visible? Or another alternative could be wireframing objects. I can see the different material classes in geometry.py such as MeshPhongMaterial and MeshToonMaterial but these shaders make the surface opaque. Maybe a surface texture is the way to do this? But I'm unsure how to proceed.

ZMQ ioloop.install crash Windows 10 Python 3.8

This is specific to (in the testing I have done so far):

  • Windows 10
  • Python 3.8

a workaround it to create a Python 3.7 environment

I have a clean python 3.8 environment created using conda,

conda create --name pvtrace-test-2.1.4 python=3.8
conda activate pvtrace-test-2.1.4
conda install Rtree
pip install pvtrace

I downloaded the box.py example and ran it

python box.py

and I get the following traceback,

C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\meshcat\servers\zmqserver.py:28: DeprecationWarning: zmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops.
  ioloop.install()
Traceback (most recent call last):
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\runpy.py", line 194, in _run_module_as_main
Traceback (most recent call last):
  File "box.py", line 8, in <module>
    return _run_code(code, main_globals, None,    vis = meshcat.Visualizer().open()

  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\meshcat\visualizer.py", line 108, in __init__
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\runpy.py", line 87, in _run_code
    self.window = ViewerWindow(zmq_url=zmq_url, start_server=(zmq_url is None))
      File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\meshcat\visualizer.py", line 43, in __init__
exec(code, run_globals)
    self.zmq_url = match_zmq_url(self.server_proc.stdout.readline().strip().decode("utf-8"))
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\meshcat\servers\zmqserver.py", line 235, in <module>
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\meshcat\visualizer.py", line 26, in match_zmq_url
    return capture(r"^zmq_url=(.*)$", line)
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\meshcat\visualizer.py", line 21, in capture
        raise ValueError("Could not match {:s} with pattern {:s}".format(s, pattern))
main()ValueError: Could not match <class 'NotImplementedError'> with pattern ^zmq_url=(.*)$

  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\meshcat\servers\zmqserver.py", line 226, in main
    bridge = ZMQWebSocketBridge(zmq_url=results.zmq_url)
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\meshcat\servers\zmqserver.py", line 95, in __init__
    (self.zmq_socket, self.zmq_stream, self.zmq_url), _ = find_available_port(f, DEFAULT_ZMQ_PORT)
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\meshcat\servers\zmqserver.py", line 46, in find_available_port
    return func(port), port
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\meshcat\servers\zmqserver.py", line 94, in f
    return self.setup_zmq("{:s}://{:s}:{:d}".format(DEFAULT_ZMQ_METHOD, self.host, port))
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\meshcat\servers\zmqserver.py", line 202, in setup_zmq
    zmq_stream = ZMQStream(zmq_socket)
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\zmq\eventloop\zmqstream.py", line 127, in __init__
    self._init_io_state()
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\zmq\eventloop\zmqstream.py", line 552, in _init_io_state
    self.io_loop.add_handler(self.socket, self._handle_events, self.io_loop.READ)
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\site-packages\tornado\platform\asyncio.py", line 100, in add_handler
    self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
  File "C:\Users\daniel.farrell\AppData\Local\Continuum\anaconda3\envs\pvtrace-test-2.1.4\lib\asyncio\events.py", line 501, in add_reader
    raise NotImplementedError
NotImplementedError

Using Python 3.8.5

These are the installed packages

anytree          2.8.0
attrs            20.1.0
certifi          2020.6.20
chardet          3.0.4
colorama         0.4.3
colorlog         4.2.1
decorator        4.4.2
idna             2.10
jsonschema       3.2.0
lxml             4.5.2
meshcat          0.0.18
mkl-fft          1.1.0
mkl-random       1.1.1
mkl-service      2.3.0
mpmath           1.1.0
msgpack          1.0.0
networkx         2.5
numpy            1.19.1
pandas           1.1.1
Pillow           7.2.0
pip              20.2.2
pvtrace          2.1.4
pycollada        0.7.1
pyglet           1.5.7
pyrsistent       0.16.0
python-dateutil  2.8.1
pytz             2020.1
pyzmq            19.0.2
requests         2.24.0
Rtree            0.9.4
scipy            1.5.2
setuptools       49.6.0.post20200814
Shapely          1.7.1
six              1.15.0
svg.path         4.0.2
sympy            1.6.2
tornado          6.0.4
trimesh          3.8.5
u-msgpack-python 2.7.0
urllib3          1.25.10
wheel            0.35.1
wincertstore     0.2
xxhash           2.0.0

Any ideas on how I can work around this problem? Maybe I need to use an earlier version of meshcat?

This seems to be a problem with Python 3.8 on Window 10.

zmqserver.py:27: DeprecationWarning: zmq.eventloop.ioloop is deprecated

My mac CI canary just caught a new deprecation on mac:

/private/var/tmp/_bazel_runner/b24c2514e71e3bad206757e8aeba7ff5/sandbox/darwin-sandbox/285/execroot/underactuated/bazel-out/darwin-fastbuild/bin/underactuated/quadrotor/lqr.runfiles/drake/.lib/python3.7/site-packages/meshcat/servers/zmqserver.py:27: DeprecationWarning: zmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops.
  ioloop.install()

trying to add a text geometry, stuck in JavaScript

Hi Robin, I'm trying to add a text geometry where I can put short description of the scene like 'new initialization', so it'd be easier for audience to interpret my animation.

I added a TextGeometry in the geometry.py file, similar to all the box/sphere. By reading this https://threejs.org/docs/#api/en/geometries/TextGeometry documentation, not much is needed other than passing in params, and I'm almost sure I've done this part correctly.

But when declaring a new TextGeomotry, python throws error saying 'uuid' not defined. Looking into some threejs documentation, this seems to be potentially caused by missing of Three.FontLoader() dependency, but then I'm stuck. I have a vague sense the JS files under the viewer folder is what I should modify but I don't know exactly how?

Server should remember the current geometries and transforms

(and then send those when the browser connects).

This would require storing a copy of the geometries and transforms inside the visualizer, but I don't think that's unreasonably expensive. Specifically, we would need to store a tree of paths, with an (optional) set_object and set_transform command for each path. A new set_object or set_transform would update the stored command at that path, and a new delete would remove part of the tree. When a client connects, the server would walk the tree, sending the stored commands for each path.

With this architecture, we could potentially also stop blocking ZMQ messages when no websocket client is connected, since there's no danger of messages being lost. I'm not sure if that's a good idea, though, because it's somewhat natural for set_object/set_transform to block until there is actually a visualizer connected.

support for triangular meshes with vertices and faces

Meshcat is awesome. I want to know if I can visualize an arbitrary triangular mesh with vertices and faces. I have code which is generating the mesh online and I want to visualize it using meshcat. Is it possible?

How to embed meshcat visualizer in a Vue web application?

Hope you don't mind a question here.

I'm using meshcat to visualise ray-tracing simulations (pvtrace appears in your used by list).

I'm thinking about building a simple web application for the ray-tracer and would like to embed meshcat visualizer within a webpage, hopefully as a VueJS component. However, I'm fairy new to web frontend development and I'm a bit unsure of meshcat architecture and whether it is possible? How would you approach this problem?

Add support for threejs.LineSegments

I'd be happy to do a pull request to add lines to meshcat. Is that something you would like to include? If so, would you give me some pointers on how to go about adding that?

Object picking

Hi, I haven't been able to figure out if it's possible to implement object picking (using the mouse). I know that three.js does support mouse picking (e.g. https://threejs.org/docs/#api/en/core/Raycaster) but it's not clear to me how to capture such events on the client (in my case python) side. Is that possible with the current code base? If not, are there plans to implement it?

Focusing point with camera

When generating more complex scenes I would like to guide the user's view to the most important elements.

The demos suggest using

viz.viewer["/Cameras/default"].set_transform(<Some 4x4 matrix>))
viz.viewer["/Cameras/default/rotated/<object>"].set_property("position", [x, y, z])

How do you use these to move the camera close to an arbitrary position, such as (10., 0., 0.) and look at this arbitrary position?

The set_property seems to be able to reposition the camera (in the three js system where "up" = z_meshcat = +y_three_js and z_three_js = -y_meshcat). The camera seems to keep focusing on the origin. How to do you change the position the camera points at and pans around?

zmq.error.ZMQError: Operation cannot be accomplished in current state

I have this issue randomly thrown at me. I am doing tests on both a x86 machine and a aarch64 raspberry pi, and it seems the issue is almost triggered 100% of the time on the raspberry pi:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/home/user/test.py", line 125, in apply_rotation
    self.view3D[f"test/test0"].set_transform(
  File "/home/user/venv/lib/python3.8/site-packages/meshcat/visualizer.py", line 152, in set_transform
    return self.window.send(SetTransform(matrix, self.path))
  File "/home/user/venv/lib/python3.8/site-packages/meshcat/visualizer.py", line 58, in send
    self.zmq_socket.send_multipart([
  File "/home/user/venv/lib/python3.8/site-packages/zmq/sugar/socket.py", line 595, in send_multipart
    self.send(msg, SNDMORE | flags, copy=copy, track=track)
  File "/home/user/venv/lib/python3.8/site-packages/zmq/sugar/socket.py", line 547, in send
    return super(Socket, self).send(data, flags=flags, copy=copy, track=track)
  File "zmq/backend/cython/socket.pyx", line 718, in zmq.backend.cython.socket.Socket.send
  File "zmq/backend/cython/socket.pyx", line 765, in zmq.backend.cython.socket.Socket.send
  File "zmq/backend/cython/socket.pyx", line 247, in zmq.backend.cython.socket._send_copy
  File "zmq/backend/cython/socket.pyx", line 242, in zmq.backend.cython.socket._send_copy
  File "zmq/backend/cython/checkrc.pxd", line 28, in zmq.backend.cython.checkrc._check_rc
zmq.error.ZMQError: Operation cannot be accomplished in current state

The code is not really relevant, as it is sometimes working, sometimes not. The error arise on a SetTransform than is ran on a separate thread from the thread that creates the meshcat.Visualizer()

Sorry for the poor bug reporting, but it is very hard to find a mwe

Support geometry scale

At a simple level: maybe just a setter on Geometry that all subclasses can use?

At a higher level: it's slightly a pain to have to modify this python interface to support many of these trivial fields when all it's really doing is providing some abstractions for making the right JSON messages. Would it work to have a generic way to give SceneElements named fields with trivially-serializable values, and have those added to the return dict in lower()? Would that be too much power / be too weird?

Compatibility with python 2.7

Hi all,

I would like to ask if meshcat can be installed with python 2.7?

I tried pip install meshcat (python vesion 2.7), and I got:

Collecting meshcat
  Using cached https://files.pythonhosted.org/packages/fb/38/3fcd7ba56bac4f755f00fc2dd265916d34ac4888f1c06c0a66d9f9a7d162/meshcat-0.3.1.tar.gz
Collecting ipython>=5 (from meshcat)
  Using cached https://files.pythonhosted.org/packages/ce/2c/2849a2b37024a01a847c87d81825c0489eb22ffc6416cac009bf281ea838/ipython-5.10.0-py2-none-any.whl
Collecting numpy>=1.14.0 (from meshcat)
  Using cached https://files.pythonhosted.org/packages/3a/5f/47e578b3ae79e2624e205445ab77a1848acdaa2929a00eeef6b16eaaeb20/numpy-1.16.6-cp27-cp27mu-manylinux1_x86_64.whl
Collecting pillow>=7.0.0 (from meshcat)
  Could not find a version that satisfies the requirement pillow>=7.0.0 (from meshcat) (from versions: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 2.0.0, 2.1.0, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.3.2, 2.4.0, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0, 2.6.1, 2.6.2, 2.7.0, 2.8.0, 2.8.1, 2.8.2, 2.9.0, 3.0.0, 3.1.0rc1, 3.1.0, 3.1.1, 3.1.2, 3.2.0, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.4.0, 3.4.1, 3.4.2, 4.0.0, 4.1.0, 4.1.1, 4.2.0, 4.2.1, 4.3.0, 5.0.0, 5.1.0, 5.2.0, 5.3.0, 5.4.0, 5.4.1, 6.0.0, 6.1.0, 6.2.0, 6.2.1, 6.2.2)
No matching distribution found for pillow>=7.0.0 (from meshcat)

Thanks

libzmq3 vs libzmq5

I don't have libzmq3, though I do have libzmq3-dev. Do you expect this to work ok with libzmq5, which is present?

Setting up development environment

I'm having some trouble setting up a development environment for meshcat. Can anyone see what I'm doing wrong?

I've created an environment using,

pyenv virtualenv 3.7.2 meshcat_env
pyenv activate meshcat_env
pip install -e meshcat-python
pip install jupyter

The line pip install -e meshcat-python installs meshcat into that environment using the cloned github repository directory.

Running the src/meshcat/examples/box.py opens a browser tab but the page is entirely blank and results in the warning,

/Users/daniel/dev/Python/meshcat-python/src/meshcat/servers/zmqserver.py:27: DeprecationWarning: zmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops.
  ioloop.install()
You can open the visualizer by visiting the following URL:
http://127.0.0.1:7000/static/
WARNING:tornado.access:404 GET /static/main.min.js (127.0.0.1) 1.68ms
0.0009292042255401611

A similar problem occurs when with demo.ipynb, the opened window is blank (and so is the jupyter cell for the visualiser). The terminal reports the following warning,

[W 08:35:36.692 NotebookApp] Notebook meshcat-python/demo.ipynb is not trusted
[I 08:35:37.519 NotebookApp] Kernel started: b154dd5c-a7fc-46b7-8e4c-01a8d9420356
[I 08:35:38.204 NotebookApp] Adapting to protocol v5.1 for kernel b154dd5c-a7fc-46b7-8e4c-01a8d9420356
/Users/daniel/.pyenv/versions/3.7.2/envs/meshcat_env/lib/python3.7/site-packages/notebook/base/zmqhandlers.py:284: RuntimeWarning: coroutine 'WebSocketHandler.get' was never awaited
  super(AuthenticatedZMQStreamHandler, self).get(*args, **kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Minus the packages installed by jupyter, meshcat dependancies are at version,

Package          Version
---------------- -------
numpy            1.16.2 
pip              19.0.3 
pyzmq            18.0.0 
setuptools       40.6.2 
tornado          6.0    
u-msgpack-python 2.5.0  

Display occupancy grid map

Is there a way to display occupancy grid maps on meshcat? I have an octomap that I wanted to display on meshcat. Is there an example I can follow for this?

DEFAULT_FILESERVER_PORT not works well with docker + mac

DEFAULT_FILESERVER_PORT=7000 is occupied by mac service, but used as the final port in docker(in docker, it doesn't really know the port get occupied) and I have no way to configure it.

The tricky solution for now is to manually bind different host port to docker 7000 port, e.g. 7777:7000 and then in code, explicitly change the web_url stored to vis object

Here's the result
image

meshcat in react

hi @danieljfarrell
I need your help I want to use Meshcat inside a react component. before I change the HTML file in the Meshcat folder to add more abject but now I like to work with Mechcat inside the react component . is there any trick or tips you have for doing this?
please tell me if you need more details.
best regards mehrdad

Killing the subprocess after using the visualizer

I notice two issues with using meshcat to run my visualizations for simulations developed on pinocchio:

  1. I cannot effectively kill a meshcat visualizer completely, and thus, its server. Vizualizer().delete() just deletes the path and Visualizer().close() fails since ViewerWindow().close() has not been implemented. This would not be a problem if issue 2 below is addressed.

  2. I use Meshcat visualizer by calling Visualizer(zmq_url=None, window=None). When I do so, the ViewerWindow() internally creates a zmq_url, zmq_socket and a subprocess. Once I am done using the visualizer, I would like to delete it, end the program, start a new program and create a new visualizer. But by doing this, I am assigned a new URL and subprocess every time, resulting in a pile up in my system's processes. I see that this is because the subprocess is not killed when I end the program or delete the visualizer. It would be ideal if killing the subprocess and closing the socket could be handled by Meshcat or by calling a Meshcat method such as Visualizer().close()

Should support a (basic) resource pool?

In RobotLocomotion/drake#13971, @RussTedrake found that having HTML JS clients re-download the IIWA meshes every time for each new pydrake...MeshcatVisualizer instance is rather slow.

He was able to work around it by #75, which relies on using the same existing object path.

In an ideal path, there would be a way to (naively) cache the data objects (perhaps on the sending client side?) based on byte comparison.

Then you get the same benefit; additionally, if someone were to visualize a large scene (e.g. 20 IIWAs in the same setup), the websocket only has to receive the meshes once (rather than 20 times).

\cc @gizatt

How to update the `dat.gui` panel programmatically

Hi @rdeits, thanks for all your work with meshcat!

I'm trying to obtain using Python something similar to what was done in drake for controlling the displayed panel programmatically, i.e. adding (at least) buttons with callbacks and (possibly) sliders.

As inexperienced web developer (read, never developed any web-related application), here below I summarize what I learned from the repos:

To conclude this summary, drake eventually dropped the zmq additional step and started communicating directly with the WebSocket (RobotLocomotion/drake#13038 (comment)). I also found a similar issue you commented few years ago (meshcat-dev/meshcat#44 (comment)) in which you wrote that this is also the approach used in Julia.

This being said, from Python I'm currently missing the connection step between the meshcat.Visualizer (or any inheriting class) and the controls:

  1. Let's assume I can start a custom version of meshcat.servers.zmqserver.ZMQWebSocketBridge and define new commands. Do you have any pointers on how to pass through the zmqserver for interfacing with the controls?
  2. Instead, by creating together with the Visualizer an additional direct connection to the websocket, what would be the approach to access the control panel? I assume that both connections (this new one + the exising one) could co-exist, but I might be wrong.

For future reference, in rdeits/meshcat@test there are static html with experiments that can be opened as follows:

cd meshcat/test
python3 -m http.server
# Browse: http://localhost:8000/<filename>.html

Collada `.dae` colors?

Is there a plan to load and display multicolored bodies like the visual meshes in the ur_description package) from Universal Robots?

Probably related to MeshCat.jl/issues/129

Am I just missing something in the examples? I'm using DaeMeshGeometry.from_file() which seems like it's going to construct a geometry object with a _meshfile type that the Javascript is going to convert to a _meshfile_geometry.

Maybe a workaround, like manually constructing a Python Object with a _meshfile_object type instead of a _meshfile type? Maybe I could copy over most of the data from a DaeMeshGeometry?

I've seen the texture loading example in demo.ipynb, but not something regarding parsing the materials and color assignments stored in a Collada file.

I don't want to get too deep into trying to modify the Python side if the JS isn't going to load those colors anyway, so I thought I'd ask.

LineSegment unit test missing

It seems that the LineSegment geometry is missing from the drawing unit test.

Adding it to the unit test and/or an example that demonstrates usage could be helpful.

Note: I think the same also applies to Line and LineLoop.

Some generically-useful things to support

Listing some things that could be useful to have clear support for:

  • Lines (given a list of vertices)
  • Meshes from points + vertices
  • As an extension of the above, 2D shapes from a CCW listing of their boundary vertices?
  • Demo of programmatic textured meshes (e.g. draw a webcam image onto a square face in the 3D viewer)

No rush though, you've got some bigger things to think about :)

meshcat-server command not working

Whenever I run meshcat-server, the page that opens up says error 404 not found and this is what is displayed in my command window:
zmq_url=tcp://127.0.0.1:6000
web_url=http://127.0.0.1:7000/static/
Firefox hook launcher starting up
run-parts: executing /usr/lib/amazon/firefox-hooks/00amazon-firefox-certs
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
Notice: Trust flag u is set automatically if the private key is present.
run-parts: executing /usr/lib/amazon/firefox-hooks/10firefox-disable-bad-prefs
Firefox hook launcher finished
WARNING:tornado.access:404 GET /static/ (127.0.0.1) 1.37ms
WARNING:tornado.access:404 GET /favicon.ico (127.0.0.1) 0.33ms

(/usr/lib/firefox/firefox:3427): Gtk-WARNING **: Theme parsing error: gtk-main.css:18:33: Invalid number for color value
^CTraceback (most recent call last):
File "/usr/local/bin/meshcat-server", line 11, in
load_entry_point('meshcat==0.0.13', 'console_scripts', 'meshcat-server')()
File "/home/me/meshcat/servers/zmqserver.py", line 177, in main
bridge.run()
File "/home/me/meshcat/servers/zmqserver.py", line 159, in run
self.ioloop.start()
File "/usr/local/lib/python2.7/dist-packages/tornado-5.1.1-py2.7-linux-x86_64.egg/tornado/ioloop.py", line 1048, in start
event_pairs = self._impl.poll(poll_timeout)

any ideas on this?

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.