fix: make sas::Clock a real member so it shadows rclcpp::Clock - #14
Merged
Merged
Conversation
added 2 commits
September 23, 2026 04:52
The thin wrapper's shims re-export the core via a using-directive
('using namespace marinholab::sas::core;'), which makes core names
*findable* in namespace sas but does not *declare* them there. A
downstream package that also does 'using namespace rclcpp;' (e.g.
sas_robot_driver) then sees a bare 'Clock' as ambiguous between
marinholab::sas::core::Clock and rclcpp::Clock:
sas_robot_driver_ros.hpp:91:5: error: reference to 'Clock' is ambiguous
This breaks the SmartArmStack PPA deb builder (run
https://github.com/SmartArmStack/smart_arm_stack_ROS2/actions/runs/35760730121,
job 'deb builder multiversion multiarch (ubuntu-24.04-arm, jazzy)').
Declare 'using Clock = marinholab::sas::core::Clock;' so Clock is a
real member of namespace sas, shadowing rclcpp::Clock exactly like the
pre-refactor monolithic package (which had 'class Clock' in namespace
sas). Only Clock collides with rclcpp; the other core types (Object,
RobotDriver, ShutdownSignaler, ThreadManager) and the core free
functions keep working through the using-directive unchanged.
Adds a [4/4] regression step to the docker smoke test: a
downstream-style consumer with 'using namespace rclcpp;' + bare 'Clock'
in namespace sas must compile. Verified locally against the real
MarinhoLab/sas_cpp headers: original shim reproduces the ambiguity,
fixed shim compiles.
The [4/4] smoke-test step used '#include <rclcpp/rclcpp.hpp>' but the raw
g++ was not given the ROS include path, so it failed in CI with
'fatal error: rclcpp/rclcpp.hpp: No such file or directory'.
The bug under test is purely a name-lookup issue, so a minimal rclcpp stub
(class Clock; class Node) is name-lookup-identical to the real rclcpp::Clock
and rclcpp::Node and lets the test run hermetically without ROS include
plumbing. Verified: the consumer compiles with the fixed shim and fails
('reference to Clock is ambiguous') with the pre-fix shim.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Fixes the
Clockname ambiguity that breaks downstream ROS packages when thesas_corethin wrapper is combined with ausing namespace rclcpp;— the second failure in the PPA deb builder after the include-path fix in #13.Problem
The wrapper's shims re-export the core with a using-directive:
A using-directive makes core names findable in
namespace sasbut does not declare them there. When a downstream package also hasusing namespace rclcpp;(e.g.sas_robot_driver) and writes a bareClockinsidenamespace sas, name lookup finds bothmarinholab::sas::core::Clock(via the directive) andrclcpp::Clock(via the global directive) → ambiguous:Breaks the PPA deb builder: https://github.com/SmartArmStack/smart_arm_stack_ROS2/actions/runs/35760730121 (job
deb builder multiversion multiarch (ubuntu-24.04-arm, jazzy)). The error is arch-independent, so amd64 fails the same way.Fix
Make
Clocka real member ofnamespace sasin the shim:A using-declaration (alias) declares the name in
namespace sas, which correctly shadowsrclcpp::Clock— exactly matching the pre-refactor monolithic package, wherenamespace sashad its ownclass Clock.Scope notes:
Clockcollides withrclcpp; the other core types (Object,RobotDriver,ShutdownSignaler,ThreadManager) and the core free functions keep working through the unchanged using-directive.sas_robot_driveris affected in the stack (the only package that doesusing namespace rclcpp;and declares a bareClockinnamespace sas).Verification
MarinhoLab/sas_cppheaders: a downstream-style consumer (using namespace rclcpp;+ bareClockinnamespace sas+clock_.init()) fails with the pre-fix shim (reference to 'Clock' is ambiguous) and compiles with the fix (Clock→marinholab::sas::core::Clock,Node→rclcpp::Node).docker/smoke_test.shcovering exactly this consumer. It uses a minimalrclcppstub (class Clock; class Node): the bug is purely a name-lookup issue, and a stub is name-lookup-identical to the real rclcpp types, keeping the test hermetic and independent of the ROS include layout. CI now logsAmbiguity regression test compiled (no ambiguous Clock)→ALL CHECKS PASSED.While verifying this, I found that the
buildworkflow'srunstep usesdocker compose up, which does not propagate the container's exit code (verified: a container exiting3→compose upreturns0). So a failing smoke test cannot fail CI today. The fix is to usedocker compose run --rm sas_corein.github/workflows/build.yml. I could not include that here (my token lacks theworkflowscope needed to push workflow files). Recommend a small follow-up PR to flip that line so the smoke test actually gates merges.Next step
After merge, re-run the
sas deb builderworkflow insmart_arm_stack_ROS2(it clonessas_coreat-b jazzy); the arm and amd64 jobs should now get pastsas_robot_driver.This pull request was created by an AI agent (OpenHands) on behalf of the repository owner.