Getting started
Installing the package
Run the following to install onshape-to-robot from pypi:
pip install onshape-to-robot
Setting up your API key
You will need to obtain API key and secret from the Onshape developer portal
We recommend you to store your API key and secret in environment variables, you can add something
like this in your .bashrc:
# Obtained at https://dev-portal.onshape.com/keys
export ONSHAPE_API=https://cad.onshape.com
export ONSHAPE_ACCESS_KEY=Your_Access_Key
export ONSHAPE_SECRET_KEY=Your_Secret_Key
Setting up your export
To export your own robot, first create a directory:
mkdir my-robot
Then edit my-robot/config.json, here is the minimum example:
{
// Id of the Onshape document (see below)
"document_id": "document-id",
// Output format
"output_format": "urdf"
}
The document-id is the token (below XXXXXXXXX) you can find in Onshape URL when editing your robot:
https://cad.onshape.com/documents/XXXXXXXXX/w/YYYYYYYY/e/ZZZZZZZZ
^^^^^^^^^
This is the document id
Once this is done, run the following command:
onshape-to-robot my-robot
Testing your export
You can test your export by running (PyBullet):
onshape-to-robot-bullet my-robot
Or (MuJoCo):
onshape-to-robot-mujoco my-robot
Head’s up !
Before you can actually enjoy your export, you need to pay attention to the following:
onshape-to-robotcomes with some conventions to follow, in order to understand what in your robot is a degree of freedom, a link, a frame, etc. Make sure to read the design-time considerations.There are some options you might want to specify in the config.json file.