ROS学习记录:RLException: Invalid <param> tag: Cannot load command parameter [robot_description]: no such

本人Ubuntu版本:20.04

在运行基于gazebo的仿真的时候出现了这样的报错:

跟着报错去检查对应的xml文件时发现没有问题,然后参考

Problem with xacro invalid <param> - ROS Answers: Open Source Q&A Forum 时发现了我要的答案,网页截图如下:

简言之问题在于launch文件中涉及的版本问题,本人的launch文件代码具体如下:

<?xml version="1.0"?>
<launch>

  <!-- these are the arguments you can pass this launch file, for example paused:=true -->
  <arg name="paused" default="true"/>
  <arg name="use_sim_time" default="false"/>
  <arg name="gui" default="true"/>
  <arg name="headless" default="false"/>
  <arg name="debug" default="true"/>

  <!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
   <include file="$(find gazebo_ros)/launch/empty_world.launch"> 
     <arg name="world_name" value="$(find gazebotest)/worlds/robot.world"/>
    <arg name="debug" value="$(arg debug)" />
    <arg name="gui" value="$(arg gui)" />
    <arg name="paused" value="$(arg paused)"/>
    <arg name="use_sim_time" value="$(arg use_sim_time)"/>
    <arg name="headless" value="$(arg headless)"/>
  </include>

  <!-- Load the URDF into the ROS Parameter Server -->
  <arg name="model" />
  <param name="robot_description" 
     command="$(find xacro)/xacro.py $(arg model)" />

  <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
   <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
    args="-urdf -model robot1 -param robot_description -z 0.05"/> 

</launch>

具体代码段

<param name="robot_description" 
     command="$(find xacro)/xacro.py $(arg model)" />

中的xacro.py应该修改为xacro,因为在20.04 noetic对应的ROS中识别的是xacro

修改后如下

<param name="robot_description" 
     command="$(find xacro)/xacro $(arg model)" />

再编译,配置环境,运行后,成功得到预期效果

所以事实上很多问题都是版本的锅,版本之间差距太大真的难受,一路上从跟着教程到做实例依样画葫芦都是坐牢过来的 ((((

 

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值