Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespaced tags for gazebo sdf are raising parsing issues #2795

Open
2 tasks done
tomkimsour opened this issue Feb 24, 2025 · 0 comments
Open
2 tasks done

Namespaced tags for gazebo sdf are raising parsing issues #2795

tomkimsour opened this issue Feb 24, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@tomkimsour
Copy link

Environment

  • OS Version: Ubuntu 20.04, ROS2 Humble

  • Binary build?
    Gazebo 6.16

    • Generally, mention all circumstances that might affect rendering capabilities:
      • running on a dual GPU machine (integrated GPU + discrete GPU)
      • running in Docker/Singularity
robot_description = load_xacro(xacro_file_path, xacro_input_args)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch_param_builder/utils.py", line 82, in load_xacro
    file = xacro.process_file(file_path, mappings=mappings)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 1098, in process_file
    process_doc(doc, **kwargs)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 1050, in process_doc
    eval_all(doc.documentElement, macros, symbols)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 931, in eval_all
    process_include(node, macros, symbols, eval_all)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 522, in process_include
    func(include, ns_macros, ns_symbols)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 931, in eval_all
    process_include(node, macros, symbols, eval_all)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 522, in process_include
    func(include, ns_macros, ns_symbols)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 931, in eval_all
    process_include(node, macros, symbols, eval_all)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 522, in process_include
    func(include, ns_macros, ns_symbols)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 931, in eval_all
    process_include(node, macros, symbols, eval_all)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 519, in process_include
    include = parse(None, filename).documentElement
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 1022, in parse
    return xml.dom.minidom.parse(inp)
  File "/usr/lib/python3.10/xml/dom/minidom.py", line 1990, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python3.10/xml/dom/expatbuilder.py", line 913, in parse
    result = builder.parseFile(file)
  File "/usr/lib/python3.10/xml/dom/expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, False)
xml.parsers.expat.ExpatError: unbound prefix: line 48, column 16

Description

  • Expected behavior: Generate URDF correctly from xacro despite having special tags from gazebo
  • Actual behavior: robot_state_publisher fails to parse the urdf due to tag ignition:expressed_in

Steps to reproduce

  1. In a xacro file of the wheels of a robot, define the collision sdf as followed :
     <collision>
        <surface>
          <friction>
            <ode>
              <mu>0.1</mu>
              <mu2>0.1</mu2>
              <xacro:if value="${side == 'front_left'}">
                <fdir1 ignition:expressed_in="base_footprint">1 -1 0</fdir1>
              </xacro:if>
              <xacro:if value="${side == 'rear_left'}">
                <fdir1 ignition:expressed_in="base_footprint">1 1 0</fdir1>
              </xacro:if>
              <xacro:if value="${side == 'front_right'}">
                <fdir1 ignition:expressed_in="base_footprint">1 1 0</fdir1>
              </xacro:if>
              <xacro:if value="${side == 'rear_right'}">
                <fdir1 ignition:expressed_in="base_footprint">1 -1 0</fdir1>
              </xacro:if>
              <slip1>0.01</slip1>
              <slip2>0.01</slip2>
            </ode>
          </friction>
          <contact>
            <ode>
              <kp>100.0</kp>
              <kd>100.0</kd>
              <max_vel>1.0</max_vel>
              <min_depth>0.0</min_depth>
            </ode>
          </contact>
        </surface>
      </collision>
  1. Load mecanum drive plugin in the xacro file
      <plugin filename="gz-sim-mecanum-drive-system" name="ignition::gazebo::systems::MecanumDrive">

        <!-- wheels -->
        <front_left_joint>wheel_front_left_joint</front_left_joint>
        <front_right_joint>wheel_front_right_joint</front_right_joint>
        <back_left_joint>wheel_rear_left_joint</back_left_joint>
        <back_right_joint>wheel_rear_right_joint</back_right_joint>

        <!-- Technical description -->
        <wheelbase>${wheel_pair_separation}</wheelbase>
        <wheel_separation>${wheel_separation}</wheel_separation>
        <wheel_radius>${wheel_radius}</wheel_radius>
        <odom_publish_frequency>50</odom_publish_frequency>

        <topic>cmd_vel</topic>

      </plugin>
  1. Generate the xacro file from robot_state_publisher robot_state_publisher with your xacro file as a parameter.
@tomkimsour tomkimsour added the bug Something isn't working label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Inbox
Development

No branches or pull requests

1 participant