Skip to content

nilutpolkashyap/fusion2urdf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fusion2urdf

This repository is forked from the work by SpaceMaster85 at SpaceMaster85/fusion2urdf.

SpaceMaster85 added some major updates to the API and added a GUI Dialog Popup for ROS version selection and improved upon the original work syuntoku14/fusion2urdf by syuntoku14

I improved the robot description package structures that are generated by the script for ROS and ROS 2. Also, added support for ROS 2 with Gazebo Sim (previously Ignition Gazebo) launch file.

Hope you enjoy the new features!

🎯Major Updates & Revisions🎯

 -> 2024/03/21: Version 1.3
   ↳ Added support for ROS 2 Gazebo Sim (previously Ignition Gazebo) Launch File
   ↳ Updated the template packages
   ↳ All launch files are well commented for better understanding

 -> 2021/10/13: Version 1.2
   ↳ Made the color and material detection more robust
   ↳ Added ROS 2 launchfile generator
   ↳ Dialog Popup to choose between ROS 1 and ROS 2

 -> 2021/03/09: version 1.1
   ↳ Fix FusionAPI Change

 -> 2021/01/23: Version 1.0
   ↳ This version can handle now nested components
   ↳ The bodies and components which should be exported can be choosen via the light bulbs in Fusion 360
   ↳ Joints with disabled light bulb will be ignored and not exported to the urdf file
   ↳ Hopefully final bugfix of the joint coordinates calculation
   ↳ Reading out the color of the component and set it in the material file
   ↳ All changes are done in a temporary file, so no backup of your design file is necessary (but it is still a good idea) This means that also linked components can be used
   ↳ Added two example Fusion 360 files, which can be found in the Example folder

 -> 2021/01/09: Fix xyz calculation.
   ↳ If you see that your components move arround the map center in rviz try this update
   ↳ More Infos see: difference-of-geometryororiginone-and-geometryororiginonetwo

 -> 2020/11/10: README fix
   ↳ MacOS Installation command fixed in README
   ↳ Date format unified in README to yyyy/dd/mm
   ↳ Shifted Installation Upwards for better User Experience and easier to find

 -> 2020/01/04: Multiple updates:
   ↳ no longer a need to run a bash script to convert stls
   ↳ some cleanup around joint and transmission generation
   ↳ defines a sample material tag instead of defining a material in each link
   ↳ fusion2urdf now generates a self-contained ROS {robot_name}_description package
   ↳ now launched by roslaunch {robot_name}_description display.launch
   ↳ changed fusion2urdf output from urdf to xacro for more flexibility
   ↳ separate out material, transmissions, gazebo elements to separate files

 -> 2018/20/10: Fixed functions to generate launch files

 -> 2018/25/09: Supports joint types "Rigid", "Slider" & Supports the joints' limit(for "Revolute" and "Slider").

 -> 2018/19/09: Fixed the bugs about the center of the mass and the inertia.

What is this fusion2urdf?

The fusion2urdf script allows you to export URDF files from 3D CAD models into a robot description package. The generated description package contains URDF files, meshes (.stl), RViz config and launch files and Gazebo launch files.

It supports for both ROS 1 (Gazebo Classic) and ROS 2 (Gazebo Classic and Gazebo Sim)

Installation

(Option 1) Using zip from release section

Go to the release section and download the latest release URDF_Exporter.zip of the fusion2urdf script

Place the unzipped folder inside the following location based on your OS:

  • Windows

    %appdata%\Autodesk\Autodesk Fusion 360\API\Scripts

    e.g. -

    C:\Users\<USER_NAME>\AppData\Roaming\Autodesk\Autodesk Fusion 360\API\Scripts
  • Mac

    $HOME/Library/Application Support/Autodesk/Autodesk Fusion 360/API/Scripts

(Option 2) Using command line

Download the zip of the fusion2urdf project.

Run the following command from inside the project folder in your shell based on your OS:

  • Windows (In PowerShell)

    cd <path to fusion2urdf>
    Copy-Item ".\URDF_Exporter\" -Destination "${env:APPDATA}\Autodesk\Autodesk Fusion 360\API\Scripts\" -Recurse
  • macOS (In bash or zsh)

    cd <path to fusion2urdf>
    cp -r ./URDF_Exporter "$HOME/Library/Application Support/Autodesk/Autodesk Fusion 360/API/Scripts/"

Testing the installation

To test if the fusion2urdf script was correctly installed, go to Utilities -> ADD-INS -> Scripts and Add-Ins

A new window will open, you should be able to see the URDF_Exporter listed under My Scripts inside the Scripts section

axis_correction

Steps to use the fusion2urdf script

NOTE: By default, Fusion 360 has the Y-axis Up when first installed. Follow the steps here to to select the Z-axis as Up instead of Y up.

axis_correction

Before using this script

NOTE: Make sure that this script currently supports only "Rigid", "Slider" and "Revolute".

  • Before using this script, make sure that your model has all the "links" as components. You have to define the links by creating corresponding components.

  • In addition to that, you should be careful when define your joints. The parent links should be set as Component2 when you define the joint, not as Component1. For example, if you define the "base_link" as Component1 when you define the joints, an error saying "KeyError: base_link__1" will show up.

  • Nested components are exported as a single stl file. Therefore only joints on the root level will be taken into calculation!

  • Joints in nested components and on lower levels will be ignored. Only components and bodies with activated light bulb will be exported, components and bodies with deactivated light bulb will be ignored and not exported!

  • Joints which has a deactivated child component will be ignored. Deactivating the base_link will cause problems! Joints with deactivated light bulbs will not be exported!

  • Colors which are defined on the root level components will be read out and taken over into the material definition of the urdf file.

NOTE: Sometimes this script exports abnormal urdf without any error messages. In that case, the joints should have problems. Redefine the joints and run again.

How to use the generated robot description package in ROS / ROS 2

ROS 1

  • Place the generated description package directory inside the src in your ROS workspace (e.g. ~/catkin_ws).
  • Build and source the workspace by running the following inside your workspace
    cd ~/catkin_ws/
    catkin_make
    source devel/setup.bash
  • Run the following to visualize the Robot URDF in RViz
    roslaunch <YOUR_ROBOT_NAME>_description display.launch
  • Run the following to simulate the robot in Gazebo Classic simulator
    roslaunch <YOUR_ROBOT_NAME>_description gazebo.launch

ROS 2

  • Place the generated description package directory inside the src in your ROS 2 workspace (e.g. ~/ros2_ws).
  • Build and source the workspace by running the following inside your workspace
    cd ~/ros2_ws/
    colcon build
    source install/setup.bash
  • Run the following to visualize the Robot URDF in RViz
    ros2 launch <YOUR_ROBOT_NAME>_description display.launch.py
  • Run the following to simulate the robot in Gazebo Classic simulator
    ros2 launch <YOUR_ROBOT_NAME>_description gazebo.launch.py
  • Run the following to simulate the robot in Gazebo Sim simulator (previously Ignition)
    ros2 launch <YOUR_ROBOT_NAME>_description gz-sim.launch.py

Additional Resources

These are some great resources I found online to help you get started with Fusion 360 for designing your own custom robot simulations for ROS / ROS 2

NOTE: This repo only supports Gazebo, if you are using pybullet, see: yanshil/Fusion2PyBullet.

Issues and Discussions

If you encounter any issues, have questions, or need assistance, please don't hesitate to reach out! You can start an issue in the Issues section for bug reports, feature requests, or general troubleshooting.

Alternatively, feel free to initiate a discussion in the Discussions section to engage with the community, share ideas, or seek advice.

Your feedback and contributions are highly valued.

Enjoy your Fusion 360 and ROS life!