Skip to content

User_App_NoROS_ImportURDFOnWindows

Mehmet Emre Çakal edited this page Oct 11, 2024 · 5 revisions

3.1 Import a URDF on Windows

Note: This tutorial assumes that you have completed tutorials:

Copy the Model Data into the Unity Asset Folder

General Approach

  1. Copy the .urdf file into an arbitrary Asset subfolder, that is, Assets/Urdf/<package_name>/<urdf_name>.urdf.
  2. Copy all resources (mesh and texture files) into the same subfolder, keeping the original folder structure of the ROS package. At the bottom left you can see the R2D2 URDF file. We can see that it is looking for the mesh file in package://urdf_tutorial/meshes/1_finger.dae. Obviously this is in the ROS installation folder, but we need to mimic that. Below, on the right, you can see the Unity folder structure. The mesh location is Assets/Urdf/urdf_tutortial/urdf_tutortial/meshes/1_finger.dae, as if we treated the pacakge:// part of the original path as Assets/Urdf/urdf_tutortial/. Similarly, all robot resources should be placed like this.
  1. In Unity, find the .urdf file in the Project window pane. Right click the file and select Import Robot from URDF in the context menu. (Alternative method: in Unity's menu bar, click GameObject > 3D Object > URDF Model (import) and select the .urdf file.)

R2D2 Example

  1. You can follow this video's first part for this example.
  2. Copy the /opt/ros/humble/share/urdf_tutorial/urdf/07-physics.urdf (from Ubuntu) to:
/Assets/Urdf/urdf_tutorial/07-physics.urdf

If you are using WSL, you can directly access your Windows files and copy within terminal. Your files should be located in /mnt/c/Users/<user_name>/<unity_project_name>/Assets. See Ubuntu copy command: cp

  1. Copy the .dae mesh geometry files from /opt/ros/humble/share/urdf_tutorial/meshes to:
/Assets/Urdf/urdf_tutortial/urdf_tutortial/meshes
  1. In Unity click GameObject > 3D Object > URDF Model and select 07-physics.urdf.

Here is an illustration of the resulting R2D2 GameObject which is directly imported into the scene.

Imported R2D2 in Unity


© Siemens AG, 2017-2024

Clone this wiki locally