payload(): Robot-vs-Link ownership doesn't survive copy(), and has no answer for multiple end-effectors
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- robotics, testing-qa
Hướng nghiên cứu
Start by reading Robot.payload(), Link.deepcopy(), Robot.deepcopy(), and Robot.rne(). The work is done when payload state survives Robot.copy(), payload() requires an explicit end for multiple end-effectors, and a regression test covers force summation for a genuinely branched robot; review the existing branched-robot tests for conventions.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Background
PR #699 (fixing #638: payload(0) wasn't a no-op) landed a real fix, but review surfaced three related design questions it deliberately left out of scope. Grouped here since they're all facets of the same underlying question: what does payload() actually own, and does that model hold up once robots stop being simple serial chains?
Confirmed: payload doesn't survive copy()
Robot.payload() now remembers a link's pre-payload m/r/I in a private link._payload_own attribute so payload(0) can restore it. That attribute is Robot-level bookkeeping, but it's stored on the Link object -- and Link.__deepcopy__ (correctly, from Link's own point of view) only reconstructs the named dynamic parameters it knows about, so _payload_own never survives a copy. Reproduced directly:
p560 = rp.models.DH.Puma560()
p560.payload(2.5, [0.02, -0.03, 0.1])
p560_copy = p560.copy()
p560_copy.payload(0) # supposed to remove the payload -- silently does nothing
p560_copy.rne(...) after payload(0) is bit-for-bit identical to with the payload, not the bare-link baseline. No exception, no warning -- the copy's payload is permanently baked into what it now believes is the link's own mass. PR #699 documents this as a known limitation in its docstring, but "known" isn't "fixed," and the failure mode is silent wrong dynamics, not an error.
This is the same root pattern as #577 (Link.__deepcopy__ silently drops coal collision geometry): Link.__deepcopy__ only carries a fixed set of named parameters, so anything stored as an ad-hoc attribute on Link -- regardless of which class conceptually owns it -- disappears across a copy with no signal to the caller.
Proper fix: move the "a payload is attached, here's what to subtract" bookkeeping onto Robot/BaseRobot itself (e.g. self._payload: tuple[Link, float, NDArray, NDArray] | None), the same way Robot.__deepcopy__/DHRobot.__deepcopy__ already explicitly re-attach other instance-level state beyond the constructor kwargs (configs, ikine_a). That keeps Link as a dumb parameter container and fixes the copy bug at the source, rather than teaching Link.__deepcopy__ about a Robot-level concept smuggled onto it.
payload() has no answer for multiple end-effectors
For a robot with len(ee_links) > 1, #699 falls back to the pre-existing behaviour of using links[n - 1] -- whichever link happens to land last in the flattened links list. For a genuine tree that's arbitrary: it has no necessary physical relationship to either branch, and is fragile to construction/traversal order.
The idiomatic fix is the end= parameter pattern already used throughout the kinematics API (fkine, jacob0, etc., via self._getlink(end, default)): give payload() an end= parameter, defaulting to ee_links[0] only when there's exactly one, and require it explicitly (raise, don't guess) when there's more than one.
Robot.rne()'s branching support has no test coverage
While investigating the above, confirmed empirically that Robot.rne() does correctly handle a genuine kinematic tree (multiple independent moving-joint chains sharing a parent, not just static leaf links) -- built a synthetic two-armed robot and verified gravity-torque superposition holds and there's no cross-branch leakage. The group_of_link_idx/backward-force-summation code in Robot.rne() clearly was written deliberately (extensive comments referencing #636/#483/#571), but there is currently no test in the repo that exercises it -- the existing "branched robot" tests (test_dotfile2, test_graph_multiple_end_effectors, YuMi's fkine/jacob0 tests) only touch kinematics/graph rendering, and #699's own test_payload_several_end_effectors has two static tip links off one joint (branching in link topology, not in DOF), so it never reaches the force-summation-at-shared-parent path.
Worth a regression test using something like the synthetic two-armed robot above (or YuMi directly), independent of the payload/end= work.
Scope
Not blocking #699, which fixes a real, independently-valuable bug (#638) on its own. Related: #577 (same Link.__deepcopy__ root cause, different attribute), #571 (general Robot/Link architecture direction -- this is a concrete instance of "what state does Link vs Robot own").
- Ngôn ngữ chính
- C++
- Star
- 3.5k
- Fork
- 630
- Merge trung bình
- 2 ngày 9 phút
- Pull request đã merge (30 ngày)
- 27
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của petercorke/robotics-toolbox-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
petercorke/robotics-toolbox-python#709 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Adapt to pgraph-python 1.0: plot() option names and the single Vertex classCó thể đã có người làm @tandede đã nhận 1 ngày trước. Đang mởdependencies tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
petercorke/robotics-toolbox-python#738 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
jacob0_dot: docstring errors, and analytic-representation path is a numerical HessianCó thể đã có người làm @paneendrakumar0 đã nhận 2 ngày trước. Đang mởtech-debt
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
petercorke/robotics-toolbox-python#734 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
coriolis() and Robot.copy().rne() fail for URDF/ETS robots: copied links keep their original parentCó thể đã có người làm @huxiaoyi-ovo đã nhận 3 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
petercorke/robotics-toolbox-python#730 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Interbotix URDF models (wx200 etc.): gripper counted as arm joints, ambiguous end-effector, qr outside joint limitsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
petercorke/robotics-toolbox-python#729 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của petercorke/robotics-toolbox-python
Issue tương tự
-
bug format I/O medium priority rt_lib
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
raspberrypi/rpi-imager#1775 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
compiler-explorer/compiler-explorer#9272 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
【问题】在文件树重命名文件,发现无法用鼠标选中一段文字Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100