Skip to content

Comments

fix(agnocastlib): use dedicated executor thread for clock#1054

Open
Koichi98 wants to merge 7 commits intomainfrom
fix/use_dedicated_executor_thread_for_clock
Open

fix(agnocastlib): use dedicated executor thread for clock#1054
Koichi98 wants to merge 7 commits intomainfrom
fix/use_dedicated_executor_thread_for_clock

Conversation

@Koichi98
Copy link
Contributor

@Koichi98 Koichi98 commented Feb 16, 2026

Description

Add use_clock_thread option to NodeTimeSource to process /clock subscription on a dedicated executor thread, aligning with rclcpp's TimeSource implementation.

Changes:

  • Add use_clock_thread parameter (default: true)
  • Create dedicated AgnocastOnlySingleThreadedExecutor and thread for clock callbacks
  • Add proper cleanup in destroy_clock_sub()

Related links

https://github.com/ros2/rclcpp/blob/rolling/rclcpp/src/rclcpp/time_source.cpp

How was this PR tested?

  • Autoware (required)
  • bash scripts/e2e_test_1to1 (required)
  • bash scripts/e2e_test_2to2 (required)
  • kunit tests (required when modifying the kernel module)
  • sample application

Notes for reviewers

Version Update Label (Required)

Please add exactly one of the following labels to this PR:

  • need-major-update: User API breaking changes
  • need-minor-update: Internal API breaking changes (heaphook/kmod/agnocastlib compatibility)
  • need-patch-update: Bug fixes and other changes

Important notes:

  • If you need need-major-update or need-minor-update, please include this in the PR title as well.
    • Example: fix(foo)[needs major version update]: bar or feat(baz)[needs minor version update]: qux
  • After receiving approval from reviewers, add the run-build-test label. The PR can only be merged after the build tests pass.

See CONTRIBUTING.md for detailed versioning rules.

Signed-off-by: Koichi Imai <koichi.imai.2@tier4.jp>
Signed-off-by: Koichi Imai <koichi.imai.2@tier4.jp>
@Koichi98 Koichi98 added need-patch-update Bug fixes and other changes - requires PATCH version update next-release labels Feb 20, 2026
Koichi98 and others added 4 commits February 20, 2026 17:01
Signed-off-by: Koichi Imai <koichi.imai.2@tier4.jp>
Signed-off-by: Koichi Imai <koichi.imai.2@tier4.jp>
Signed-off-by: Koichi Imai <koichi.imai.2@tier4.jp>
@Koichi98 Koichi98 marked this pull request as ready for review February 20, 2026 09:14
Copilot AI review requested due to automatic review settings February 20, 2026 09:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for a dedicated executor thread for handling clock messages in the agnocastlib NodeTimeSource implementation. The change introduces a new optional parameter use_clock_thread (defaulting to true) that creates a separate thread with its own single-threaded executor to process /clock topic messages. This prevents clock callbacks from blocking or being delayed by other node operations.

Changes:

  • Added use_clock_thread parameter to NodeTimeSource constructor to enable/disable dedicated clock thread
  • Created dedicated callback group, executor, and thread for clock subscription when enabled
  • Added proper thread cleanup in destroy_clock_sub() method

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/agnocastlib/include/agnocast/node/node_interfaces/node_time_source.hpp Added member variables for clock executor thread, callback group, and use_clock_thread flag; added use_clock_thread parameter to constructor
src/agnocastlib/src/node/node_interfaces/node_time_source.cpp Implemented dedicated executor thread creation and cleanup logic; added callback group configuration for clock subscription

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Koichi Imai <koichi.imai.2@tier4.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

need-patch-update Bug fixes and other changes - requires PATCH version update next-release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant