File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ def now(self):
6060
6161class ROSClock (Clock ):
6262
63+ def __new__ (cls ):
64+ return super ().__new__ (Clock , clock_type = ClockType .ROS_TIME )
65+
6366 @property
6467 def ros_time_is_active (self ):
6568 return _rclpy .rclpy_clock_get_ros_time_override_is_enabled (self ._clock_handle )
Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ def test_clock_construction(self):
3838 assert clock .clock_type == ClockType .ROS_TIME
3939 assert isinstance (clock , ROSClock )
4040
41+ # Direct instantiation of a ROSClock is also possible.
42+ clock = ROSClock ()
43+ assert clock .clock_type == ClockType .ROS_TIME
44+
4145 def test_clock_now (self ):
4246 # System time should be roughly equal to time.time()
4347 # There will still be differences between them, with the bound depending on the scheduler.
You can’t perform that action at this time.
0 commit comments