ROS master节点管理器,配置两台主机的时间戳同步

在两台主机之间,使用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)配置客户端(无用,直接第3步)
1.安装ntp

$ sudo apt install ntp

2.在/etc/ntp.conf中配置ntp参数

server 192.168.1.101  # 服务端的ip地址

3.重启ntp服务:

$ sudo /etc/init.d/ntp restart

(3)开机自动同步时间
安装ntpdate,ntpdate和ntp冲突,在客户端安装ntpdate,卸载ntp

sudo apt-get install ntpdate

安装成功后,可以使用以下命令查看NTP服务器的配置:

cat /etc/default/ntpdate

rc.local脚本是一个ubuntu开机后会自动执行的脚本,该脚本位于/etc/路径下。
添加如下指令:

$ sudo /usr/sbin/ntpdate 192.168.1.101

注意保证两台电脑的时区一致,否则同步成功也会自动转换时区

如果出现服务已存在,需要手动把ntp停止掉再重新同步!
如果出现:no server suitable for synchronization found
检查ntp server的防火墙。可能是server的防火墙屏蔽了upd 123端口。可以用命令

service iptables stop

来关掉iptables服务后再尝试从ntp客户端的同步
参考博客:完美解决ntp的错误问题

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

秃头队长

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值