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

roslaunch: KeyError: 'file'

asked 2021-09-10 09:14:41 -0500

El_French gravatar image

updated 2021-09-10 10:06:11 -0500

gvdhoorn gravatar image

hello, I got a ROS package, but when I type roslaunch arm_launch.launch I got this error and don't know how to deal with it ...

pi@raspberrypi:~/catkin_ws $ roslaunch launch/arm_launch.launch
logging to /home/pi/.ros/log/d94a9972-1009-11ec-a551-c5d9d944afff/roslaunch-raspberrypi-1202.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/__init__.py", line 347, in main
    p.start()
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/parent.py", line 305, in start
    self._start_infrastructure()
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/parent.py", line 254, in _start_infrastructure
    self._load_config()
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/parent.py", line 157, in _load_config
    roslaunch_strs=self.roslaunch_strs, verbose=self.verbose)
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/config.py", line 461, in load_config_default
    loader.load(f, config, argv=args, verbose=verbose)
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/xmlloader.py", line 761, in load
    self._load_launch(launch, ros_config, is_core=core, filename=filename, argv=argv, verbose=verbose)
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/xmlloader.py", line 733, in _load_launch
    self._recurse_load(ros_config, launch.childNodes, self.root_context, None, is_core, verbose)
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/xmlloader.py", line 699, in _recurse_load
    val = self._include_tag(tag, context, ros_config, default_machine, is_core, verbose)
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/xmlloader.py", line 96, in call
    return f(*args, **kwds)
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/xmlloader.py", line 596, in _include_tag
    inc_filename = self.resolve_args(tag.attributes['file'].value, context)
  File "/usr/lib/python3.7/xml/dom/minidom.py", line 552, in __getitem__
    return self._attrs[attname_or_tuple]
KeyError: 'file'

My launch file, arm_launch.launch look like that :

<launch>
  <include name="$(find braccio_controller)/launch.launch"/>
  <include name="$(find detection)/launch.launch"/>
</launch>

If you need anything else let me know, Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2021-09-10 10:04:47 -0500

gvdhoorn gravatar image

updated 2021-09-10 10:05:15 -0500

The problem is here:

<include name="$(find braccio_controller)/launch.launch"/>

The correct way to include another .launch file is:

<include file="..." />

The name of the attribute should be file, not name.

See also wiki/roslaunch/XML/include.

edit flag offensive delete link more

Comments

Thanks for your answer I don't have the error anymore. But I have a new one ...

pi@raspberrypi:~/catkin_ws $ roslaunch launch/arm_launch.launch
... logging to /home/pi/.ros/log/3665a23c-1253-11ec-bf58-b827eb6b0003/roslaunch-raspberrypi-8569.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Resource not found: braccio_controller
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/opt/ros/noetic/share
The traceback for the exception was written to the log file

Do you what's the new problem ? I also changed my launched file according to the link you send.

<launch>
  <include file="$(find braccio_controller)/home/pi/catkin_ws/src/braccio_controller/braccio_controller.launch"/>
  <include file="$(find detection)//home/pi/catkin_ws/src/detection/detection_launch.launch"/>
</launch>
El_French gravatar image El_French  ( 2021-09-10 11:28:28 -0500 )edit

Please do not post follow-up questions as comments to answers. That's not how ROS Answers works.

Similar to Stack Overflow, Askbot is a Q&A forum, which works best with a 1-to-1 ratio of questions and answers.

If your original problem was solved, indicate that by clicking the check mark (✓) to the left of the answer. It should turn green.

Then post a new question describing your new problem, possibly mentioning your previous one (to keep things connected). But only post new questions if you've determined there isn't already an existing Q&A discussing your problem (tip: use Google to search, instead of the built-in search. Append site:answers.ros.org to your query string).

gvdhoorn gravatar image gvdhoorn  ( 2021-09-10 11:31:25 -0500 )edit

Question Tools

Stats

Asked: 2021-09-10 09:14:41 -0500

Seen: 672 times

Last updated: Sep 10 '21