admin管理员组

文章数量:1569311

ROS 问题汇总(持续更新)

  • 1 新建工作空间出现错误Could NOT find PY_em (missing: PY_EM):
  • 2 出现警告:the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update
  • 3 gazebo相关问题:
    • 3.1 gazebo执行Save World As 保存世界界面卡住不动
    • 3.2 在gazebo中加入差分驱动插件后rostopic没有/cmd_vel话题
  • 4 Rviz相关问题
    • 4.1 No transform from [map] to [base_footprint]
    • 4.2 TF_REPEATED_DATA ignoring data with redundant timestamp for frame RFW_link at time 580.871000 according to authority unknown_publisher
  • 5 launch文件相关问题
    • 5.1 重命名(发布)话题(话题映射/remap无效)
    • 5.2 16进制传参无效
  • 6 tf相关
    • 6.1 undefined reference to `tf::TransformBroadcaster::TransformBroadcaster()’
  • 7 功能包安装报错:CMake Error at /opt/ros/noetic/share/ros/core/rosbuild/private.cmake:99 (message)
  • 8 路径规划相关
    • 8.1 局部路径规划不规划地图未知局域
    • 8.2 实物小车进行SLAM(gmapping)时出现TF转换错误:[Lookup would require extrapolation...
    • 8.3 使用Navigation时出现 Costmap2DROS transform timeout. Current time: 1676794574.868413376, global_pose stamp: 1676606594.1032, tolerance: 0.5000报错。
    • 8.4 全局路径规划:Failed to get a plan from potential when a legal potential was found.
  • 9 动态调参相关
    • 9.1 多组数据动态调参启动失败
  • 10 WSL使用相关
    • 10.1 WSL2下rviz启动不了(Segmentation fault)
  • 11 Stage相关
    • 11.1 stage与urdf文件fram id 冲突

1 新建工作空间出现错误Could NOT find PY_em (missing: PY_EM):

问题描述
新建ROS工程:

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make

出现以下问题:

Could NOT find PY_em (missing: PY_EM)
CMake Error at /opt/ros/noetic/share/catkin/cmake/empy.cmake:30 (message): 

参考博客:https://blog.csdn/tanmx219/article/details/122765853
问题原因
这是因为catkin找的的python版本为anaconda下面的版本
解决方案
所以需要改为指定采用下面的命令

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3

2 出现警告:the rosdep view is empty: call ‘sudo rosdep init’ and 'rosdep update

问题描述:出现警告:the rosdep view is empty: call ‘sudo rosdep init’ and 'rosdep update
the rosdep view is empty: call ‘sudo rosdep init’ and ‘rosdep update’
问题原因:未知
解决方法:问题参考文献中有相应方法,这里推荐使用:
鱼香ROS一键安装系列–>一键配置:rosdep(小鱼的rosdepc,又快又好用)。
wget http://fishros/install -O fishros && . fishros
运行后再使用rosdepc update即可。方便快捷。

3 gazebo相关问题:

3.1 gazebo执行Save World As 保存世界界面卡住不动

问题描述:在gazebo中修改了环境模型想保存世界,但界面止住不动了。
问题原因
解决方法:在启动gazebo前赋予sudo权限。推荐使用办法:在打开前使用一下sudo apt update,然后再打开gazebo并保存。

3.2 在gazebo中加入差分驱动插件后rostopic没有/cmd_vel话题

问题描述: 在gazebo中加入差分驱动插件后rostopic没有/cmd_vel话题。
问题原因:将驱动关节类型设为了fixed。
解决方法:将轮子关节改为continuous(相应可驱动关节类型?)即可。
另可参考:在gazebo中加入差分驱动插件后rostopic没有/cmd_vel话题的一种解决办法

4 Rviz相关问题

4.1 No transform from [map] to [base_footprint]

问题描述:在进行slam建图时,fixed_fram设为map时,出现一系列No transform from [map] to [base_footprint]机器人模型无法加载transform问题。
问题原因:需要启动joint_state_publisherrobot_state_publisher节点,且需要将joint_state_publisherrobot_state_publisher加在了启动rviz前面(本人出现问题就是加在了后面)。
解决方法:在启动rviz节点加入以下两个节点:

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

即:

<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
<node pkg="rviz" type="rviz" name="rviz" required="true" args="-d $(find mybot_description)/config/display.rviz" />

参考文献:ROS–解决使用RVIZ时,机器人模型无法加载transform的问题,亲测有效!

4.2 TF_REPEATED_DATA ignoring data with redundant timestamp for frame RFW_link at time 580.871000 according to authority unknown_publisher

参考文献:【问题解决】rrt_exploration功能包使用过程中报错处理
问题描述
情况1:采用gazebo进行slam建图时,rviz终端会一直产生警告: TF_REPEATED_DATA ignoring data with redundant timestamp for frame RFW_link at time 580.871000 according to authority unknown_publisher
情况2:[更新]在写轮式里程计时又遇到了类似问题,写完后运行一直警告: TF_REPEATED_DATA ignoring data with redundant timestamp for frame base_footprint at time 1679061946.725895 according to authority unknown_publisher
问题原因
1:robot_state_publisher发布了左右轮到base_link的tf变换,但是/gazebo又发布了左右轮到base_footprint的tf变换,导致了二者的冲突。
2:<broadcastTF>标签值为false:<broadcastTF>false</broadcastTF>也会导致该问题。
3:[更新]有可能是更新(发布速度太快)原发布速度设置约40Hz,查看tf树仅有约20Hz。
解决方法
1:将机器人描述的xacro文件中gazebo_control中的publishWheelTF和publishWheelJointState均设置为false就可以解决掉这个问题。
2:将<broadcastTF>标签值设为1可解决该问题:<broadcastTF>1</broadcastTF>
3:[更新]可以尝试将发布频率改小即可(我改到了约5Hz后仅在启动时有几个警告)。

5 launch文件相关问题

5.1 重命名(发布)话题(话题映射/remap无效)

问题描述:realsense(D435)发布的 pointcloud2 点云话题为:/camera/depth/color/points,想使用的点云话题为/mybot/pointcloud2(自定义话题),因此,需要做一个话题映射。但使用remap标签后,无法在rviz中找到话题/mybot/pointcloud2

<remap from="/camera/depth/color/points" to="/mybot/pointcloud2" />

问题原因:如果remap成功,也是只能看到from=的话题,是看不到to=的话题的。ROS中topic重映射理解及验证(remap标签)
解决方法:使用topic_tools功能包(不需要额外安装)的relay节点进行话题映射,在launch文件添加如下:

<node  pkg="topic_tools" type="relay"  name="renamePointCloud2" 
	args="/camera/depth/color/points  /mybot/pointcloud2  "/>

5.2 16进制传参无效

问题描述:这两天调试奥比中光Astra_pro相机时,出现警告

Warning: USB events thread - failed to set priority. This might cause loss o

WARN:UVCCameraDriver camera is not opened

问题原因*:因为在launch文件调用节点时,传入产品ID时,设置为了16进制数(官方example也是),经过调试发现,在launch文件中设置的16进制参数并没有传入节点中。
PS:节点中设置的该参数类型为int类型。
解决方法:将16进制数改为10进制数即可。

<arg name="uvc_vendor_id" value="11205"/>
<!-- <arg name="uvc_vendor_id" value="0x2bc5"/> -->
<arg name="uvc_product_id" value="1281"/>
<!-- <arg name="uvc_product_id" value="0x0501"/> -->

6 tf相关

6.1 undefined reference to `tf::TransformBroadcaster::TransformBroadcaster()’

问题描述:在使用tf::TransformBroadcaster::sendTransform(tf::StampedTransform const&)函数时,编译报错:

undefined reference to `tf::TransformBroadcaster::TransformBroadcaster()'
undefined reference to `tf::TransformBroadcaster::sendTransform(tf::StampedTransform const&)' collect2: error: ld returned 1 exit status

问题原因:仅添加了tf头文件,没在Cmakelist.txt和package.xml中添加TF依赖。参考:ROS常见问题及解决方法
解决方法:在Cmakelist.txt和package.xml中添加TF依赖。

find_package(catkin REQUIRED COMPONENTS
 nav_msgs
 rospy
 std_msgs
 tf
)
  <build_depend>tf</build_depend>

  <exec_depend>tf</exec_depend>

7 功能包安装报错:CMake Error at /opt/ros/noetic/share/ros/core/rosbuild/private.cmake:99 (message)

问题描述:在安装ORB_SLAM3的ROS包时,报错:

CMake Error at /opt/ros/noetic/share/ros/core/rosbuild/private.cmake:99 (message):
  [rosbuild] rospack found package "ORB_SLAM3" at "", but the current
  directory is "/home/zobot/ThirdParty/ORB_SLAM3/Examples_old/ROS/ORB_SLAM3".
  You should double-check your ROS_PACKAGE_PATH to ensure that packages are  found in the correct precedence order.
Call Stack (most recent call first):
  /opt/ros/noetic/share/ros/core/rosbuild/public.cmake:177 (_rosbuild_check_package_location)
  CMakeLists.txt:5 (rosbuild_init)

问题原因
根本原因:未找到,ROS_PACKAGE_PATH路径。参考:「 Linux调试错误 」CMake Error at /opt/ros/kinetic/share/ros/core/rosbuild/public.cmake:129 (message):
解决方法
~/.bashrc文件中添加ROS功能包路径:
(根据自己实际情况)

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM3/Examples_old/ROS

注意事项
我之前安装时就已添加过路径,这次报错是因为我在添加的的路径后,又添加了

source ~/catkin_ws/devel/setup.bash

导致添加的路径无效,因此,添加路径尽量放在最后,或自行甄别将source ~/catkin_ws/devel/setup.bash类似语句放到添加路径前面。
tip:可以使用下述命令查看ROS功能包路径,确保你的功能包路径都添加了。

echo $ROS_PACKAGE_PATH

8 路径规划相关

8.1 局部路径规划不规划地图未知局域

问题描述:当使用实时SLAM进行路径规划时,局部路径规划不规划地图未知局域
问题原因:move_base中设置机器人是否可以在地图未知区域中行走需要分别设置全局路径规划与代价地图中的两个参数:
全局路径规划配置文件(允许):

GlobalPlanner:
	allow_unkonwn: true

代价地图配置文件(允许):

local_costmap:
	track_unknown_space: false
# *******************************
global_costmap:
	track_unknown_space: false

我原先的配置中:

local_costmap:
	track_unknown_space: true
# *******************************
global_costmap:
	track_unknown_space: true

解决方法:修改配置文件相应参数设置即可。
允许时:

GlobalPlanner:
	allow_unkonwn: true
# *******************************
local_costmap:
	track_unknown_space: false
# *******************************
global_costmap:
	track_unknown_space: false

不允许时:

GlobalPlanner:
	allow_unkonwn: false
# *******************************
local_costmap:
	track_unknown_space: true
# *******************************
global_costmap:
	track_unknown_space: true

参考:设置ROS机器人避免行走到地图未知区域

8.2 实物小车进行SLAM(gmapping)时出现TF转换错误:[Lookup would require extrapolation…

问题描述:在使用实物小车,主从机运行,进行gmapping建图时,在RVIZ的LaserScan插件处出现TF错误,如下:

For frame [lds01_link]: No transform to fixed frame [map].  TF error: [Lookup would require extrapolation 57608.778330064s into the future.  Requested time 1676851201.228616476 but the latest data is at time 1676793592.450286388, when looking up transform from frame [lds01_link] to frame [map]]

即没有雷达坐标系与地图坐标系的TF转换,对机器人模型也没有base_footprintmap的转换。但通过rosrun rqt_tf_tree rqt_tf_tree查看TF树各部分连接完整。
问题原因:猜测里程计坐标系与地图坐标系断开(虽然TF树中是完整的…)???如有同学找到其他答案,望告知。
解决方法:添加mapodom间的静态tf转换:

  <node pkg="tf2_ros" type="static_transform_publisher" name="map_odom_broadcaster" 
    args="0 0 0 0 0 0 /map /odom" />

算是暂时解决了吧…

8.3 使用Navigation时出现 Costmap2DROS transform timeout. Current time: 1676794574.868413376, global_pose stamp: 1676606594.1032, tolerance: 0.5000报错。

问题描述:在使用实物小车,主从机运行,使用Navigation时出现 Costmap2DROS transform timeout. Current time: 1676794574.868413376, global_pose stamp: 1676606594.1032, tolerance: 0.5000报错。
问题原因:通过时间戳转换检查,发现 global_pose stamp(树莓派)时间在1970年。很明显,是树莓派时间(从机时间)没有与网络时间(主机时间)同步。
解决方法:配置 Linux (树莓派)的时钟同步 。如果树莓派(从机)也是接入了互联网的话,这种问题应该是偶尔的,可以重启试试(我的就是重启后就好了,PS:最好关闭roscore后再打开。),不想重启可以先手动设置一下使用:

sudo date -s “2023-02-19 16:30:05”

参考文献:配置 Linux 的时钟同步 ;ROS多机通讯/时间同步;ROS主从机时间同步,ROS开主从机以及时间同步,树莓派设置时间及重启后失效总结


8.4 全局路径规划:Failed to get a plan from potential when a legal potential was found.

问题描述:在使用全局路径规划时,遇到错误:

[ERROR] [1676947824.274339142]: NO PATH!
[ERROR] [1676947824.274384194]: Failed to get a plan from potential when a legal potential was found. This shouldn't happen.

问题原因
直接原因:设置了全局路径规划参数为:

use_dijkstra: true 
use_grid_path: true
#或
use_dijkstra: false 
use_grid_path: false

可能根本原因:由于路径起点周围的栅格上缺少势值所致。可查看源代码(gradient_path.cpp)约86行:

while (c++<ns*4) {
   // check if near goal
   double nx = stc % xs_ + dx, ny = stc / xs_ + dy;
	if (fabs(nx - start_x) < .5 && fabs(ny - start_y) < .5) {
	xxxx
	}
}

实际上有时:(nx, ny)与(start_x, start_y)的距离大于0.5,因此路径提取将返回false(退出while循环)。
参考:
NO PATH ! error and questions to gradient_path.cpp in global_planner
Some errors when using GlobalPlanner
解决方法
1.设置全局规划参数为:

use_dijkstra: true 
use_grid_path: false
#或
use_dijkstra: false 
use_grid_path: true

2.修改gradient_path.cpp文件中

if (fabs(nx - start_x) < .5 && fabs(ny - start_y) < .5) {

if (fabs(nx - start_x) < 1 && fabs(ny - start_y) < 1) {

3.调整代价地图参数:inflation_radiuscost_scaling_factor(减小膨胀半径并增加缩放因子,以便全局成本图不会显示障碍周围太宽的成本)。

参考文献:https://wwwblogs/miaorn/p/13998299.html

9 动态调参相关

9.1 多组数据动态调参启动失败

问题描述:最近在使用ROS动态调参工具rqt_reconfigure,通过设置由于想同时实现两组参数(分别位于不同的cfg文件中)的动态调参,在启动节点时出现错误:

[ERROR] [1680055777.194702066]: Tried to advertise a service that is already advertised in this node [/robot_chassis_node/set_parameters]

问题原因:没有深究,经测试发现,应该是一个节点不能同时加载两个cfg文件实现两组数据的动态调参。
解决方法
1)如果可以单独调试每组数据最好,分别设置启动信息即可。
2)还是想一起调试,则可以将所有需要动态调参的参数写到同一个cfg配置文件中即可。

10 WSL使用相关

10.1 WSL2下rviz启动不了(Segmentation fault)

问题描述:正确安装所有内容后,rviz无法启动出现段错误。

问题原因:未知
解决方法
单次可在终端运行:

export LIBGL_ALWAYS_INDIRECT=0

永久可在~/.bashrc等文件中加入,并刷新即可。

参考文献:https://blog.csdn/sinat_52032317/article/details/128191645

11 Stage相关

11.1 stage与urdf文件fram id 冲突

问题描述:如下,为匹配其他设置(如slam等)中的fram id,在启动stage时使用了自已的urdf文件

<launch>

    <!-- 添加 机器人模型描述 -->
    <include file="$(find robot_description)/launch/robot_description.launch"/>

    <!--  ************** Global Parameters ***************  -->
    <param name="/use_sim_time" value="true"/>

    <!--  ************** Stage Simulator ***************  -->
    <node pkg="stage_ros" type="stageros" name="stageros" args="$(find robot_description)/env/env.world">
        <param name="base_watchdog_timeout" value="0.5"/>
        <remap from="base_scan" to="scan"/>
        <remap from="odom" to="odom"/>
    </node>
    
</launch>

在启动slam后发现,一直报警告(如下):

Warning: TF_REPEATED_DATA ignoring data with redundant timestamp for frame odom (parent map) at 4.850000 according to authority unknown_publisher at line 278 in /temp/binarydeb/ros-noetic-tf2-0.7.7/src/buffer_core.cpp

问题原因:通过查看tf树(rosrun rqt_tf_tree rqt_tf_tree),发现,在添加了雷达后,stage ros发布了base_laser_link作为雷达的默认frame_id,因此在,使用基于urdf文件的slam和navigation配置时,会出现错误(猜测)。
解决方法(猜测):根据stageros的frame_id重新配置相关内容。暂时没时间验证了…仅作参考。

本文标签: ros