Divide and Conquer

Fusion 360 file to ROS URDF 본문

2025/ROS

Fusion 360 file to ROS URDF

10살 2022. 8. 8. 23:49
728x90
 

GitHub - syuntoku14/fusion2urdf: A Fusion 360 Script to export URDF

A Fusion 360 Script to export URDF. Contribute to syuntoku14/fusion2urdf development by creating an account on GitHub.

github.com

 

  1. fusion360이 window에 깔려있다면 윈도우에 해당 코드 다운로드를 한다
  2. cmd 열어서 코드가 있는 폴더로 들어간다
  3. 아래 Copy 코드 실행
  4. Fusion 360 - 유틸리티- 에드인- 내 스크립트에 URDF_Exporter이 생김
  5. catkin_ws에 옮겨 빌드 후 실행
윈도우에서 
cd <path to fusion2urdf>

Copy-Item ".\URDF_Exporter\" -Destination "${env:APPDATA}\Autodesk\Autodesk Fusion 360\API\Scripts\" -Recurse
or 
Copy-Item ".\URDF_Exporter\" -Destination "C:\Users\사용자이름\AppData\Local\Autodesk\Autodesk Fusion 360\API\Scripts\" -Recurse
roscore
roslaunch urdf_2_description display.launch

스케일 줄이면 작게 만들 수 있음
하 이게 왜 안 뜰까

 

 

더보기

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(urdf_2_description)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  rospy
)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
################################################

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
##   your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
##   * add a build_depend tag for "message_generation"
##   * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
##   * If MSG_DEP_SET isn't empty the following dependency has been pulled in
##     but can be declared for certainty nonetheless:
##     * add a exec_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
##   * add "message_generation" and every package in MSG_DEP_SET to
##     find_package(catkin REQUIRED COMPONENTS ...)
##   * add "message_runtime" and every package in MSG_DEP_SET to
##     catkin_package(CATKIN_DEPENDS ...)
##   * uncomment the add_*_files sections below as needed
##     and list every .msg/.srv/.action file to be processed
##   * uncomment the generate_messages entry below
##   * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
# add_message_files(
#   FILES
#   Message1.msg
#   Message2.msg
# )

## Generate services in the 'srv' folder
# add_service_files(
#   FILES
#   Service1.srv
#   Service2.srv
# )

## Generate actions in the 'action' folder
# add_action_files(
#   FILES
#   Action1.action
#   Action2.action
# )

## Generate added messages and services with any dependencies listed here
# generate_messages(
#   DEPENDENCIES
#   std_msgs  # Or other packages containing msgs
# )

################################################
## Declare ROS dynamic reconfigure parameters ##
################################################

## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
##   * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
##   * add "dynamic_reconfigure" to
##     find_package(catkin REQUIRED COMPONENTS ...)
##   * uncomment the "generate_dynamic_reconfigure_options" section below
##     and list every .cfg file to be processed

## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
#   cfg/DynReconf1.cfg
#   cfg/DynReconf2.cfg
# )

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES fusion2urdf
#  CATKIN_DEPENDS rospy
#  DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
  ${catkin_INCLUDE_DIRS}
)

## Declare a C++ library
# add_library(${PROJECT_NAME}
#   src/${PROJECT_NAME}/fusion2urdf.cpp
# )

## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/fusion2urdf_node.cpp)

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")

## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
#   ${catkin_LIBRARIES}
# )

#############
## Install ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# install(PROGRAMS
#   scripts/my_python_script
#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables and/or libraries for installation
# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
#   ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
#   LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
#   RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
#   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
#   FILES_MATCHING PATTERN "*.h"
#   PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
#   # myfile1
#   # myfile2
#   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_fusion2urdf.cpp)
# if(TARGET ${PROJECT_NAME}-test)
#   target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)

package.xml

<?xml version="1.0"?>
<package format="2">
  <name>urdf_2_description</name>
  <version>0.0.0</version>
<description>The urdf_2_description package</description>

  <!-- One maintainer tag required, multiple allowed, one person per tag -->
  <!-- Example:  -->
  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
  <maintainer email="syuntoku14@todo.todo">syuntoku14</maintainer>


  <!-- One license tag required, multiple allowed, one license per tag -->
  <!-- Commonly used license strings: -->
  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
  <license>TODO</license>


  <!-- Url tags are optional, but multiple are allowed, one per tag -->
  <!-- Optional attribute type can be: website, bugtracker, or repository -->
  <!-- Example: -->
  <!-- <url type="website">http://wiki.ros.org/fusion2urdf</url> -->


  <!-- Author tags are optional, multiple are allowed, one per tag -->
  <!-- Authors do not have to be maintainers, but could be -->
  <!-- Example: -->
  <!-- <author email="jane.doe@example.com">Jane Doe</author> -->


  <!-- The *depend tags are used to specify dependencies -->
  <!-- Dependencies can be catkin packages or system dependencies -->
  <!-- Examples: -->
  <!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
  <!--   <depend>roscpp</depend> -->
  <!--   Note that this is equivalent to the following: -->
  <!--   <build_depend>roscpp</build_depend> -->
  <!--   <exec_depend>roscpp</exec_depend> -->
  <!-- Use build_depend for packages you need at compile time: -->
  <!--   <build_depend>message_generation</build_depend> -->
  <!-- Use build_export_depend for packages you need in order to build against this package: -->
  <!--   <build_export_depend>message_generation</build_export_depend> -->
  <!-- Use buildtool_depend for build tool packages: -->
  <!--   <buildtool_depend>catkin</buildtool_depend> -->
  <!-- Use exec_depend for packages you need at runtime: -->
  <!--   <exec_depend>message_runtime</exec_depend> -->
  <!-- Use test_depend for packages you need only for testing: -->
  <!--   <test_depend>gtest</test_depend> -->
  <!-- Use doc_depend for packages you need only for building documentation: -->
  <!--   <doc_depend>doxygen</doc_depend> -->
  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>rospy</build_depend>
  <build_export_depend>rospy</build_export_depend>
  <exec_depend>rospy</exec_depend>


  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->

  </export>
</package>

display.launch

<launch>
  <arg name="model" default="$(find urdf_2_description)/urdf/urdf_2.xacro"/>
  <arg name="gui" default="true"/>
  <arg name="rvizconfig" default="$(find urdf_2_description)/launch/urdf.rviz"/>
  <param name="robot_description" command="$(find xacro)/xacro $(arg model)"/>
  <param name="use_gui" value="$(arg gui)"/>
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"/>
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
  <node name="rviz" pkg="rviz" args="-d $(arg rvizconfig)" type="rviz" required="true"/>
</launch>

controller.launch

<launch>

<rosparam file="$(find urdf_2_description)/launch/controller.yaml" command="load"/>
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" ns="urdf_2" args="joint_state_controller "/>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="false" output="screen">
  <remap from="/joint_states" to="/urdf_2/joint_states"/>
</node>

</launch>

gazebo.launch

<launch>
  <param name="robot_description" command="$(find xacro)/xacro $(find urdf_2_description)/urdf/urdf_2.xacro"/>
  <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model urdf_2"/>
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="paused" value="true"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="true"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="false"/>
  </include>
</launch>

controller.yaml

urdf_2_controller:
  # Publish all joint states -----------------------------------
  joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 50

  # Position Controllers --------------------------------------

urdf.rviz

Panels:
  - Class: rviz/Displays
    Help Height: 78
    Name: Displays
    Property Tree Widget:
      Expanded:
        - /Global Options1
        - /Status1
        - /RobotModel1
        - /TF1
      Splitter Ratio: 0.5
    Tree Height: 591
  - Class: rviz/Selection
    Name: Selection
  - Class: rviz/Tool Properties
    Expanded:
      - /2D Pose Estimate1
      - /2D Nav Goal1
      - /Publish Point1
    Name: Tool Properties
    Splitter Ratio: 0.5886790156364441
  - Class: rviz/Views
    Expanded:
      - /Current View1
    Name: Views
    Splitter Ratio: 0.5
  - Class: rviz/Time
    Experimental: false
    Name: Time
    SyncMode: 0
    SyncSource: ""
Preferences:
  PromptSaveOnExit: true
Toolbars:
  toolButtonStyle: 2
Visualization Manager:
  Class: ""
  Displays:
    - Alpha: 0.5
      Cell Size: 1
      Class: rviz/Grid
      Color: 160; 160; 164
      Enabled: true
      Line Style:
        Line Width: 0.029999999329447746
        Value: Lines
      Name: Grid
      Normal Cell Count: 0
      Offset:
        X: 0
        Y: 0
        Z: 0
      Plane: XY
      Plane Cell Count: 10
      Reference Frame: <Fixed Frame>
      Value: true
    - Alpha: 1
      Class: rviz/RobotModel
      Collision Enabled: false
      Enabled: true
      Links:
        2dofknuckle_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        2dofknuckle_link_10:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        2dofknuckle_link_2:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        2dofknuckle_link_3:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        2dofknuckle_link_4:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        2dofknuckle_link_5:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        2dofknuckle_link_6:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        2dofknuckle_link_7:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        2dofknuckle_link_8:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        2dofknuckle_link_9:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        All Links Enabled: true
        Expand Joint Details: false
        Expand Link Details: false
        Expand Tree: false
        Link Tree Style: Links in Alphabetic Order
        base_link:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        bucket_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        face_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        facebracket_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        hcsr04_cans_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        hcsr04_chips_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        hcsr04_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        leg_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        leg_link_2:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        leg_link_3:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        leg_link_4:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        lipo_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mg90_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mg90_link_10:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mg90_link_2:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mg90_link_3:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mg90_link_4:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mg90_link_5:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mg90_link_6:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mg90_link_7:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mg90_link_8:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mg90_link_9:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mpu9250_cap_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mpu9250_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        mpu9250_mpu_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        pizerow_cam_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        pizerow_con_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        pizerow_cpu_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        pizerow_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        raspicam_cam_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        raspicam_chips_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        raspicam_con_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        raspicam_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        servobottom_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        servobottom_link_10:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        servobottom_link_2:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        servobottom_link_3:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        servobottom_link_4:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        servobottom_link_5:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        servobottom_link_6:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        servobottom_link_7:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        servobottom_link_8:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        servobottom_link_9:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        shell_link_1:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
      Name: RobotModel
      Robot Description: robot_description
      TF Prefix: ""
      Update Interval: 0
      Value: true
      Visual Enabled: true
    - Class: rviz/TF
      Enabled: false
      Frame Timeout: 15
      Frames:
        All Enabled: true
      Marker Scale: 0.5
      Name: TF
      Show Arrows: true
      Show Axes: true
      Show Names: true
      Tree:
        {}
      Update Interval: 0
      Value: false
  Enabled: true
  Global Options:
    Background Color: 48; 48; 48
    Default Light: true
    Fixed Frame: base_link
    Frame Rate: 30
  Name: root
  Tools:
    - Class: rviz/Interact
      Hide Inactive Objects: true
    - Class: rviz/MoveCamera
    - Class: rviz/Select
    - Class: rviz/FocusCamera
    - Class: rviz/Measure
    - Class: rviz/SetInitialPose
      Theta std deviation: 0.2617993950843811
      Topic: /initialpose
      X std deviation: 0.5
      Y std deviation: 0.5
    - Class: rviz/SetGoal
      Topic: /move_base_simple/goal
    - Class: rviz/PublishPoint
      Single click: true
      Topic: /clicked_point
  Value: true
  Views:
    Current:
      Class: rviz/Orbit
      Distance: 0.34426525235176086
      Enable Stereo Rendering:
        Stereo Eye Separation: 0.05999999865889549
        Stereo Focal Distance: 1
        Swap Stereo Eyes: false
        Value: false
      Focal Point:
        X: -0.0016349668148905039
        Y: -0.014781012199819088
        Z: 0.017814036458730698
      Focal Shape Fixed Size: true
      Focal Shape Size: 0.05000000074505806
      Invert Z Axis: false
      Name: Current View
      Near Clip Distance: 0.009999999776482582
      Pitch: 0.46039697527885437
      Target Frame: <Fixed Frame>
      Value: Orbit (rviz)
      Yaw: 0.593582272529602
    Saved: ~
Window Geometry:
  Displays:
    collapsed: false
  Height: 882
  Hide Left Dock: false
  Hide Right Dock: false
  QMainWindow State: 000000ff00000000fd000000040000000000000142000002d9fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005d00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c0061007900730100000037000002d9000000ca00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002d9fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730100000037000002d9000000a100fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004c000000044fc0100000002fb0000000800540069006d00650100000000000004c00000026b00fffffffb0000000800540069006d0065010000000000000450000000000000000000000267000002d900000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
  Selection:
    collapsed: false
  Time:
    collapsed: false
  Tool Properties:
    collapsed: false
  Views:
    collapsed: false
  Width: 1216
  X: 700
  Y: 385

 

 

참고

 

Fusion 360 URDF 설치

퓨전 360에서 URDF를 만들기 위해서는 스크립트를 이용해야한다. syuntoku14/fusion2urdf: URDF를 내보내는 퓨전 360 스크립트 (github.com) 위에 링크로 들어가서 코드를 다운받고, 압축을 푼다. windows powers..

informluke.tistory.com

 

반응형

'2025 > ROS' 카테고리의 다른 글

서비스 패키지 생성  (0) 2022.08.17
ROS Setting Alias  (0) 2022.08.17
Window에 ROS 설치  (0) 2022.08.08
ydlidar X4로 Hector SLAM  (2) 2022.06.30
ydlidar X4 동작 확인  (0) 2022.06.29
Comments