1.ros::Time ros::Duration由roslib提供,二者独立。
2.Time是确切的时某个时间,Duration是一段时间can be negative,可以是负数,
3.二者有相同的表示,
int32 sec
int32 nsec

4.ros可以制造自己的独立模拟时间而不是用平台时间
得到当前时间:

ros::Time begin = ros::Time::now();

Time zero
When using simulated Clock time, now() returns time 0 until first message has been received on /clock, so 0 means essentially that the client does not know clock time yet. A value of 0 should therefore be treated differently, such as looping over now() until non-zero is returned.
只有当收到消息时间才可以得到否则是0。
/clock ??

5.自己制造唯一的。。

ros::Time a_little_after_the_beginning(0.001);
ros::Duration five_seconds(5.0);

or through the two-integer constructor

ros::Time a_little_after_the_beginning(0, 1000000);
ros::Duration five_seconds(5, 0);

6.时间单位转换?

double secs =ros::Time::now().toSec();ros::Duration d(0.5);
secs = d.toSec();

7.加减
Time and Duration Arithmetic
Like other primitive types, you can perform arithmetic operations on Times and Durations. People are often initially confused on what arithmetic with these instances is like, so it’s good to run through some examples:

1 hour + 1 hour = 2 hours (duration + duration = duration)
2 hours - 1 hour = 1 hour (duration - duration = duration)
Today + 1 day = tomorrow (time + duration = time)
Today - tomorrow = -1 day (time - time = duration)
Today + tomorrow = error (time + time is undefined)
Arithmetic with Time and Duration instances is similar to the above examples:

ros::Duration two_hours = ros::Duration(60*60) + ros::Duration(60*60);
ros::Duration one_hour = ros::Duration(2*60*60) - ros::Duration(60*60);
ros::Time tomorrow = ros::Time::now() + ros::Duration(24*60*60);
ros::Duration negative_one_day = ros::Time::now() - tomorrow;

Sleeping and Rates
bool ros::Duration::sleep()

Sleep for the amount of time specified by the duration:

ros::Duration(0.5).sleep(); // sleep for half a second

ros::Rate

roslib provides a ros::Rate convenience class which makes a best effort at maintaining a particular rate for a loop. For example:

ros::Rate r(10); // 10 hz
while (ros::ok())
{... do some work ...r.sleep();
}

In the above example, the Rate instance will attempt to keep the loop at 10hz by accounting for the time used by the work done during the loop.
Note: It is generally recommended to use Timers instead of Rate. See the Timers Tutorial for details.
Wall Time(ros所在系统时间)模拟时间外面
For cases where you want access to the actual wall-clock time even if running inside simulation, roslib provides Wall versions of all its time constructs, i.e. ros::WallTime, ros::WallDuration, and ros::WallRate which have identical interfaces to ros::Time, ros::Duration, and ros::Rate respectively.

ros time相关相关推荐

  1. ros develop 相关

    1.  ros中pcl的数据类型转换 ROS中PCL的数据类型转换 - 楸壳 - 博客园1.ROS中的点云数据类型 sensor_msgs::PointClous // 包含 x.y 和 z 点(所有 ...

  2. ROS 图像相关的命令与应用

    本文翻译自 xx大学的机器人课程,以及个人使用的Ros进行图像处理时的一些问题总结: 1. ROS 中表示图像 1.1 查看图像 ROS中最基本的图像表示方式为sensor_mags/Image 类型 ...

  3. ros的相关link

    http://markzhang.cn/blog/2014/08/19/ros-basic-setup/ http://blog.csdn.net/boliang319/article/details ...

  4. ROS(1和2)机器人操作系统相关书籍、资料和学习路径

    ROS机器人相关书籍与资料(更新日期2017年11月) ROS发展10年了,已经逐渐成为通用的机器人操作系统标准.ROS 2相关资料链接:http://blog.csdn.net/zhangrelay ...

  5. ROS系统 常用命令行工具的使用

    启动ROS Master roscore 启动小海龟仿真器 rosrun turtlesim turtlesim_node 启动海龟控制节点 rosrun turtlesim turtle_teleo ...

  6. 深入理解ROS技术 【3】ROS下的模块详解(129-180)

    129 rosgraph rosgraph 包含 rosgraph 命令行工具,可打印有关 ROS 计算图的信息.它还提供了一个可供图形工具使用的内部库. 130 rosgraph_msgs 与 RO ...

  7. 深入理解ROS技术 【2】ROS下的模块详解(66-128)

    概述: 本篇以字典方式,列出所有的Ros下模块,给出初步解释.并针对其重要程度,用星级标出重要性.这些概念解释中,还列出其它文章的链接. 模块表述: 65 interactive_marker_tut ...

  8. ROS探索总结(七)(八)(九)——smartcar源码上传 键盘控制 操作杆控制

    ROS探索总结(七)--smartcar源码上传 看到前面写的博客还是帮助了很多ROS的学习者,我感到非常荣幸.其实我也是一名ROS的新手,ROS的相关资料少,上手难度大,我现在也在摸索着学习,还希望 ...

  9. 安装ROS环境时的常见问题及解决办法

    安装ROS环境 a. 换源 # 备份原来的sources.list sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup # 修改sou ...

最新文章

  1. OmniNet:基于环视鱼眼镜头的多任务视觉感知系统
  2. 越南估值最高的电商公司之一:Tiki获1亿美元融资!
  3. 开关电源PCB排版基本要点概述
  4. tomcat之一:指定tomcat运行时JDK版本
  5. 【网络安全工程师面试题】数据库存在的漏洞及渗透方法
  6. Android中long类型对应Java/Jni/C++中的类型
  7. Default Folder X几个小技巧分享
  8. :将照片处理成绘画风格
  9. 灵派编码器HTTP API接口说明
  10. Silverlight 2.5D RPG游戏技巧与特效处理:(二)纸娃娃系统
  11. Mac OS 上MPV播放器常用快捷键
  12. Android如何修改手机文件名称
  13. 最新|解决Mac安装软件的“已损坏,无法打开。 您应该将它移到废纸篓”问题
  14. [ERROR Port-10250]: Port 10250 is in use
  15. Axure RP 8.0原型设计(一):入门
  16. VMware Workstation虚拟机设置联网(Linux)
  17. 互联网2B、2C的区别ToB时代的应对策略
  18. 盐湖卤水吸附提锂工艺
  19. Ansys(Maxwell、Simplorer)与Simulink联合仿真入门
  20. 微众银行:分布式架构之高可用

热门文章

  1. 企业微信社群运营案例拆解:全棉时代
  2. QQ在线多功能签到加速源码
  3. 如何在iPhone或iPad上查找您的位置记录
  4. 向善的力量:顺丰,如何在不确定性中寻求确定性
  5. 电子书制作以及获取方式介绍
  6. 询问:虚拟机中能不能安装NVIDIA显卡驱动
  7. JS控制 textarea多行文本框HTML标签根据内容自适应高度
  8. [ 笔记 ] 计算机网络安全_2_internet协议的安全性
  9. C++、VC++、MFC网页自动注册、登陆、发帖、留言,QQ注册、QQ申请器源码、注册邮箱源码、自动发帖源码
  10. php 伪原创,php实现SEO伪原创同义词替换函数