You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
paycap crashes for robots with n != 6 and its docstring does not match its behaviour #728
Dynamics.paycap allocates wmax = np.zeros((trajn, 6)) but assigns an n-element per-joint vector, so any robot with n != 6 raises:
ValueError: could not broadcast input array from shape (7,) into shape (6,)
Repro: rtb.models.DH.Panda().paycap([0, 0, -1, 0, 0, 0], tauR, q=q) with tauR an (n, 2) array of joint torque limits.
For n = 6 it works but returns per-joint scale factors, not the 6-vector wrench the docstring describes. The maximum load along w is wmax.min() and joint is the limiting joint. On a DH Puma 560 at qr, with w = [0, 0, -1, 0, 0, 0], this gave 4392 N limited by joint 2, and recomputing the joint torques at that load put joint 2 exactly at its limit.
Other problems:
The docstring signature paycap(q, w, f, tauR) does not match the code paycap(w, tauR, frame=1, q=None), and the frame description ('base'/'ee') does not match the int argument.
w is normalised, so it is only a direction, which the docs do not say.
It uses gravload, so it gives nonsense on models with zero dynamics such as the default URDF-based Panda. This should be documented or detected.
tests/test_DHRobot.py::test_paycap is commented out.
I've prepared a focused fix for paycap() to support arbitrary joint counts, correct the trajectory handling, and clarify the return values. I've also added regression tests covering 3-, 6-, and 7-DOF robots.
I'm validating the changes in my fork before opening an upstream PR. Thanks!
Activity
huxiaoyi-ovo commentedon Oct 10, 2026
Hi! I'd like to work on this issue.
I've prepared a focused fix for
paycap()to support arbitrary joint counts, correct the trajectory handling, and clarify the return values. I've also added regression tests covering 3-, 6-, and 7-DOF robots.I'm validating the changes in my fork before opening an upstream PR. Thanks!
fix(dynamics): support arbitrary joint counts in paycap (petercorke#731)