2
启动map_server后一直阻塞
source link: https://charon-cheung.github.io/2023/08/15/%E9%82%A3%E4%BA%9B%E5%8D%A1%E6%88%91%E5%BE%88%E4%B9%85%E7%9A%84bug/%E5%90%AF%E5%8A%A8map_server%E5%90%8E%E4%B8%80%E7%9B%B4%E9%98%BB%E5%A1%9E/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
启动map_server后一直阻塞 | 沉默杀手
启动map_server后一直阻塞
2023-08-15|那些卡我很久的bug|
Word count: 122|Reading time: 1 min
有几次,map_server打开pgm时一直阻塞,只能重启ROS。
map_server::loadMapFromFile(&map_resp_,mapfname.c_str(),res,negate,occ_th,free_th, origin, mode);
ROS_INFO("map_server after loadMapFromFile");
// To make sure get a consistent time in simulation
ros::Time::waitForValid();
经过加日志,发现是 ros::Time::waitForValid();
没有执行完,问题出在这里。
bool Time::waitForValid(const ros::WallDuration& timeout)
{
ros::WallTime start = ros::WallTime::now();
while (!isValid() && !g_stopped)
{
ros::WallDuration(0.01).sleep();
if (timeout > ros::WallDuration(0, 0) && (ros::WallTime::now() - start > timeout))
{
return false;
}
}
if (g_stopped)
{
return false;
}
return true;
}
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK