{"id":13763070,"url":"https://github.com/cyberbotics/urdf2webots","last_synced_at":"2025-04-08T12:08:58.347Z","repository":{"id":34224249,"uuid":"139858078","full_name":"cyberbotics/urdf2webots","owner":"cyberbotics","description":"Utility to convert URDF files to Webots PROTO nodes","archived":false,"fork":false,"pushed_at":"2025-02-03T13:54:36.000Z","size":119312,"stargazers_count":141,"open_issues_count":16,"forks_count":45,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-04-01T11:02:14.480Z","etag":null,"topics":["gazebo","robotics","robotics-simulation","urdf","webots"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyberbotics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["omichel","DavidMansolino","stefaniapedrazzi"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"custom":"https://cyberbotics.com/buy"}},"created_at":"2018-07-05T14:04:29.000Z","updated_at":"2025-03-19T22:24:56.000Z","dependencies_parsed_at":"2025-02-24T08:00:40.404Z","dependency_job_id":"02016468-4e72-40b8-a29f-efaaa87e7c69","html_url":"https://github.com/cyberbotics/urdf2webots","commit_stats":{"total_commits":486,"total_committers":30,"mean_commits":16.2,"dds":0.6851851851851851,"last_synced_commit":"e93139aeea7f470c3da05cfda66d050e3dea9164"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberbotics%2Furdf2webots","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberbotics%2Furdf2webots/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberbotics%2Furdf2webots/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberbotics%2Furdf2webots/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyberbotics","download_url":"https://codeload.github.com/cyberbotics/urdf2webots/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247838444,"owners_count":21004580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gazebo","robotics","robotics-simulation","urdf","webots"],"created_at":"2024-08-03T15:00:32.292Z","updated_at":"2025-04-08T12:08:58.322Z","avatar_url":"https://github.com/cyberbotics.png","language":"Python","funding_links":["https://github.com/sponsors/omichel","https://github.com/sponsors/DavidMansolino","https://github.com/sponsors/stefaniapedrazzi","https://cyberbotics.com/buy"],"categories":["Tools and Libraries"],"sub_categories":[],"readme":"# urdf2webots\n\n![Test Status](https://github.com/cyberbotics/urdf2webots/actions/workflows/test.yml/badge.svg)\n[![PyPI version](https://badge.fury.io/py/urdf2webots.svg)](https://badge.fury.io/py/urdf2webots)\n\nThis tool converts URDF files into Webots PROTO files or into Webots Robot node strings.\nPython 3.5 or higher is required.\n\n## Install\n\n### From pip\n\n```\npip install urdf2webots\n```\n\nOn macOS, export the pip binary path to the PATH: `export PATH=\"/Users/$USER/Library/Python/3.7/bin:$PATH\"`\n\n### From Sources\n\n```\ngit clone --recurse-submodules https://github.com/cyberbotics/urdf2webots.git\npip install --upgrade --editable urdf2webots\n```\n\n## Usage\n\n### From pip\n\n```\npython -m urdf2webots.importer --input=someRobot.urdf [--output=outputFile] [--normal] [--box-collision] [--tool-slot=linkName] [--help]\n```\n\n### Arguments\n\nThe script accepts the following arguments:\n  - **-h, --help**: Show the help message and exit.\n  - **--input=INPUT**: Specifies the URDF file to convert.\n  - **--output=OUTPUT**: If set, specifies the path and, if ending in \".proto\", name of the resulting PROTO file. The filename minus the .proto extension will be the robot name (for PROTO conversion only).\n  - **--robot-name**: Specify the name of the robot and generate a Robot node string instead of a PROTO file (has to be unique).\n  - **--normal**: If set, the normals are exported if present in the URDF definition.\n  - **--box-collision**: If set, the bounding objects are approximated using boxes.\n  - **--tool-slot=LinkName**: Specify the link that you want to add a tool slot to (exact link name from URDF, for PROTO conversion only).\n  - **--translation=\"0 0 0\"**: Set the translation field of the PROTO file or Webots Robot node string.\n  - **--rotation=\"0 0 1 0\"**: Set the rotation field of the PROTO file or Webots Robot node string.\n  - **--init-pos=JointPositions**: Set the initial positions of your robot joints. Example: `--init-pos=\"[1.2, 0.5, -1.5]\"` would set the first 3 joints of your robot to the specified values, and leave the rest with their default value.\n  - **--link-to-def**: Creates a DEF with the link name for each solid to be able to access it using getFromProtoDef(defName) (for PROTO conversion only).\n  - **--joint-to-def**: Creates a DEF with the joint name for each joint to be able to access it using getFromProtoDef(defName) (for PROTO conversion only).\n  - **--relative-path-prefix**: If **--input** is not set, the relative paths in your URDF file sent through stdin will use this prefix. For example: `filename=\"head.obj\"` with `--relative-path-prefix=\"/home/user/myRobot/\"` will become `filename=\"/home/user/myRobot/head.obj\"`.\n\nIn case the **--input** option is missing, the script will read the URDF content from `stdin`.\nIn that case, you can pipe the content of your URDF file into the script: `cat my_robot.urdf | urdf2proto.py`.\nRelative paths present in your URDF file will be treated relatively to the current directory from which the script is called unless **--relative-path-prefix** is set.\n\n\u003e Previously the **--static-base** argument was supported in order to set the base link to be static (disabled physics). It has been removed as there is a better way to do it by adding the following to your URDF file (assuming **base_link** is the root link of your robot):\n\u003e\n\u003e```\n\u003e \u003clink name=\"world\" /\u003e\n\u003e\u003cjoint name=\"world_joint\" type=\"fixed\"\u003e\n\u003e    \u003cparent link=\"world\" /\u003e\n\u003e    \u003cchild link=\"base_link\" /\u003e\n\u003e\u003c/joint\u003e\n\u003e```\n\n### In your Python Code\n\n#### Arguments\n\nThe command line arguments available from the terminal are also available from the Python interface, but some have different names:\n\n| Terminal   |      Python      |\n|----------|-------------|\n| --input |  input |\n| --output |  output |\n| --robot-name |  robotName |\n| --normal |  normal |\n| --box-collision |  boxCollision |\n| --tool-slot |  toolSlot |\n| --translation |  initTranslation |\n| --rotation |  initRotation |\n| --init-pos |  initPos |\n| --link-to-def |  linkToDef |\n| --joint-to-def |  jointToDef |\n| --relative-path-prefix |  relativePathPrefix |\n\nIn Python, you can convert a URDF file by passing its path as an argument to the `convertUrdfFile()` function or directly by passing its content as an argument to the `convertUrdfContent()` function.\n\n#### Convert into Webots PROTO files\n\n```\nfrom urdf2webots.importer import convertUrdfFile\nconvertUrdfFile(input = 'MY_PATH/MY_URDF.urdf')\n```\n\nor\n\n```\nimport pathlib\nfrom urdf2webots.importer import convertUrdfContent\nrobot_description = pathlib.Path('MY_PATH/MY_URDF.urdf').read_text()\nconvertUrdfContent(input = robot_description)\n```\n\n#### Convert into Webots Robot node strings\n\n```\nfrom urdf2webots.importer import convertUrdfFile\nconvertUrdfFile(input = 'MY_PATH/MY_URDF.urdf', robotName=\"myRobot\")\n```\n\nor\n\n```\nimport pathlib\nfrom urdf2webots.importer import convertUrdfContent\nrobot_description = pathlib.Path('MY_PATH/MY_URDF.urdf').read_text()\nconvertUrdfContent(input = robot_description, robotName=\"myRobot\")\n```\n\n### In-Depth Tutorial\nCheck out [this tutorial](./docs/tutorial.md) for a more in-depth, step by step instruction, on how to:\n- Generate a URDF file from a ROS repository.\n- Convert your URDF file to a Webots PROTO file.\n- Load your converted model into Webots and make final adjustments.\n- Convert your URDF file to a Webots Robot string and import it.\n\n\n## Notes\nThis tool was tested using Webots R2022b on Ubuntu22.04.\nYou can find the sources of these URDF files here:\n  - Universal Robot: https://github.com/ros-industrial/universal_robot/tree/kinetic-devel/ur_description\n  - PR2 robot: https://github.com/PR2/pr2_common/tree/kinetic-devel/pr2_description\n  - Motoman robot: https://github.com/ros-industrial/motoman/tree/kinetic-devel/motoman_sia20d_support\n  - Kinova robot: https://github.com/Kinovarobotics/kinova-ros/tree/kinetic/kinova_description\n  - gait2392 human skeleton: https://github.com/cyberbotics/urdf2webots/tree/master/tests/sources/gait2392_simbody\n\n## Acknowledgements\n\n\u003ca href=\"http://rosin-project.eu\"\u003e\n  \u003cimg src=\"http://rosin-project.eu/wp-content/uploads/rosin_ack_logo_wide.png\"\n       alt=\"rosin_logo\" height=\"60\" \u003e\n\u003c/a\u003e\u003c/br\u003e\n\nSupported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components.\nMore information: \u003ca href=\"http://rosin-project.eu\"\u003erosin-project.eu\u003c/a\u003e\n\n\u003cimg src=\"http://rosin-project.eu/wp-content/uploads/rosin_eu_flag.jpg\"\n     alt=\"eu_flag\" height=\"45\" align=\"left\" \u003e\n\nThis project has received funding from the European Union’s Horizon 2020\nresearch and innovation programme under grant agreement no. 732287.\n\n\u003cbr\u003e\n\n\u003ca href=\"https://opendr.eu/\"\u003e\n  \u003cimg src=\"https://opendr.eu/wp-content/uploads/2020/01/logo-300x125.png\"\n       alt=\"opendr_logo\" height=\"60\" \u003e\n\u003c/a\u003e\u003c/br\u003e\n\nSupported by OpenDR - Open Deep Learning Toolkit for Robotics.\nMore information: \u003ca href=\"https://opendr.eu/\"\u003eopendr.eu\u003c/a\u003e\n\n\u003cimg src=\"https://opendr.csd.auth.gr/wp-content/uploads/2019/12/Flag_of_Europe-300x200.png\"\n     alt=\"eu_flag\" height=\"45\" align=\"left\" \u003e\n\nThis project has received funding from the European Union’s Horizon 2020\nresearch and innovation programme under grant agreement no. 871449.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberbotics%2Furdf2webots","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyberbotics%2Furdf2webots","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberbotics%2Furdf2webots/lists"}