对nav2_gps_waypoint_follower_demo中定义的urdf文件turtlebot3_waffle_gps.urdf,在launch时采用如下方式加载:
default_model_path = os.path.join(pkg_share, 'urdf/turtlebot3_waffle_gps.urdf')
launch.actions.DeclareLaunchArgument(name='model', default_value=default_model_path,
description='Absolute path to robot urdf file'),
执行时提示:XML Parsing Error: XML or text declaration not at start of entity。
具体如下:
[ERROR] [launch]: Caught exception in launch (see debug for traceback): executed command failed. Command: xacro /home/tom/Tom/DockerContent/nav2_ws/install/nav2_gps_waypoint_follower_demo/share/nav2_gps_waypoint_follower_demo/urdf/turtlebot3_waffle_gps.urdf
Captured stderr output: XML parsing error: XML or text declaration not at start of entity: line 4, column 0
打开turtlebot3_waffle_gps.urdf文件看前几行的代码:
<!-- This is the same turtlebot urdf in nav2 with the following changes -->
<!-- 1. A link for the GPS sensor is added -->
<?xml version="1.0" ?>
<robot name="turtlebot3_waffle" xmlns:xacro="http://ros.org/wiki/xacro">
<!-- <xacro:include filename="$(find turtlebot3_description)/urdf/common_properties.urdf"/>
根据错误提示,第4行xml的声明不在入口的开始(XML or text declaration not at start of entity: line 4, column 0),于是将前面的注释和空格都删掉,前面几行改为:
<?xml version="1.0" ?>
<robot name="turtlebot3_waffle" xmlns:xacro="http://ros.org/wiki/xacro">
<!-- <xacro:include filename="$(find turtlebot3_description)/urdf/common_properties.urdf"/>
再次编译执行,就好了。
欢迎加入多源融合定位与控制技术讨论QQ群,群号:518859469
来自:上海代数律动技术有限公司