在两台主机之间,使用tf
变换时,因为主机时间戳不同步,导致tf
变换超时
[ WARN] [1555379888.006898613]: Timed out waiting for transform from base_footprint to map to become available before running costmap, tf error: Lookup would require extrapolation into the past. Requested time 1555379883.350785017 but the earliest data is at time 1555379884.917741476, when looking up transform from frame [base_footprint] to frame [map]. canTransform returned after 0.100909 timeout was 0.1.
可通过ntp来对局域网内的两台主机进行开机自动同步时钟
(1)配置master
1.安装ntp:
$ sudo apt install ntp
2.在/etc/ntp.conf中配置ntp参数
$ sudo vim /etc/ntp.conf
3.在文件中添加以下内容:
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap # 192.168.1.0 即局域网网段
server 127.127.1.0 # 获取本地时钟
fudge 127.127.1.0 stratum 10
4.重启ntp服务:
$ sudo /etc/init.d/ntp restart
(2)配置客户端
1.安装ntp
$ sudo apt install ntp
2.在/etc/ntp.conf中配置ntp参数
server 192.168.1.100 # 客户端的ip地址
3.重启ntp服务:
$ sudo /etc/init.d/ntp restart
(3)开机自动同步时间
rc.local脚本是一个ubuntu开机后会自动执行的脚本,该脚本位于/etc/路径下。
添加如下指令:
$ sudo /usr/sbin/ntpdate 192.168.1.100
如果出现:no server suitable for synchronization found
检查ntp server的防火墙。可能是server的防火墙屏蔽了upd 123端口。可以用命令
#service iptables stop
来关掉iptables服务后再尝试从ntp客户端的同步
参考博客:完美解决ntp的错误问题