Ubuntu 20.04在rviz中仿真机器人导航问题记录

1、问题描述:学习古月居的《ros机器人开发实践》第九章的9.9节时,运行命令

roslaunch mrobot_bringup fake_mrobot_with_laser.launch

出现了报错,具体报错信息为

ERROR: cannot launch node of type [robot_state_publisher/state_publisher]: Cannot locate node of type [state_publisher] in package [robot_state_publisher]. Make sure file exists in package path and permission is set to executable (chmod +x)

2、解决方案:

(1) 运行以下命令安装robot_state_publisher

sudo apt-get install ros-kinetic-robot-state-publisher

sudo apt-get update

(2)修改fake_mrobot_with_laser.launch

fake_mrobot_with_laser.launch:

<launch>

    <param name="/use_sim_time" value="false" />

    <!-- 加载机器人URDF/Xacro模型 -->
    <arg name="urdf_file" default="$(find xacro)/xacro --inorder '$(find mrobot_description)/urdf/mrobot_with_rplidar.urdf.xacro'" />

    <param name="robot_description" command="$(arg urdf_file)" />

    <node name="arbotix" pkg="arbotix_python" type="arbotix_driver" output="screen" clear_params="true">
        <rosparam file="$(find mrobot_bringup)/config/fake_mrobot_arbotix.yaml" command="load" />
        <param name="sim" value="true"/>
    </node>

    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
    <node name="robot_state_publisher" pkg="state_publisher" type="robot_state_publisher">
        <param name="publish_frequency" type="double" value="20.0" />
    </node>

</launch>


<node name="robot_state_publisher" pkg="state_publisher" type="robot_state_publisher">

修改为:

<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher">

 现在应该不会报错了,但是会有一个警告信息:[ WARN] [1720667758.559341768]: Joint state with name: "base_l_wheel_joint" was received but not found in URDF.

然后我就去查看了launch里面用到的urdf文件,发现对左轮的joint命名为 right_wheel_joint.

<joint name="right_wheel_joint" type="continuous">
            <origin xyz="0 -${(motor_length+wheel_length)/2} 0" rpy="0 0 0"/>
            <parent link="right_motor"/>
            <child link="right_wheel_link"/>
            <axis xyz="0 1 0"/>
        </joint>

将<joint name="right_wheel_joint" type="continuous">改为<joint name="base_r_wheel_joint" type="continuous">

更改后的joint代码为:

 <joint name="base_r_wheel_joint" type="continuous">
            <origin xyz="0 -${(motor_length+wheel_length)/2} 0" rpy="0 0 0"/>
            <parent link="right_motor"/>
            <child link="right_wheel_link"/>
            <axis xyz="0 1 0"/>
        </joint>

然后打开新的终端,运行 roslaunch mrobot_navigation fake_nav_demo.launch就可以在rviz中看到导航地图啦。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值