ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Getting xml parsing error when in launch.py

asked 2022-09-09 14:22:43 -0500

astroboy2704 gravatar image

updated 2022-09-11 01:23:58 -0500

ravijoshi gravatar image

I am running the following command:

ros2 launch my_bot rsp.launch.py

Unfortunately, it is throwing the following error:

[INFO] [launch]: All log files can be found below /home/akash/.ros/log/2022-09-09-22-25-07-523837-akash-5490
[INFO] [launch]: Default logging verbosity is set to INFO
Task exception was never retrieved
future: <Task finished name='Task-2' coro=<LaunchService._process_one_event() done, defined at /opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py:226> exception=InvalidLaunchFileError('py')>
Traceback (most recent call last):
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/any_launch_file_utilities.py", line 53, in get_launch_description_from_any_launch_file
    return loader(launch_file_path)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/python_launch_file_utilities.py", line 68, in get_launch_description_from_python_launch_file
    return getattr(launch_file_module, 'generate_launch_description')()
  File "/home/akash/dev_ws/install/my_bot/share/my_bot/launch/rsp.launch.py", line 21, in generate_launch_description
    robot_description_config = xacro.process_file(xacro_file)
  File "/opt/ros/foxy/lib/python3.8/site-packages/xacro/_init_.py", line 1074, in process_file
    process_doc(doc, **kwargs)
  File "/opt/ros/foxy/lib/python3.8/site-packages/xacro/_init_.py", line 1025, in process_doc
    eval_all(doc.documentElement, macros, symbols)
  File "/opt/ros/foxy/lib/python3.8/site-packages/xacro/_init_.py", line 905, in eval_all
    process_include(node, macros, symbols, eval_all)
  File "/opt/ros/foxy/lib/python3.8/site-packages/xacro/_init_.py", line 502, in process_include
    include = parse(None, filename).documentElement
  File "/opt/ros/foxy/lib/python3.8/site-packages/xacro/_init_.py", line 994, in parse
    return xml.dom.minidom.parse(inp)
  File "/usr/lib/python3.8/xml/dom/minidom.py", line 1959, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python3.8/xml/dom/expatbuilder.py", line 913, in parse
    result = builder.parseFile(file)
  File "/usr/lib/python3.8/xml/dom/expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 27, column 17

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 228, in _process_one_event
    await self.__process_event(next_event)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 248, in __process_event
    visit_all_entities_and_collect_futures(entity, self.__context))
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
    futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
    futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
    sub_entities = entity.visit(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/action.py", line 108, in visit
    return self.execute(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/include_launch_description.py", line 130, in execute
    launch_description = self.__launch_description_source.get_launch_description(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_source.py", line 84, in get_launch_description
    self.get_launch_description(self._expanded_location)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/any_launch_description_source.py", line 53, in _get_launch_description
    return get_launch_description_from_any_launch_file(location)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch ...
(more)
edit retag flag offensive close merge delete

Comments

It seems that your xacro file is not well formatted. If you have composed the xacro file, it would be a good idea to validate it. You can check this link for more info.

ravijoshi gravatar image ravijoshi  ( 2022-09-09 22:22:04 -0500 )edit

Adding onto that, it mentions that the error is on "line 27, column 17". That's a good place to start looking.

If you need help troubleshooting the xacro after reading through the link @ravijoshi provided, please edit your question to include your .xacro file

shonigmann gravatar image shonigmann  ( 2022-09-10 14:18:30 -0500 )edit

I have added my .xacro files in the question now

astroboy2704 gravatar image astroboy2704  ( 2022-09-10 23:30:10 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-09-11 01:23:27 -0500

ravijoshi gravatar image

Just by looking at line 27, column 17, I can tell that the following is incorrect:

            <box_size="0.3 0.3 0.15"/>

Instead, it should be as shown below:

            <box size="0.3 0.3 0.15"/>
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-09-09 14:22:43 -0500

Seen: 636 times

Last updated: Sep 11 '22