RoboMeshCat - Set of utilities for visualizing robots in web-based visualizer MeshCat.
Project description
RoboMeshCat
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
Built Distribution
File details
Details for the file robomeshcat-1.1.1.tar.gz
.
File metadata
- Download URL: robomeshcat-1.1.1.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8997da8261ede9a67188fda6fafab04678427b7fa1e2cf2b8df00446104b9213 |
|
MD5 | f4eb1931020b271f1c3bf2a7e1a5a2c4 |
|
BLAKE2b-256 | 3392252e89a91a81a5d8c7550abb25fb180664106e8d496840ebfc1d6275f25b |
File details
Details for the file robomeshcat-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: robomeshcat-1.1.1-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1683ffada5aa35bf47f5e44ea7cee55517397aa4138554662b5feeef482adcf |
|
MD5 | 2e63bbabd0af7bb8025d068a7b5eedf9 |
|
BLAKE2b-256 | f656c92618f78f30de0cd5d2806475f6aa07d5eedbaa8d2374a2718c3729ab4d |