Repository navigation
fix: report the enabled bit in the fake firmware's status frames - #8
Merged
Merged
Conversation
The test double answered CMD_ENABLE by setting its internal flag, but every status frame it built carried flags = 0, so RobotState::enabled() was always false offline. A component that waits for that bit before its first command frame cannot be tested against a double that never sets it -- the wait looks like a firmware bug, and the real behaviour it guards (the firmware is not energized yet while it writes CMODE for every axis) stays invisible until hardware is attached. status_flags(enabled) now feeds all eight make_status() call sites, so bit9 matches the firmware like the other fields already did.
|
🎉 This PR is included in version 0.1.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
The fake firmware answered
CMD_ENABLEby setting its internal flag, but every status frame it built carriedflags = 0, soRobotState::enabled()was always false offline. A component that waits for that bit before its first command frame cannot be tested against a double that never sets it: the wait looks like a firmware bug, and the real behaviour it guards (the firmware is not energized yet while it writes CMODE for every axis) stays invisible until hardware is attached.Changes
src/testing.cpp:status_flags(bool)returns1 << FLAG_ENABLED_BITwhen the fake is enabled and 0 otherwise, and all eightmake_status()call sites use it. The frames the fake builds now match the firmware's layout for bit9 as well as for the fields they already matched.Testing
The suite includes the golden parity harness, which compares the frames this SDK produces against the real Python SDK byte for byte, so the change is checked against the reference implementation rather than against itself.
Issues
No issue is linked. Found while bringing the direct-USB
ros2_controlcomponent up on hardware: the missing bit is why its "wait until the arm reports itself enabled" step could not be reproduced offline.