OnShape to URDF

Overview

We will be using the onshape-to-robot plugin to read robot model from Onshape, and export them to a urdf file.

Installation

Also install ROS2 environment following this guide:

Setting up ROS 2 Humble Hawksbill on Ubuntuchevron-right

Set up Onshape API access key

Set up an API access key at OnShape developer portalarrow-up-right.

Store the API keys in ./scripts/onshape_api_key.sh

On every new terminal opened, run

Set up the ROS2 workspace

This procedure only needs to be performed when initially setting up a new workspace and package.

Create the package

Create additional folders

Test build

If the package is built without error, try the following command.

colcon_cd should navigate to our package directory ~/Desktop/humanoid-urdf/src/humanoid_v1

Create Config Files

We need to create these files in the ROS package.

humanoid_v1.launch.py:

rviz

urdf

Change Files

Change package.xml by adding these lines:

Change CMakeLists.txt by adding these lines:

Test Build

colcon build

source install/setup.sh

ros2 launch humanoid_v1 humanoid_v1.launch.py

If the following error is raised, we need to install the gui package separately, suggested herearrow-up-right.

might also need

if running into this error:

highly possible that this is a VSCode terminal issue. Do

Onshape Modeling Considerations

When making mate connections, always click child component first, and then parent. (bind child to parent).

By doing so, the order of the mate connectors should look like the one shown in the following diagram.

Export Onshape robot

This command will dump the urdf and related asset files in ./onshape/humanoid_v1 directory, and automatically copy the necessary files to the ROS2 package.

To clear the previous build, run

Change the exported urdf

For exported urdf, we need to make several changes

2. Change mesh path setting

3. Add position limit

4. Collision

Build

To force refresh the static files, do

and then

Last updated