Repository navigation
fix(robot): improve jacob0_dot docstring, typing overloads, and representation error handling - #737
Conversation
…sentation error handling Fixes petercorke#734 - Correct method name reference from robot.jacob_dot to robot.jacob0_dot - Fix 'to to' typo in docstring - Clarify time derivative of manipulator Jacobian in frame {0} - Document q=None behavior and add type/shape annotations for q, qd, J0, and rtype - Convert See Also section to Sphinx .. seealso:: directive - Align continuation indent in References rubric to avoid blockquote rendering - Add runnable pycon example in docstring - Note that representation uses numerical Hessian via spatialmath numhess - Update typing overloads to restrict representation=None when q=None - Raise clear ValueError when representation is passed with q=None - Remove commented-out dead exploratory code - Add tests for precomputed J0 with q=None, all representations, and ValueError check
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 13 |
| Duplication | 2 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #737 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 143 143
Lines 14592 14594 +2
=====================================
- Misses 14592 14594 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| q: None, | ||
| qd: ArrayLike, | ||
| J0: NDArray = ..., | ||
| representation: L["rpy/xyz", "rpy/zyx", "eul", "exp"] | None = None, |
There was a problem hiding this comment.
why is this literal type removed?
| Time derivative of manipulator Jacobian in frame {0} | ||
|
|
||
| :param q: The joint configuration of the robot | ||
| :param q: The joint configuration of the robot (must be provided if |
There was a problem hiding this comment.
probably write this in terms of parameters being provided or omitted rather than being None.
param q: The joint configuration of the robot. Must be provided if
representation is specified; may be omitted if J0 is
provided and representation is not.
:type q: ArrayLike(n), optional
It might even be worth having a table that explains the relationship between representation, q and J0.
| >>> robot = rtb.models.DH.Puma560() | ||
| >>> q = robot.qn | ||
| >>> qd = [0.1, -0.2, 0.3, -0.1, 0.2, -0.3] | ||
| >>> j0_dot = robot.jacob0_dot(q, qd) |
There was a problem hiding this comment.
thanks for adding the runblock example, maybe do one for the J0 pass in as well.
|
Thanks for your interest in RTB and helping to fix this method and adding more documentation and testing. I have some comments on your PR. I'm not sure this completely closes out #734, and the rework I envisaged would aim for tougher testing. The new tests, based on the old one, essentially just compare the results to a handwritten version of what's in the method. It would be more convincing to compare to a handworked (or sympy derived) Jacobian and Hessian for say a simple RR robot. |
|
Hi @petercorke, thank you very much for the thoughtful and detailed review! I have updated the PR with commit 6add4c9 addressing all of your feedback:
All 767 existing tests continue to pass alongside the new ground-truth tests. Ready for your review! |
Fixes #734
Description
This PR improves the documentation, typing, and validation of
Robot.jacob0_dot.Documentation
seealsodirective and correct referenceformatting.
Hessian numerically and is approximate and slower than the
geometric Jacobian derivative path.
Typing and validation
q=Noneoverload torepresentation=None.ValueErrorwhenrepresentationis specifiedwithout providing
q.Tests
J0path withq=None.rpy/xyz,rpy/zyx,eul, andexp.q=Noneandrepresentationis set.Testing
Full repository test suite:
Focused tests:
tests/test_jacob.py: 14 passedtests/test_DHRobot.py: 79 passedtests/test_ETS.py: 54 passedFormatting and whitespace checks passed:
ruff format --check tests/test_jacob.pygit diff --check