当前位置:网站首页>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时间
边栏推荐
- Detailed explanation of top and free commands
- Appium automation test foundation ADB common commands (II)
- [FreeRTOS] interrupt mechanism
- How to talk about salary correctly in software test interview?
- 498. diagonal traversal (simulation)
- 道闸控制器通讯协议
- JMeter can't find its own jar package imported by BeanShell
- Kingbasees v8r6 cluster maintenance case -- single instance data migration to cluster case
- Blue Bridge Cup - minimum frame
- Check whether tensorflow supports GPU and test program
猜你喜欢

阿里云访问资源:NoSuchKey

C实战——高配版贪吃蛇游戏设计

Vulnhub's dc6 target

KingbaseES V8R6集群维护案例之--单实例数据迁移到集群案例

Matlab Simulink simulation and analysis of power grid sweep frequency

Explanation of swing transformer theory

ShapeShifter: Robust Physical Adversarial Attack on Faster R-CNN Object Detector

手把手系列---安装SpotBugs、并快速上手使用

pycharm的虚拟环境如何共享到jupyter-lab

【域渗透提权】CVE-2020-1472 NetLogon 权限提升漏洞
随机推荐
Listen to textarea input through Keyup to change button style
Roblox剑九之剑二
1031 Hello World for U
KingbaseES应对表年龄增长过快导致事务回卷
打包时提示: Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘
How to solve the cross domain problem of mobile phone accessing the web in the web development scenario
【域渗透提权】CVE-2020-1472 NetLogon 权限提升漏洞
SQL 注入绕过(六)
数组知识点小结
100 lectures on Excel advanced drawing skills (VI) - practical application cases of Gantt chart in project progress
tf. compat. v1.global_ variables
TF. Repeat and stack operations of slim
Unexpected exception ... code: Badrequest when downloading Xilinx 2018.2
excel高级绘图技巧100讲(六)-甘特图在项目进度上的实战应用案例
How to authorize subordinates?
Select distinct on statement in kingbasees
358. K 距离间隔重排字符串 排序
358. K distance interval rearrange string sorting
Detailed explanation of communication principle between [industrial control old horse] single chip microcomputer and Siemens S7-200
VMware vcenter/ESXI系列漏洞总结