背景环境:
Ubuntu 20.0.04
ROS-Noetic
所学教程:《ROS机器人开发实践》chapter 6_2
问题描述及解决方法:
- 报错:无法启动节点<robot_state_publisher/state_publisher>
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)
原因:名称不对应导致无法定位该节点,修改display_mrobot_chassis_urdf.launch
文件中robot_state_publisher的type:
将
<!-- 运行robot_state_publisher节点,发布tf -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
修改为
<!-- 运行robot_state_publisher节点,发布tf -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
- 在rviz中打开后没有出现joint_state_publisher图形控制界面,也就无法来调节控制rviz中对应*模型的转动
原因:可能是版本更新的问题,现在joint_state_publisher节点不会调出图形控制界面,需要下载joint_state_publisher_gui并修改display_mrobot_chassis_urdf.launch
文件。
下载joint_state_publisher_gui
$ sudo apt-get install ros-noetic-joint-state-publisher-gui
然后修改display_mrobot_chassis_urdf.launch
文件,将joint_state_publisher替换为joint_state_publisher_gui
<!-- 运行joint_state_publisher节点,发布机器人的关节状态 -->
<node name="joint_state_publisher_gui" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" />
-
rviz中没有显示机器人模型
首先将rviz左栏Display中Global Options-Fixed Frame
改成base_link
,然后左下角Add添加RobotModel
,OK了。