Open ipa-ych opened 6 months ago
Hi,
problem resolved. The conflict aws located in the previous part of urdf with robot calibration. The controller and demo are working fine.
Hi,
problem resolved. The conflict aws located in the previous part of urdf with robot calibration. The controller and demo are working fine.
Can you elaborate more on your solution? In our project, it started to appear recently (like 2-3 days ago), and I thought it might be connected with the latest update and that issue (https://github.com/ros-controls/gazebo_ros2_control/pull/277). Below is my error. YAML configuration of TricycleController is very similar and was working fine till this week:
[gzserver-1] [ERROR 1711549496.914657547] [gazebo_ros2_control]: parser error Couldn't parse parameter override rule: '--param robot_description:=<?xml version="1.0" ?>
[gzserver-1] <!-- =================================================================================== -->
[gzserver-1] <!-- | This document was autogenerated by xacro from /ros2_ws/install/jablka_description/share/jablka_description/urdf/robot.urdf.xacro | -->
[gzserver-1] <!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | -->
[gzserver-1] <!-- =================================================================================== -->
[gzserver-1] <robot name="robot">
[gzserver-1] <!-- ### ROBOT BASE ### -->
[gzserver-1] <!-- Assume the base_link is right in the center of the rear axle. Mesh will be positioned as is in the STL file. -->
[gzserver-1] <link name="base_link">
[gzserver-1] <visual>
[gzserver-1] <origin rpy="0 0 0" xyz="0 0 0"/>
[gzserver-1] , at ./src/rcl/arguments.c:343
[gzserver-1] (Load() at ./src/gazebo_ros2_control_plugin.cpp:260)
Hi, problem resolved. The conflict aws located in the previous part of urdf with robot calibration. The controller and demo are working fine.
Can you elaborate more on your solution? In our project, it started to appear recently (like 2-3 days ago), and I thought it might be connected with the latest update and that issue (#277). Below is my error. YAML configuration of TricycleController is very similar and was working fine till this week:
[gzserver-1] [ERROR 1711549496.914657547] [gazebo_ros2_control]: parser error Couldn't parse parameter override rule: '--param robot_description:=<?xml version="1.0" ?> [gzserver-1] <!-- =================================================================================== --> [gzserver-1] <!-- | This document was autogenerated by xacro from /ros2_ws/install/jablka_description/share/jablka_description/urdf/robot.urdf.xacro | --> [gzserver-1] <!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | --> [gzserver-1] <!-- =================================================================================== --> [gzserver-1] <robot name="robot"> [gzserver-1] <!-- ### ROBOT BASE ### --> [gzserver-1] <!-- Assume the base_link is right in the center of the rear axle. Mesh will be positioned as is in the STL file. --> [gzserver-1] <link name="base_link"> [gzserver-1] <visual> [gzserver-1] <origin rpy="0 0 0" xyz="0 0 0"/> [gzserver-1] , at ./src/rcl/arguments.c:343 [gzserver-1] (Load() at ./src/gazebo_ros2_control_plugin.cpp:260)
As of about 36 minutes ago, we are experiencing the same issue with 0.4.7
.
I can confirm our simulation and control infrastructure will launch with ros-humble-gazebo-ros2-control/now 0.4.3-1jammy.20230523.211003 amd64 [installed,local]
.
Similar to @mbed92, the source of our issue comes from:
<gazebo>
<plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so">
<parameters>$(find at_gazebo)/config/bh3.yaml</parameters>
</plugin>
</gazebo>
If this is removed, there is no robot_description
parameter error at launch, however, obviously, we cannot do anything useful with our system.
@christophfroehlich I can also confirm that the same URDF works fine using 0.4.6
, but the error above arises when on 0.4.7
. Has anything changed regarding loading the plugin? My current configuration was as follows:
<gazebo>
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
<robot_param>robot_description</robot_param>
<robot_param_node>robot_state_publisher</robot_param_node>
<parameters>$(arg ros2_controllers_config)</parameters> <!-- I guess the error occurs here --->
<ros>
<remapping>/tricycle_controller/cmd_vel:=/cmd_vel</remapping>
<remapping>/tricycle_controller/odom:=${common_params['wheel_odom_topic']}</remapping>
</ros>
</plugin>
</gazebo>
It seems that this came with #277, but I'm using gazebo_ros2_control 0.4.7 built from source and it works for my robot.
ros2 launch gazebo_ros2_control_demos tricycle_drive.launch.py
If this is all fine I guess that some special character from your URDF can't be processed here https://github.com/ros-controls/gazebo_ros2_control/blob/6621895fa1c765eb08d891afb8beaeb69e373999/gazebo_ros2_control/src/gazebo_ros2_control_plugin.cpp#L255-L257
@ahcorde If we can't fix this maybe we should think of reverting #277, because the robot_description parameter is deprecated anyways back to humble since https://github.com/ros-controls/ros2_control/pull/940. But I see that there is no possibility to pass the URDF to the controllers on humble and iron since https://github.com/ros-controls/ros2_control/pull/1088 won't get backported. Same feature request like in https://github.com/ros-controls/gz_ros2_control/issues/168
My problem was that the parser could not process several lines of xacro-urdf code, which were even commented out after the auto generation. After removing these lines by deleting them, the parser was able to process the rest. Problem could be somewhere in the parser...try to modify your urdf and use it instead of xacro file
@christophfroehlich Thanks for reopening the issue.
@mbed92 @smkyle90 can you confirm that the examples run with your setup? ros2 launch gazebo_ros2_control_demos tricycle_drive.launch.py
I can confirm that the tricycle demo works fine on 0.4.7
using the command ros2 launch gazebo_ros2_control_demos tricycle_drive.launch.py gui:=false
. By the way. When I start with gui:=true
, I get the following error (but it's probably irrelevant to this issue):
[spawn_entity.py-5] [ERROR 1711610650.110016674] [spawn_entity]: Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory? (_spawn_entity() at /opt/ros/humble/lib/gazebo_ros/spawn_entity.py:291)
[spawn_entity.py-5] [ERROR 1711610650.110274197] [spawn_entity]: Spawn service failed. Exiting. (run() at /opt/ros/humble/lib/gazebo_ros/spawn_entity.py:230)
Have you checked your URDF with xacro & check_urdf like here?
I can confirm that check_urdf
returns Successfully Parsed XML
. I ran the following command: xacro robot.urdf.xacro > tmp.urdf && check_urdf tmp.urdf
.
@ipa-ych can you point out what lines were causing troubles? The issue seems to be some parser error, but I'm running out of ideas which characters/phrases might be wrong.
I figured out what comments were the problem in my setup. Let's start from the beginning for all the people who spend two days on that 🥲
I was loading the robot_description
in the launchfile in the following way (similar to the Husky repo):
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
urdf_path,
...
]
)
robot_description = ParameterValue(robot_description_content, value_type=str)
return LaunchDescription([
Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
output='screen',
parameters=[{
'use_sim_time': use_sim_time,
'robot_description': robot_description
}]
),
...
])
As you can see, ParameterValue
parses the robot description content as a string (which is perfectly fine for the robot_state_publisher
). However, it seems that further passing string instead of YAML to other ROS nodes due to recent changes causes troubles to parsing certain characters. To figure out what lines were problematic I changed the line:
robot_description = ParameterValue(robot_description_content, value_type=str)
to
robot_description = ParameterValue(robot_description_content, value_type=None) # which parses the param as YAML instead of string
That change caused a list of parsing errors. In my case it were comments like:
comments with a colon
<!-- TODO(mbed): if needed we can put the STL mesh here -->
or
<!-- More reading: https://github.com/ethz-asl/kalibr/wiki/IMU-Noise-Model -->
comments with "###" like:
<!-- ### ROBOT BASE ### -->
Generally, I think this kind of error is super difficult to find because all signs show that URDF is OK, so you look everywhere but not there (at least initially). The decision is up to @christophfroehlich and contributors on handling that, but I think it should be pointed out somewhere in docs not to use specific characters due to parsing errors.
@mbed92 yes, this is an issue from the launch_ros
side https://github.com/ros2/launch_ros/issues/214
Right now, there is no proper solution for it, so probably we have to be careful for now. May be we can do something at ros2_control side to make the URDF available to the controllers
Thanks for the analysis. We'll discuss how we can fix this, but we have limited possibilities without breaking API for humble and iron.
I have run similar tests to @mbed92.
In summary:
check_urdf
returns Expect URDF xml file to parse
xacro
file. check_urdf
returns Expect URDF xml file to parse
.urdf
is parsed and gazebo_ros2_control
initializes.* Original XML `check_urdf` returns `Expect URDF xml file to parse`
have you run xacro and passed the resulting urdf to check_urdf
?
* Original XML `check_urdf` returns `Expect URDF xml file to parse`
have you run xacro and passed the resulting urdf to
check_urdf
?
Meant xacro, not XML, my mistake. Complete output for xacro file that results in a parsing error:
# .xacro
auto@simulation-XPS-8960:~/auto_simulation/at_gazebo/urdf$ check_urdf < bh3.xacro
Expect URDF xml file to parse
# .urdf
auto@simulation-XPS-8960:~/auto_simulation/at_gazebo/urdf$ check_urdf < bh3.urdf
Expect URDF xml file to parse
When I remove all comments with special characters, i.e., #, !, :, etc., check_urdf
output is the same but I do not get the parsing error on launch.
# .xacro auto@simulation-XPS-8960:~/auto_simulation/at_gazebo/urdf$ check_urdf < bh3.xacro Expect URDF xml file to parse # .urdf auto@simulation-XPS-8960:~/auto_simulation/at_gazebo/urdf$ check_urdf < bh3.urdf Expect URDF xml file to parse
As commented above: use xacro to generate a valid URDF and then pass it to check_urdf. If this is already the step from bh3.xacro to bh3.urdf, then is there already some other issue.
Yes, this is with newly generated urdf using xacro.
I was getting the same error for the past 2-3 days. Removing the comments as suggested by @mbed92 worked for me.
Thanks, removing comments worked for me as well. This simple function can be used in MOST cases:
import re
def remove_comments(text):
pattern = r'<!--(.*?)-->'
return re.sub(pattern, '', text, flags=re.DOTALL)
Thanks. I confirm that the temp solution is to generate the urdf file with xacro and remove by hand the comments before using it in the launch file.
Had the same issue and can confirm, removing comments from my xacro files worked to solve the error
Hi,
I have been trying to apply ros2_control tricycle_controller to cutomized robot model with three-wheel-layout. I am using gazebo 11 classic and ROS2 humble (with all required packages installed) I was following the tricycle_controller_tutorial (https://github.com/ros-controls/gazebo_ros2_control/blob/master/gazebo_ros2_control_demos/config/tricycle_drive_controller.yaml) to create tricycle_drive_controller.yaml and adding ros2_control & gazebo plugins to robot urdf file. In tricycle_drive_controller.yaml file, the traction_joint_name and steering_joint_name have been changed to match joints in the urdf model. The urdf can be correctly launched in rviz and geometry relationships are also correct.
However, when trying to run the launch file, the process always get stucked with parsing .yaml file and tricycle_controller cannot be launched. The Errorlog is as follow:
and my .yaml file is
The plgins in urdf model (before ):
The problem seems to be pasring .yaml file and parameter overriding with the urdf, but no collisions are found in the urdf. Section of urdf: