rosros 0.2.5
Simple unified interface to ROS1 / ROS2 Python API
Loading...
Searching...
No Matches
rostime.py
Go to the documentation of this file.
1"""
2Stand-ins for `rospy.rostime` in ROS2.
3
4------------------------------------------------------------------------------
5This file is part of rosros - simple unified interface to ROS1 / ROS2.
6Released under the BSD License.
7
8@author Erki Suurjaak
9@created 30.05.2022
10@modified 25.06.2022
11------------------------------------------------------------------------------
12"""
13## @namespace rosros.rospify.rostime
14from .. import ros2
15
16import rclpy.duration
17import rclpy.time
18
19## Stand-in for `rospy.Duration`
20Duration = rclpy.duration.Duration
21
22## Stand-in for `rospy.Time`
23Time = rclpy.time.Time
24
25
26def get_rostime():
27 """Returns current ROS time as `rclpy.Time`."""
28 return ros2.get_rostime()
29
30
32 """Returns the current ROS time as UNIX timestamp float."""
33 return ros2.to_sec(ros2.get_rostime())
34
35
36__all__ = [
37 "Duration", "Time", "get_rostime", "get_time"
38]
get_time()
Returns the current ROS time as UNIX timestamp float.
Definition rostime.py:31