ros_map_editor

用GIMP等工具来进行地图的常规清理和编辑是一项费时费力的任务,为了解决这种情况,项目ros_map_editor提供一个强大而灵活的工具,使机器人领域的从业者和研究人员能够更轻松地编辑导航地图,以满足他们的特定碧求。

特点:

  1. 添加整行区域: 用户可以轻松地添加禁行区域,以确保机器人避开潜在危险区域
  2. 地图对齐:工具允许将导航地图与真实世界地图对齐,以便进行精确的导航
  3. 一般地图清理: 与传统工具相比,使用ros map editor进行地图清理更加高效

编译安装openCV 3.2
纯跟踪的实现的效果

纯跟踪被我改的只适合走折线了


全局路径的优化问题
abstract Welcome to my blog, enter password to read.
Read more
TEB和DWA算法的对比
  • DWA的轨迹目标函数太简单了,只有三方面:到目标的距离、到障碍物的距离、速度
  • DWA不考虑速度和路径平滑,容易导致机器人震动和轨迹扭动。
  • DWA 动态避障效果差。
  • DWA考虑了刹车距离,导致能达到的最大速度不高,加速也不够快。
  • DWA每次都选择下一步的最佳路径,而非全局最优路径。陷入局部最优时(即不存在路径可以通过),会在原地旋转一段时间,直到找到可行路径。
  • DWA难过窄通道,或者说参数难以调整。


  • TEB在运动过程中会调整自己的位姿朝向,当到达目标点时,通常机器人的朝向也是目标朝向而不需要旋转。 DWA常常先到达目标坐标点,然后原地旋转到目标朝向。
  • TEB的速度和角度波动较大、控制不稳定。在计算资源足够的情况下,提高控制频率可以改善此现象。另一种方法是使用优化,即修改TEB算法的评价函数,把每次速度和角度的变化量除以时间再乘一个代价系数。

如何走边界路径
abstract Welcome to my blog, enter password to read.
Read more
避障及存在的问题
abstract Welcome to my blog, enter password to read.
Read more
move_base中的多线程

move_base.cpp中用到的多线程:

1
2
3
4
5
boost::condition_variable_any  planner_cond_;

boost::thread* planner_thread_;

boost::recursive_mutex planner_mutex_;

代价地图里有个锁mutex_t,其实就是boost::recursive_mutex,膨胀层里还用到了读写锁boost::shared_mutex* access_

递归锁

move_base里用的锁主要是boost::recursive_mutex planner_mutex_,而且是和boost::unique_lock, boost::recursive_mutex::scoped_lock 搭配使用。

使用到planner_mutex_的函数有planThread, executeCb, executeCycle(6次), resetState。其他3个函数,每个都只使用了一次planner_mutex_

只有一次是在生成路径后,交互变量。其他全是和planThread有关的,基本是对runPlanner赋值,比如

1
2
3
4
5
boost::unique_lock<boost::recursive_mutex> lock(planner_mutex_);
planner_goal_ = goal;
runPlanner_ = true;
planner_cond_.notify_one();
lock.unlock();


经过我大量修改,move_base在有导航任务时,如果ctrl+C退出,终端必定会出现下面的错误,虽然毫无影响,但是毕竟不优雅
move_base 退出时报错死锁
这个错误是在有锁的情况下,仍然加锁。 也就是多调用了lock()函数。

搜索move_base,发现只有7个lock()。逐个查看,由于是退出时的报错,所以不可能是makePlan的那个,很容易发现是planThread函数最后的那个。加上判断即可解决

1
2
if( !lock.owns_lock() )
lock.lock();

对于其他使用lock()的地方,最好也加上这个判断。


Detected jump back in time
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[ WARN] [1709619594.875225471]: Control loop missed its desired rate of 300.00 Hz... the loop actually took 0.0087 seconds

// joint_state 报错,不是重点
[ WARN] [1709619595.976339929]: Moved backwards in time (probably because ROS clock was reset), re-publishing joint transforms!
[ WARN] [1709619595.982125868]: Detected jump back in time of 1.05772s. Clearing TF buffer.
[ WARN] [1709619595.983936734]: Detected jump back in time of 1.05592s. Clearing TF buffer.
[ERROR] [1709619595.987547945]: Exception in PurePursuitPlanner::transformPose : Lookup would require extrapolation at time 1709619597.011688232, but only time 1709619596.080649853 is in the buffe, when looking up transform from frame [map] to frame [cutter_head]
[ERROR] [1709619595.987830086]: transform GlobalPoseToLocal failed
[ERROR] [1709619595.988800520]: Exception in PurePursuitPlanner::transformPose : Lookup would require extrapolation at time 1709619597.011688232, but only time 1709619596.080649853 is in the buffe, when looking up transform from frame [map] to frame [cutter_head]
[ERROR] [1709619596.028980155]: transform GlobalPoseToLocal failed
[ERROR] [1709619596.032062451]: Connectivity Error looking up robot pose: Could not find a connection between 'map' and 'base_link' because they are not part of the same tree.Tf has two or more unconnected trees.


[ERROR] [1709619596.032538970]: in_pose frame is empty!
[ERROR] [1709619596.032780641]: Exception in PurePursuitPlanner::transform global plan: Unable to transform robot pose into global plan's frame
[ WARN] [1709619596.033289244]: Unable to get starting pose of robot, so unable to create global plan
[ WARN] [1709619596.034867606]: Unable to get starting pose of robot, so unable to create global plan
[ WARN] [1709619596.034939482]: move_base didn't receive global plan, mower's recoverying and will try again ......

[ WARN] [1709619596.036663888]: Clearing costmap to unstuck robot (3.000000m).
[ERROR] [1709619596.036978217]: Cannot clear map because pose cannot be retrieved
[ WARN] [1709619596.040011241]: Unable to get starting pose of robot, so unable to create global plan
[ WARN] [1709619596.040297600]: move_base didn't receive global plan, mower's recoverying and will try again ......

[ WARN] [1709619596.045662906]: Clearing costmap to unstuck robot (0.000000m).
[ERROR] [1709619596.046150987]: Cannot clear map because pose cannot be retrieved
[ WARN] [1709619596.052540739]: Unable to get starting pose of robot, so unable to create global plan
[ WARN] [1709619596.052682668]: move_base didn't receive global plan, mower's recoverying and will try again ......

[ WARN] [1709619596.068955672]: All recovery behaviors have failed, locking the planner and disabling it.

[ WARN] [1709619596.069181666]: Your executeCallback did not set the goal to a terminal status.
This is a bug in your ActionServer implementation. Fix your code!
For now, the ActionServer will set this goal to aborted

这个问题与时间同步和TF有关,在本地打开Rviz和SSH运行远程程序时,有很小概率出现此错误。


状态机和脱困机制
本博客涉及公司内容,请输入密码
Read more