Skip to content

Refactor: base clock#1627

Open
nadavelkabets wants to merge 7 commits intoros2:rollingfrom
nadavelkabets:feature/base-clock
Open

Refactor: base clock#1627
nadavelkabets wants to merge 7 commits intoros2:rollingfrom
nadavelkabets:feature/base-clock

Conversation

@nadavelkabets
Copy link
Contributor

Part of #1620

Changes

  • New BaseClock class
  • Clock class retains the blocking sleep_for() and sleep_until() methods
  • Following rclcpp, ROSClock deprecated in favor of Clock(clock_type=ClockType.ROS_TIME)`
  • JumpHandle, TimeSource and ThrottleContext now accept BaseClock
  • TimeSource checks ClockType instead of isinstance()
  • ROSClock is kept as thin deprecated subclass for backwards compatibility

Notes

  • Users with SYSTEM_TIME and STEADY_TIME can now call ros_time_is_active() and set_ros_time_override(). Similar to rclcpp, RCLError is raised if the clock is not a ROS_TIME clock
  • Removed Clock.__new__ - surprising behavior that silently returned a ROSClock instance when Clock was initialized with clock_type=ROS_TIME

Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>
Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>
…Clock

Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>
Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>
Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>
@mjcarroll mjcarroll self-requested a review March 18, 2026 00:18
@mjcarroll
Copy link
Member

@nadavelkabets just a note (from @InvincibleRMC) that resolute (26.04) is going to be using Python 3.14, which does introduce some AsyncIO API changes.

You may want to pre-test what you have here for when we make the jump later this month.

Copy link
Member

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve with a single nit and green CI.

Overall a solid refactor.

@mjcarroll
Copy link
Member

mjcarroll commented Mar 18, 2026

I'll run CI after you address the nits. Should be fine.

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@nadavelkabets
Copy link
Contributor Author

@nadavelkabets just a note (from @InvincibleRMC) that resolute (26.04) is going to be using Python 3.14, which does introduce some AsyncIO API changes.

You may want to pre-test what you have here for when we make the jump later this month.

I checked the 3.13 and 3.14 changelogs - 3.13 adds keyword argument passing to the task constructor and some new util functions, and 3.14 adds task introspection. Neither affects us.
I agree it's valuable to pre-test against 3.14. Will do that for the AsyncNode feature.

nadavelkabets and others added 2 commits March 18, 2026 11:58
Co-authored-by: Michael Carroll <carroll.michael@gmail.com>
Signed-off-by: Nadav Elkabets <32939935+nadavelkabets@users.noreply.github.com>
Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants