-
Notifications
You must be signed in to change notification settings - Fork 28
Add full naming convention aliases for robot limbs #641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2dee893
Add full naming convention aliases for robot limbs
iory 2690db0
Add test for limb naming convention aliases
iory 8e9a8f6
Update examples to use new limb naming convention
iory d961af4
Update examples to use new naming convention (right_arm, left_arm)
iory 859dbe7
Address review: use @property wrappers instead of direct assignment
iory File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1866,6 +1866,83 @@ def init_pose(self): | |
| self.joint_max_angles) | ||
| return self.angle_vector(target_angles) | ||
|
|
||
| # New naming convention properties with more intuitive full names. | ||
| # These provide access using full names (right_arm, left_arm, etc.) | ||
| # while keeping the abbreviated names (rarm, larm, etc.) available for | ||
| # backward compatibility. | ||
|
|
||
| def _get_limb(self, attr_name): | ||
| """Get limb by attribute name, returning None if not available.""" | ||
| try: | ||
| limb = getattr(self, attr_name, None) | ||
| if isinstance(limb, RobotModel): | ||
| return limb | ||
| except NotImplementedError: | ||
| # Some robot models raise NotImplementedError for unsupported limbs | ||
| pass | ||
| return None | ||
|
|
||
| def _get_end_coords(self, attr_name): | ||
| """Get end coords by attribute name, returning None if not available.""" | ||
| try: | ||
| coords = getattr(self, attr_name, None) | ||
| if isinstance(coords, CascadedCoords): | ||
| return coords | ||
| except NotImplementedError: | ||
|
||
| # Some robot models raise NotImplementedError for unsupported coords | ||
| pass | ||
| return None | ||
|
|
||
| @property | ||
| def right_arm(self): | ||
| """Right arm kinematic chain (alias for rarm).""" | ||
| return self._get_limb('rarm') | ||
|
|
||
| @property | ||
| def left_arm(self): | ||
| """Left arm kinematic chain (alias for larm).""" | ||
| return self._get_limb('larm') | ||
|
|
||
| @property | ||
| def right_leg(self): | ||
| """Right leg kinematic chain (alias for rleg).""" | ||
| return self._get_limb('rleg') | ||
|
|
||
| @property | ||
| def left_leg(self): | ||
| """Left leg kinematic chain (alias for lleg).""" | ||
| return self._get_limb('lleg') | ||
|
|
||
| @property | ||
| def right_arm_end_coords(self): | ||
| """Right arm end effector coordinates (alias for rarm_end_coords).""" | ||
| return self._get_end_coords('rarm_end_coords') | ||
|
|
||
| @property | ||
| def left_arm_end_coords(self): | ||
| """Left arm end effector coordinates (alias for larm_end_coords).""" | ||
| return self._get_end_coords('larm_end_coords') | ||
|
|
||
| @property | ||
| def right_leg_end_coords(self): | ||
| """Right leg end effector coordinates (alias for rleg_end_coords).""" | ||
| return self._get_end_coords('rleg_end_coords') | ||
|
|
||
| @property | ||
| def left_leg_end_coords(self): | ||
| """Left leg end effector coordinates (alias for lleg_end_coords).""" | ||
| return self._get_end_coords('lleg_end_coords') | ||
|
|
||
| @property | ||
| def arm(self): | ||
| """Arm kinematic chain for single-arm robots (alias for rarm).""" | ||
| return self._get_limb('rarm') | ||
|
|
||
| @property | ||
| def arm_end_coords(self): | ||
| """Arm end effector coordinates for single-arm robots.""" | ||
| return self._get_end_coords('rarm_end_coords') | ||
|
|
||
| def _meshes_from_urdf_visuals(self, visuals): | ||
| meshes = [] | ||
| for visual in visuals: | ||
|
|
||
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.