Skip to content

fix: guard against uninitialized G1 Arm Action Client#2405

Open
0xbyt4 wants to merge 1 commit intoOpenMind:mainfrom
0xbyt4:fix/arm-g1-client-unbound
Open

fix: guard against uninitialized G1 Arm Action Client#2405
0xbyt4 wants to merge 1 commit intoOpenMind:mainfrom
0xbyt4:fix/arm-g1-client-unbound

Conversation

@0xbyt4
Copy link
Copy Markdown
Contributor

@0xbyt4 0xbyt4 commented Feb 21, 2026

If G1ArmActionClient() constructor fails (e.g. robot not connected, CycloneDDS unavailable), self.client is never assigned because the assignment is inside the try block. The except block logs the error and continues, but any subsequent connect() call crashes with AttributeError.

The original code intended graceful degradation (catch + log), but didn't handle the connect-after-failed-init case. This fix completes that intent by initializing self.client = None before the try block and adding a guard in connect().

Initialize self.client to None before the try block so it is always
defined. Add a None check in connect() to skip actions gracefully
when hardware initialization failed.
@0xbyt4 0xbyt4 requested review from a team as code owners February 21, 2026 11:28
@github-actions github-actions Bot added robotics Robotics code changes python Python code labels Feb 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 21, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/actions/arm_g1/connector/unitree_sdk.py 50.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Python code robotics Robotics code changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant