Skip to content

Refactor: move Node initialization to BaseNode#5

Closed
nadavelkabets wants to merge 2 commits into
refactor/base-nodefrom
refactor/base-node-init
Closed

Refactor: move Node initialization to BaseNode#5
nadavelkabets wants to merge 2 commits into
refactor/base-nodefrom
refactor/base-node-init

Conversation

@nadavelkabets
Copy link
Copy Markdown
Owner

Part of ros2#1620

Changes

  • Moved BaseNode initialization logic from Node.__init__ into BaseNode.__init__
  • Added abstract methods on BaseNode (create_publisher, create_subscription, create_service, _create_service) so BaseNode can construct the parameter event publisher, parameter services and type description service
  • Extracted handle creation methods into BaseNode (_create_publisher_handle, _create_subscription_handle, _create_service_handle, _create_client_handle)
  • TimeSource, ParameterService, LoggingService, TypeDescriptionService retyped to accept BaseNode instead of Node
  • TimeSource._clock_sub cleans itself up via self._clock_sub.destroy() instead of node.destroy_subscription(...) to decouple from Node's entity lists
  • TypeDescriptionService._start_service now calls node._create_service(...) instead of directly constructing a Service
  • TimeSource.attach_clock is called with self.get_clock() in BaseNode.__init__ instead of self._clock
  • Node.destroy_node() no longer calls self._type_description_service.destroy() explicitly and is destroyed by the entity teardown loop in Node.destroy_node() instead

@nadavelkabets nadavelkabets force-pushed the refactor/base-node-init branch 2 times, most recently from 93198c3 to 84be7f4 Compare April 12, 2026 18:29
nadavelkabets and others added 2 commits April 19, 2026 06:13
* Feature: BaseClock

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

* Fix: JumpHandle accept BaseClock, generic __repr__

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

* Fix: Use BaseClock type in TimeSource, no __init__ parameters for ROSClock

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

* Feature: add tests

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

* Feature: test ros time functions when clock type is not ros time

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

* Fix: called a property method

Co-authored-by: Michael Carroll <carroll.michael@gmail.com>
Signed-off-by: Nadav Elkabets <32939935+nadavelkabets@users.noreply.github.com>

* Refactor: initial extraction of BaseNode

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

* Move track_node to Node.__init__()

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

* Cr: add destroy_node method to BaseNode

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

---------

Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>
Signed-off-by: Nadav Elkabets <32939935+nadavelkabets@users.noreply.github.com>
Co-authored-by: Michael Carroll <carroll.michael@gmail.com>
…ice to BaseNode

Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>
@nadavelkabets nadavelkabets force-pushed the refactor/base-node-init branch from d2728d7 to 98d1e5b Compare April 19, 2026 11:41
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.

1 participant