Skip to main content

RoboMeshCat - Set of utilities for visualizing robots in web-based visualizer MeshCat.

Project description

RoboMeshCat

PyPI version License

Set of utilities for visualizing robots in web-based visualizer MeshCat. The whole library is object and robot centric allowing you to modify properties of instances rather than manipulating the visualization tree of the MeshCat itself. The library allows you to easily generate videos like this (source code is here):

or like this (by installing a few more dependencies; source code):

Installation

From

conda install -c conda-forge robomeshcat

From PyPI

pip install robomeshcat

About

This library allows you to visualize and animate objects and robots in web browser. Compared to MeshCat library, on which we build, our library is object-oriented allowing you to modify the properties of individual objects, for example:

o = Object.create_sphere(radius=0.2)
o.pos[2] = 2.  # modify position
o.opacity = 0.3  # modify transparency
o.color[0] = 1.  # modify red channel of the color
o.hide()  # hide the object, i.e. set o.visible = False

In addition to objects, it allows you to easily create and manipulate robots (loaded from URDF file):

r = Robot(urdf_path='robot.urdf')
r[0] = np.pi  # set the value of the first joint
r['joint5'] = 0  # set the value of the joint named 'joint5' 
r.pos = [0, 0, 0]  # set the base pose of the robot
r.color, r.opacity, r.visibility, r.rot = ...  # change the color, opacity, visibility, or rotation

All changes will be displayed immediately in the browser, that we call 'online' rendering. By default, you can rotate the camera view with your mouse. However, our library allows you to control the camera from the code as well through the Scene object, that is the main point for visualization:

scene = Scene()
scene.add_object(o)  # add object 'o' into the scene, that will display it
scene.add_robot(r)  # add robot 'r' into the scene, that will display it
scene.camera_pos = [1, 1, 1]  # set camera position
scene.camera_pos[2] = 2  # change height of the camera
scene.camera_zoom = 2  # zoom in
scene.reset_camera()  # reset camera such that you can control it with your mouse again

For complete examples of object and robot interface see our two examples: 01_object.py and 02_robots.py.

It is also possible to visualize human model after installing a few more dependencies, see installation and example 06_human.py.

Animation

This library allows you to animate all the properties of the objects and robots (e.g. position, robot configuration, color,opacity) inside the browser (from which you can replay, slow-down, etc.). Simply use:

scene = Scene()
scene.add_object(o)

with scene.animation(fps=25):
    o.pos[2] = 2.
    scene.render()  # create a first frame of the animation, with object position z-axis set to 2.
    o.pos[2] = 0.
    scene.render()  # create a second frame of the animation with object on the ground

You can also store the animation into the video, using the same principle:

with scene.video_recording(filename='video.mp4', fps=25):
    scene.render()

See our examples on Animation and Image and video.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robomeshcat-1.1.4.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robomeshcat-1.1.4-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file robomeshcat-1.1.4.tar.gz.

File metadata

  • Download URL: robomeshcat-1.1.4.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for robomeshcat-1.1.4.tar.gz
Algorithm Hash digest
SHA256 d79e50e8e18c040e9ec1257df2bd78c6f2ac76d293cebbad374d6c32663fcaef
MD5 35db989009c66987c5fc553a9b4c7e83
BLAKE2b-256 29d0073c839f34b52bba14604bb28bbf23d92c3874c2e92ad4f53d936ac725da

See more details on using hashes here.

File details

Details for the file robomeshcat-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: robomeshcat-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for robomeshcat-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ed9b8cc73880afcf627a85be36f6a5ae16002784630fa9aa6468c3b38e490cad
MD5 ec85ae7fc5f832501fce62d3e5a31462
BLAKE2b-256 75963fd4ca6c5dbde1ab1650520af4aa610f42d395e68f011392be181095ac71

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page