Closed RobinHeitz closed 10 months ago
Yes, this seems fairly correct :-)
However, generating a urdf isn't a necessary step as far as I know. To my knowledge, can use the xacro command inside the MSA directly.
Thanks. Well, my experience is that MSA is buggy as hell in Ros2. In another project it was crashing all day and the last step to select the saving dir was sooo slow, it took like 3-5 mins to just select the current directory. But i was able to use .xacro files.
Now, I just cannot open .xacro files anymore (still in Humble, same system). With the created URDF, I can open it at least, but saving is not possible. Terminal states that saving was not possible where as the GUI tells me that there was already a config in that selected directory (which is not true).
Thats why I asked for the correct steps of UR integration in the first place.
Because of the currently mentioned bugs: I'm working on a dedicated docker container with ros:humble and test MSA there...
Just as a comment: I've been successful in generating a moveit config using the MSA on rolling this week. I used the xacro directly with provided parameters and it worked as expected.
Thanks for the update.
I'm able to generate those now too. The bug that choosing the save directory is completely gone if starting it inside Docker container ...
Well, its not working apparently. I don't know what the issue is, but I've created a test docker container to reproduce my issue. Clone the repo & build container or just copy the pkg custom_ur_description to reproduce the err.
I've build and source the workspace. Then i launched moveit_setup_assistant -> Create New Package.
In optional xacro arguments I specify the ur_type:
ur_type:=ur3e
or ur_type:=ur5e
and select the .xacro file provided in src/custom_ur_description/urdf.
Btw, These xacro files work, can test it with
ros2 launch custom_ur_description ur_with_environment.launch ur_type:=ur3e
The error: [INFO] [moveit_setup_assistant-1]: process started with pid [47956] [moveit_setup_assistant-1] error: Undefined substitution argument name [moveit_setup_assistant-1] when processing file: /home/robin/dev/ros2-msa-test/ws/src/custom_ur_description/urdf/ur_with_environment.xacro [moveit_setup_assistant-1] Error: Error document empty. [moveit_setup_assistant-1] at line 100 in ./urdf_parser/src/model.cpp [moveit_setup_assistant-1] Failed to parse robot description using: urdf_xml_parser/URDFXMLParser [moveit_setup_assistant-1] [ERROR] [1691048588.764311062] [moveit_setup_assistant.Start Screen]: Error Loading URDF Path. URDF/COLLADA file is not a valid robot model. ^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT) [INFO] [moveit_setup_assistant-1]: process has finished cleanly [pid 47956]
I think this error should not occure, because in my launch file i don't specify a name either. But ok, lets pass name:=ur as argument also. I then can create a moveit_config_package (like the one provided in /src).
BUT: If i try to launch any auto-generated launch file, it fails:
ros2 launch ur3e_test_moveit_config demo.launch.py -d
[DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.IncludeLaunchDescription' [INFO] [launch]: All log files can be found below /home/robin/.ros/log/2023-08-03-09-49-51-505960-rosmachine-48727 [INFO] [launch]: Default logging verbosity is set to DEBUG [DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7fbd7857fc10>' [DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7fbd7857fc10>' ✓ '<launch.event_handlers.on_include_launch_description.OnIncludeLaunchDescription object at 0x7fbd78ee0100>' [DEBUG] [launch]: An exception was raised in an async action/event [DEBUG] [launch]: Traceback (most recent call last): File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/substitution_args.py", line 161, in _eval_arg return args[name] KeyError: 'name'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/init.py", line 289, in eval_extension return resolve_args(s, context=substitution_args_context) File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/substitution_args.py", line 322, in resolve_args resolved = _resolve_args(arg_str, context, commands) File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/substitution_args.py", line 338, in _resolve_args resolved = commands[command](resolved, a, args, context) File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/substitution_args.py", line 182, in _arg return resolved.replace('$(%s)' % a, _eval_arg(name=args[0], args=context['arg'])) File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/substitution_args.py", line 163, in _eval_arg raise ArgException(name) xacro.substitution_args.ArgException: name
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_description_sources/any_launch_file_utilities.py", line 54, in get_launch_description_from_any_launch_file return loader(launch_file_path) File "/opt/ros/humble/lib/python3.10/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/robin/dev/ros2-msa-test/ws/install/ur3e_test_moveit_config/share/ur3e_test_moveit_config/launch/demo.launch.py", line 6, in generate_launch_description moveit_config = MoveItConfigsBuilder("ur", package_name="ur3e_test_moveit_config").to_moveit_configs() File "/home/robin/dev/mitsubishi-ros/colcon_melfa/install/moveit_configs_utils/lib/python3.10/site-packages/moveit_configs_utils/moveit_configs_builder.py", line 510, in to_moveit_configs self.robot_description() File "/home/robin/dev/mitsubishi-ros/colcon_melfa/install/moveit_configs_utils/lib/python3.10/site-packages/moveit_configs_utils/moveit_configs_builder.py", line 232, in robot_description self.robot_description: load_xacro( 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 895, in eval_all result = str(eval_text(value, symbols)) File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/init.py", line 706, in eval_text results.append(handle_extension(lex.next()[1][2:-1])) File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/init.py", line 696, in handle_extension return eval_extension("$(%s)" % eval_text(s, symbols)) File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/init__.py", line 293, in eval_extension raise XacroException("Undefined substitution argument", exc=e) xacro.XacroException: Undefined substitution argument name
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 336, in run_async raise completed_tasks_exceptions[0] File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 230, in _process_one_event await self.process_event(next_event) File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 250, in process_event visit_all_entities_and_collect_futures(entity, self.context)) File "/opt/ros/humble/lib/python3.10/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/humble/lib/python3.10/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/humble/lib/python3.10/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/humble/lib/python3.10/site-packages/launch/action.py", line 108, in visit return self.execute(context) File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/include_launch_description.py", line 148, in execute launch_description = self.launch_description_source.get_launch_description(context) File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_description_source.py", line 84, in get_launch_description self._get_launch_description(self.__expanded_location) File "/opt/ros/humble/lib/python3.10/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/humble/lib/python3.10/site-packages/launch/launch_description_sources/any_launch_file_utilities.py", line 57, in get_launch_description_from_any_launch_file raise InvalidLaunchFileError(extension, likely_errors=exceptions) launch.invalid_launch_file_error.InvalidLaunchFileError: Caught exception when trying to load file of format [py]: Undefined substitution argument name
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Caught exception when trying to load file of format [py]: Undefined substitution argument name [DEBUG] [launch.launch_context]: emitting event: 'launch.events.Shutdown' [DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7fbd78ee0280>' [DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7fbd78ee0280>' ✓ '<launch.event_handlers.on_shutdown.OnShutdown object at 0x7fbd78ee2b90>'
I am pretty sure this is caused by the starting line:
<robot xmlns:xacro="http://wiki.ros.org/xacro" name="$(arg name)">
AFAIK the $(arg name)
is evaluated before the <xacro:arg [...] />
tags beneath it, causing your substitution errors. Ways to fix this would be either adding an <xacro:arg name="name" default="ur" />
to your ur3e_test_moveit_config/config/ur.urdf.xacro
(before the include) or by just statically setting the robot name without a parameter in this place. Both of these work on my machine (leading to new errors about initial_positions
). I vaguely remember that we also stumbled across this behavior when adjusting the robot names to moveit in the ROS1 driver.
I was able to load it in moveit2 setup assistant by modifying the ur.urdf.xacro
file with the following changes:
name="$(arg name)"
-> name="test"
<xacro:arg name="ur_type" default="ur5x"/>
-> <xacro:arg name="ur_type" default="ur5"/>
<?xml version="1.0"?>
<robot xmlns:xacro="http://wiki.ros.org/xacro" name="test">
<!-- robot name parameter -->
<xacro:arg name="name" default="ur"/>
<!-- import main macro -->
<xacro:include filename="$(find ur_description)/urdf/ur_macro.xacro"/>
<!-- possible 'ur_type' values: ur3, ur3e, ur5, ur5e, ur10, ur10e, ur16e, ur20 -->
<!-- the default value should raise an error in case this was called without defining the type -->
<xacro:arg name="ur_type" default="ur5"/>
It looks like these options are deliberately configured to cause errors for other purposes.
OK, it works with this workaround:) But thats not how it should work, right? Hardcoding the name etc.
I think this is the correct way to do it. For the general driver description it makes sense to use the robot name as the <robot>
name, but if you do a custom setup you should probably pick some name that is related to your project. And you are always free to make it configurable yourself - you just have to make sure that the value is passed in through xacro in e.g. the launch file or through MSA.
Seeing that you both were able to generate your setups now, i'll close this issue. Feel free to create a new one if you have further problems.
Hi,
I want to integrate a UR5 arm into ros2 humble (previous: Noetic).
I wonder what the intended steps are. I assume:
Is that the correct way? Thanks.
Robin