ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Time message definition rationale

asked 2020-07-01 19:35:00 -0600

strike_eagle_iii gravatar image

This might be a little bit of a dumb question, but I'm curious why the Time type is defined as an int32 and uint32.

https://github.com/ros2/rcl_interface...

I've looked:

https://design.ros2.org/articles/cloc... http://wiki.ros.org/roscpp/Overview/Time

but didn't find an answer as to why the msg itself is defined as it is as opposed to a single uint64. Obviously the int32 can be positive or negative (which honestly I don't understand in the context that the Time type is a specific point in time, as opposed to a duration).

The type is the same between ROS and ROS2, so the must be some advantage of why it is defined as it is. what are these advantages? Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-07-01 20:02:25 -0600

sloretz gravatar image

While I'm not sure what the advantage is, I think this is the reason for it in ROS 2.

builtin_interfaces/msg/Time is part of the builtin_interfaces package which contains "message and service definitions for types defined in the OMG IDL Platform Specific Model".

In section 2.3.2 of the OMG DDS 1.4 spec the Duration_T and Time_T types are defined:

The two types used to represent time: Duration_t and Time_t are mapped into structures that contain fields for the second and the nanosecond parts. These types are further constrained to always use a ‘normalized’ representation for the time, that is, the nanosec field must verify 0 <= nanosec < 1000000000

and a little lower down

 struct Time_t {
     long sec;
     unsigned long nanosec;
 };
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-07-01 19:35:00 -0600

Seen: 1,173 times

Last updated: Jul 01 '20