nav2_gps_waypoint_follower_demo:XML Parsing Error: XML or text declaration not at start of entity

对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

来自:上海代数律动技术有限公司

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值