petercorke / petercorke/robotics-toolbox-python

Link.__deepcopy__ silently drops collision geometry (coal pickling limitation)

Open
#577 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tech-debt
Dominant language
C++
Stars
3.5k
Forks
624
Avg merge
2d 4h
Merged PRs (30d)
53

Description

Migrated from tech-debt.md (deleted, see repo history via git log -- tech-debt.md).

Link.__deepcopy__ silently drops coal CollisionObject instances because the coal library doesn't support pickling. The current workaround warns at runtime when shapes are lost.

Root cause: a fresh DHLink can reach the coal objects of an unrelated URDF robot through shared class-level state in Link or Robot (exact attribute TBD). This means:

  • Copied DH links that happen to run after URDF robot tests lose nothing (DH links have no collision shapes), so the warning path is never exercised in isolation.
  • If the shared reference is ever followed for other purposes (iteration, serialisation) it could cause similar failures or unexpected aliasing.

Proper fix: obtain the full deepcopy traceback with --tb=long when running test_ERobot.py followed by test_Link.py::TestDHLink::test_copy, trace which attribute chain connects the fresh DHLink to a coal object, and remove or weak-ref that shared state.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run test_ERobot.py followed by test_Link.py::TestDHLink::test_copy with --tb=long. Trace the attribute chain from the fresh DHLink to the coal CollisionObject through Link or Robot shared state. Done means the unintended shared reference is removed or weak-referenced and the targeted copy test exercises the warning path without losing unrelated geometry.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
robotics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.