有一次机器人没有装雷达和相机,打算随便跑跑。于是在通用代价地图的障碍层,不设置传感器数据来源,运行move_base
出现频繁报警1
The /scan observation buffer has not been updated for 22.06 seconds, and it should be updated every 5.00 seconds.
来源在1
2
3
4
5
6
7
8
9
10
11
12
13
14bool ObservationBuffer::isCurrent() const
{
if (expected_update_rate_ == ros::Duration(0.0))
return true;
// last_updated_ 没有赋值
bool current = (ros::Time::now() - last_updated_).toSec() <= expected_update_rate_.toSec();
if (!current)
{
ROS_WARN(
"The %s observation buffer has not been updated for %.2f seconds, and it should be updated every %.2f seconds.",
topic_name_.c_str(), (ros::Time::now() - last_updated_).toSec(), expected_update_rate_.toSec());
}
return current;
}
此时发导航命令,又有报警1
[/move_base]:Sensor data is out of date, we're not going to allow commanding of the base for safety
因为没有可靠的传感器数据,move_base
不允许车跑起来。来源在MoveBase::executeCycle
1
2
3
4
5
6if(!controller_costmap_ros_->isCurrent())
{
ROS_WARN("[%s]:Sensor data is out of date, we're not going to allow commanding of the base for safety",ros::this_node::getName().c_str());
publishZeroVelocity();
return false;
}
也就是函数1
2
3
4
5
6
7
8
9bool LayeredCostmap::isCurrent()
{
current_ = true;
for (vector<boost::shared_ptr<Layer> >::iterator plugin = plugins_.begin(); plugin != plugins_.end();
++plugin)
{
current_ = current_ && (*plugin)->isCurrent();
}
}
显然是因为障碍层不符合isCurrent
,导致代价地图也不符合isCurrent
。如果希望车照样跑,就把MoveBase::executeCycle
那段注释掉,把ObservationBuffer::isCurrent()
的报警也注释掉,否则没完没了。
从网上下载一个包含雷达数据的bag,又设置了通用代价地图和tf树后,发现报警依然,应该还是时间戳问题,懒得再对齐了。