Skip to content

Commit

Permalink
Add support for R2025a (#216)
Browse files Browse the repository at this point in the history
* Add support for R2025a

* fix

* version
  • Loading branch information
lukicdarkoo authored Feb 3, 2025
1 parent 47947df commit b8a65b7
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='urdf2webots',
version='2023.1.0',
version='2025.0.0',
author='Cyberbotics',
author_email='[email protected]',
description='A converter between URDF and PROTO files.',
Expand Down
2 changes: 1 addition & 1 deletion tests/expected/Human.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#VRML_SIM R2023b utf8
#VRML_SIM R2025a utf8
# license: Apache License 2.0
# license url: http://www.apache.org/licenses/LICENSE-2.0
# This is a proto file for Webots for the Human
Expand Down
2 changes: 1 addition & 1 deletion tests/expected/KukaLbrIiwa14R820.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#VRML_SIM R2023b utf8
#VRML_SIM R2025a utf8
# license: Apache License 2.0
# license url: http://www.apache.org/licenses/LICENSE-2.0
# This is a proto file for Webots for the KukaLbrIiwa14R820
Expand Down
2 changes: 1 addition & 1 deletion tests/expected/MotomanSia20d.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#VRML_SIM R2023b utf8
#VRML_SIM R2025a utf8
# license: Apache License 2.0
# license url: http://www.apache.org/licenses/LICENSE-2.0
# This is a proto file for Webots for the MotomanSia20d
Expand Down
2 changes: 1 addition & 1 deletion tests/expected/RobotWithDummyLink.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#VRML_SIM R2023b utf8
#VRML_SIM R2025a utf8
# license: Apache License 2.0
# license url: http://www.apache.org/licenses/LICENSE-2.0
# This is a proto file for Webots for the RobotWithDummyLink
Expand Down
2 changes: 1 addition & 1 deletion tests/expected/RobotWithLocalMeshes.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#VRML_SIM R2023b utf8
#VRML_SIM R2025a utf8
# license: Apache License 2.0
# license url: http://www.apache.org/licenses/LICENSE-2.0
# This is a proto file for Webots for the RobotWithLocalMeshes
Expand Down
10 changes: 5 additions & 5 deletions urdf2webots/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def mkdirSafe(directory):

def convertUrdfFile(input=None, output=None, robotName=None, normal=False, boxCollision=False,
toolSlot=None, initTranslation='0 0 0', initRotation='0 0 1 0',
initPos=None, linkToDef=False, jointToDef=False, relativePathPrefix=None, targetVersion='R2023b'):
initPos=None, linkToDef=False, jointToDef=False, relativePathPrefix=None, targetVersion='R2025a'):
"""Convert a URDF file into a Webots PROTO file or Robot node string."""
urdfContent = None
if not input:
Expand Down Expand Up @@ -95,7 +95,7 @@ def convertUrdfFile(input=None, output=None, robotName=None, normal=False, boxCo

def convertUrdfContent(input, output=None, robotName=None, normal=False, boxCollision=False,
toolSlot=None, initTranslation='0 0 0', initRotation='0 0 1 0',
initPos=None, linkToDef=False, jointToDef=False, relativePathPrefix=None, targetVersion='R2023b'):
initPos=None, linkToDef=False, jointToDef=False, relativePathPrefix=None, targetVersion='R2025a'):
"""
Convert a URDF content string into a Webots PROTO file or Robot node string.
The current working directory will be used for relative paths in your URDF file.
Expand Down Expand Up @@ -177,7 +177,7 @@ def convertUrdfContent(input, output=None, robotName=None, normal=False, boxColl
sys.stderr.write('ROS not sourced, package "%s" will not be found.\n' % packageName)
if os.path.split(directory)[1]:
packagePath = os.path.split(directory)[0]
packagePath = packagePath.replace("\\","/")
packagePath = packagePath.replace("\\", "/")
input = input.replace('package://' + packageName, packagePath + '/' + packageName)
else:
sys.stderr.write('Can\'t determine package root path.\n')
Expand Down Expand Up @@ -326,8 +326,8 @@ def convertUrdfContent(input, output=None, robotName=None, normal=False, boxColl
parser.add_argument('--relative-path-prefix', dest='relativePathPrefix', default=None,
help='If set and --input not specified, relative paths in your URDF file will be treated relatively '
'to it rather than relatively to the current directory from which the script is called.')
parser.add_argument('--target', dest='targetVersion', default='R2023b',
choices=['R2023b', 'R2023a', 'R2022b', 'R2022a', 'R2021b', 'R2021a', 'R2020b', 'R2020a'],
parser.add_argument('--target', dest='targetVersion', default='R2025a',
choices=['R2025a', 'R2023b', 'R2023a', 'R2022b', 'R2022a', 'R2021b', 'R2021a', 'R2020b', 'R2020a'],
help='Sets the Webots version the PROTO will target (will adapt which nodes will be used).')

args = parser.parse_args()
Expand Down
4 changes: 2 additions & 2 deletions urdf2webots/parserURDF.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# to pass from external
robotName = ''
targetVersion = 'R2023b'
targetVersion = 'R2025a'


class Inertia():
Expand Down Expand Up @@ -676,7 +676,7 @@ def getCollision(link, node, path, outputDirectory):
collision.scale[2] = float(meshScale[2])
if (targetVersion >= 'R2023b' and collision.scale[0] != 1.0 and collision.scale[1] != 1.0
and collision.scale[2] != 1.0):
print('\033[1;33mWarning: BoundingObjects (collisions tags) cannot be scaled in version R2023b!'
print('\033[1;33mWarning: BoundingObjects (collisions tags) cannot be scaled in version R2023b and above!'
' Please create a separate model.\033[0m')
if collision.scale[0] * collision.scale[1] * collision.scale[2] < 0.0:
if extension in ['.dae', '.obj', '.stl']:
Expand Down
2 changes: 1 addition & 1 deletion urdf2webots/writeRobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
linkToDef = False
jointToDef = False
indexSolid = 0
targetVersion = 'R2023b'
targetVersion = 'R2025a'


class RGB():
Expand Down

0 comments on commit b8a65b7

Please sign in to comment.