This documentation is under construction and incomplete. Please sign up here for K-Scale updates (opens in a new tab) and check back later for our progress.
Onshape to URDF Converter
kol
is what we use at K-Scale for interacting with OnShape. It is a wrapper around the OnShape API that allows us to easily import parts, postprocess them, and export them in a variety of formats. This is a key part of our mission to make robots more accessible --- Onshape is free, easy to use, and encourages open-source development through FeatureScript.
In a single CLI, we support functions such as mesh simplification, mesh merging, joint cleanup, transferring between MJCF/URDF formats, and more.
Installation
pip install 'kscale-onshape-library[all]'
Usage
The KOL CLI provides several subcommands for different operations:
kol <subcommand> [options]
Available subcommands:
run
: Download from Onshape and post-processdownload
: Only download from Onshapepostprocess
: Post-process an existing URDFpybullet
: Run PyBullet simulation
Download and Post-process
To download a model from Onshape and apply post-processing:
kol run <onshape-document-url> <output-directory>
To see additional configuration options, consult the config file here (opens in a new tab).
Download Only
To only download a model from Onshape without post-processing:
kol download <document-url> <output-directory>
Options are similar to the run
subcommand.
Post-process Existing URDF
To apply post-processing to an existing URDF file:
kol postprocess <urdf-path>
PyBullet Simulation
To run a PyBullet simulation with the processed URDF:
kol pybullet <urdf-path> [options]
Options:
<urdf_path>
: Path to the URDF file to simulate (required)--dt FLOAT
: Time step for simulation (default: 0.01)-n
,--hide-gui
: Hide the PyBullet GUI--no-merge
: Do not merge fixed links--hide-origin
: Do not show the origin of the robot--show-inertia
: Visualize the inertia frames--see-thru
: Use see-through mode for robot visualization--show-collision
: Show collision meshes
Examples
- Download and post-process an Onshape model:
kol run https://cad.onshape.com/documents/... ./robot
- Post-process an existing URDF:
kol postprocess ./path/to/model.urdf voxel_size=0.005
- Run PyBullet simulation:
kol pybullet ./output/model.urdf