当前位置:网站首页>ROS当中的仿真时间以及Bag包操作
ROS当中的仿真时间以及Bag包操作
2022-06-29 06:41:00 【Hermit_Rabbit】
ROS时间种类
ROS中有两种时间:
ROS::Time[/Duration/Rate]:ROS时间——来源可以被认为修改如加速/减速/暂停。ROS::WallTime[WallDuration/WallRate]:ROS绝对时间——不可修改的"真实"时间。
所有的ros::node在启动时如果有设置[ros::param] \use_sim_time = true则节点的ROS::Time从/clock中获取,否则其值和ROS::WallTime一致。
观察现象:
在ROS_INFO输出的时间戳中可以观察到两者的差异。首先我们设置rosparam set /use_sim_time true 然后启动如下代码 :
ROS_INFO("%lf,%lf",(double)(ros::WallTime::now().toSec()),
(double)(ros::Time::now().toSec()));

输入:rostopic pub /clock rosgraph_msgs/Clock "clock: secs: 1 nsecs: 0" 再运行上面代码
![ROS_INFO输出时间戳格式为[WallTime,Time ]。ROS::Time为/clock最近一个时间消息内容。](/img/90/25e69495a0a2cfbfe03921bf259656.png)
输入:rosparam delete /use_sim_time 重新运行代码
用处
ROS时间和时间戳stamp对有些rosnode来说至关重要:
比如rviz和tf会将 msg 的header/stamp与rosnode当前时间对比来抛弃无效数据(OLD_DATA)。
ActionClient会自动添加当前时间到stamp中发送给ActionServer,而ActionSerer会对比新的msg与历史msg的stamp来决定是否是合法数据。
在录制rosbag的时候msg/header/stamp时间戳是录制时刻的值。可能导致当前ROS时间 和时间戳不匹配导致:抛出异常,更有甚者直接功能不正常。
我们可以设置use_sim_time再启动节点,改变ROS时间源。并通过对rosbag ... --clock参数让rosbag发布/clock驱动ROS时间
边栏推荐
- Appium environment setup
- Select distinct on statement in kingbasees
- 358. K 距离间隔重排字符串 排序
- Wechat applet learning notes (summer vacation)
- 719. find the distance of the number pair with the smallest K (two points)
- C实战——高配版贪吃蛇游戏设计
- Golang modifying the value of a structure slice
- Compiling principle: the king's way
- Detailed explanation of shell condition judgment
- 关于KingbaseES临时文件过大问题
猜你喜欢

Prompt during packaging: property 'sqlsessionfactory' or 'sqlsessiontemplate'‘

Schnuka: 3D machine vision inspection system 3D vision inspection application industry

Problem solving -- > online OJ (13)

搭建jenkins环境并自动关联打包好的工程jar进行自动发布

1183: patient queue

How to talk about salary correctly in software test interview?

Interviewer: why does database connection consume resources? Where are the resources consumed?

Mmclassification installation and debugging

电检码配置

Reasons why the ext.dic file configured in ES does not take effect
随机推荐
Suggestions on working methods and efficient work
About the problem that the kingbasees temporary file is too large
Schnuka: visual positioning system manufacturer what is a visual positioning system
Listen to textarea input through Keyup to change button style
施努卡:3D视觉识别系统 3D视觉检测原理
KingbaseES 中select distinct on 语句
Markdown skill tree (6): List
KingbaseES应对表年龄增长过快导致事务回卷
Vulnhub's dc7 target
循环嵌套问题:为什么大循环在内,小循环在外可以提高程序的运行效率
1032 Sharing
解题-->在线OJ(十三)
SQL 注入绕过(六)
Kingbasees coping with transaction rollback caused by too fast growth of table age
[industrial control old horse] detailed explanation of the design scheme of the running lamp control system based on Siemens S7-200PLC
Markdown skill tree (7): separator and reference
多态中的向上和向下转型
Selected Siemens PLC project example source code [300 sets in total]
How to talk about salary correctly in software test interview?
498. 对角线遍历(模拟)