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):

Installation

From

conda install -c conda-forge robomeshcat

From PyPI

pip install robomeshcat

Features

Object and robot centric rendering

  • supported objects shapes are sphere, cuboid, cylinder, and mesh; you can control:
    • color
    • transparency/opacity
    • pose
  • robots can be loaded from URDF (internally represented by pinocchio library) and you can control:
    • color
    • transparency/opacity
    • pose of the base
    • configuration, i.e. joint values
from robomeshcat import Object, Robot, Scene
from example_robot_data.robots_loader import PandaLoader
from pathlib import Path

"Create a scene that stores all objects and robots and has rendering capability"
scene = Scene()
obj = Object.create_sphere(radius=0.1, name='red_sphere', opacity=0.5, color=[1., 0., 0.])
scene.add_object(obj)
robot = Robot(urdf_path=PandaLoader().df_path, mesh_folder_path=Path(PandaLoader().model_path).parent.parent)
scene.add_robot(robot)
"Render the initial scene"
scene.render()
"Update object position in x-axis and robot first joint"
obj.pos[0] = 1.  # or scene['red_sphere'].pos[0] = 1.
robot[0] = 3.14
scene.render()

Animation rendering

  • you can easily animate properties:
    • poses of the objects
    • configurations and poses of robots
    • camera pose and zoom
  • animation is published automatically after 'with' command finishes/closes
from robomeshcat import Scene

scene = Scene()
with scene.animation(fps=30):
    scene.render()  # generate first frame
    scene.camera_zoom = 0.4  # set the camera zoom, you can also set position and rotation of camera
    scene['obj'].pos[1] = 1.  # move hte object in the second frame
    scene.render()  # generate second frame

Image generation

from robomeshcat import Scene

scene = Scene()
img = scene.render_image()

Video recording

from robomeshcat import Scene

scene = Scene()
with scene.video_recording(filename='/tmp/video.mp4', fps=30):
    pass

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.0.4.tar.gz (448.7 kB view hashes)

Uploaded Source

Built Distribution

robomeshcat-1.0.4-py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 3

Supported by

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