GithubHelp home page GithubHelp logo

alexswerner / fusion2urdf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from syuntoku14/fusion2urdf

0.0 1.0 0.0 1.3 MB

A Fusion 360 Script to export URDF

License: MIT License

CMake 16.31% Python 73.26% Ruby 9.59% Shell 0.84%

fusion2urdf's Introduction

fusion2urdf

Updated!!!

  • 2018/09/19: Fixed the bugs about the center of the mass and the inertia.
  • 2018/09/25: Supports joint types "Rigid", "Slider" & Supports the joints' limit(for "Revolute" and "Slider").
  • 2018/10/20: Fixed fucnctions to generate launch files

What is this script?

This is a fusion 360 script to export urdf from fusion 360 directly.

This exportes:

  • .urdf file of your model
  • .launch and .yaml files to simulate your robot on gazebo
  • .stl files of your model

convertSTL.rb was created by @Chris Polis

Sample

The following test model doesn't stand upright because z axis is not upright in default fusion 360. Make sure z axis is upright in your fusion 360 model if you want.

original model

industrial_robot

Gazebo simulation of exported .urdf and .launch

  • center of mass

center_of_mass

  • collision

collision

  • inertia

inertia

Before using this script

Before using this script, make sure that your model has all the "links" as componens. You have to define the links by creating corresiponding components. For example, this model(https://grabcad.com/library/spotmini-robot-1) is not supported unless you define the "base_link". In addition to that, you should be carefult 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.

spot_mini

Also, make sure components of your model has only bodies, not nested components. For example, this works:

only_bodies

but this doesn't work since the "face" component contains other components. A component must contain only bodies:

nest_components

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

In addition to that, make sure that this script currently supports only "Rigid", "Slider" and "Revolute". I will add new joint types someday.

How to use

As an example, I'll export a urdf file from this cool fusion360 robot-arm model(https://grabcad.com/library/industrial-robot-10). This was created by sanket patil

In Fusion 360

Install

Run the following command in your shell.

Windows (In PowerShell)
mkdir "${env:APPDATA}\Autodesk\Autodesk Fusion 360\API\Scripts\URDF_Exporter"; cd "${env:APPDATA}\Autodesk\Autodesk Fusion 360\API\Scripts\URDF_Exporter"; function Cmd-Curl {cmd /c curl $args}; Set-Alias -Name curl -Value Cmd-Curl -Option AllScope; curl https://raw.githubusercontent.com/syuntoku14/fusion2urdf/master/URDF_Exporter/URDF_Exporter.py -o URDF_Exporter.py; curl https://raw.githubusercontent.com/syuntoku14/fusion2urdf/master/URDF_Exporter/URDF_Exporter.manifest -o URDF_Exporter.manifest
macOS (In Bash)
mkdir "$HOME/Library/Application Support/Autodesk/Autodesk Fusion 360/API/Scripts/URDF_Exporter" && cd "$HOME/Library/Application Support/Autodesk/Autodesk Fusion 360/API/Scripts/URDF_Exporter" && curl https://raw.githubusercontent.com/syuntoku14/fusion2urdf/master/URDF_Exporter/URDF_Exporter.py -o URDF_Exporter.py && curl https://raw.githubusercontent.com/syuntoku14/fusion2urdf/master/URDF_Exporter/URDF_Exporter.manifest -o URDF_Exporter.manifest
Run

Click ADD-INS in fusion 360, then choose URDF_Exporter.

This script will change your model. So before run it, copy your model to backup.

copy

Run the script and wait a few seconds(or a few minutes). Then a folder dialog will show up. Choose where you want to save the urdf(A folder "Desktop/test" is chosen in this example"). Maybe some error will occur when you run the script. Fix them according to the instruction. In this case, something wrong with joint "Rev 7". Probably it can be solved by just redefining the joint.

error

The name of components can't contain any spaces. Also, you must define the base component. Rename the base component as "base_link".

cautions

In the above image, base_link is gounded. Right click it and click "Unground".

Now you can run the script. Let's run the script. Choose the folder to save and wait a few second. You will see many "old_component" the components field but please ignore them.

results

You have successfully exported the urdf file. Also, you got stl files in "Desktop/test/mm_stl" repository. This will be required at the next step. The existing fusion CAD file is no more needed. You can delete it.

The folder "Desktop/test" will be required in the next step. Move them into your ros environment.

In your ROS environment

Place this repository at your own ROS workspace. "catkin_ws" is used in this example. Then, run catkin_make in catkin_ws.

cd ~/catkin_ws/src
git clone [email protected]:syuntoku14/fusion2urdf.git
cd ..
catkin_make
source devel/setup.bash

Next, copy the repository named your robot's name that you made in the previous step and paste it at "~/catkin_ws/src/fusion2urdf". In this example, I copied "industrial_robot" which is located in the "test" folder.

folder

Then, run the "stl2binary.bash" with your robot's name. You need to install Ruby because there is a ruby code "convertSTL.rb".

cd ~/catkin_ws/src/fusion2urdf
bash stl2binary.bash industrial_robot

The bin_stl in your robot's name folder contains binary stl files for urdf <mesh> tags.

Now you can see your robot in rviz. You can see it by the following command.

cd ~/catkin_ws/src/fusion2urdf/industrial_robot
roslaunch urdf_tutorial display.launch model:=industrial_robot.urdf

rviz

If you want to simulate your robot on gazebo, place exported .launch and .yaml files at ~/catkin_ws/src/fusion2urdf/launch. Then run "roslaunch industrial_robot.launch".

mkdir ~/catkin_ws/src/fusion2urdf/launch

cp ~/catkin_ws/src/fusion2urdf/industrial_robot/industrial_robot.launch ~/catkin_ws/src/fusion2urdf/industrial_robot/industrial_robot_controller.yaml ~/catkin_ws/src/fusion2urdf/launch/

roslaunch ~/catkin_ws/src/fusion2urdf/launch/industrial_robot

Enjoy your Fusion 360 and ROS life!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.