ETS/ETS2: one joint-index resolver; the all-or-none, unique guarantee breaks under concatenation and insert
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 10/100
Línea de trabajo
Start with the duplicated joint-index logic in ETS.__init__, ETS2.__init__ and ETS2.jacob, then BaseRobot.__init__ and Gripper.__init__. Reproduce the concatenation case from the issue (ETS([ET.Rz()]) * ETS([ET.Rx()]) giving duplicate jindex values) and check the insert path. Done means one shared resolver that enforces all-or-none, unique and contiguous indices, with the proposed regression tests passing. The design choices (lazy versus eager resolution, read-only ET.jindex) need maintainer agreement first.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
The rule "an ETS has either all or none of its joint indices set, and they are unique and contiguous" is implemented four times and enforced in only one place, the constructor. Incremental construction and later mutation can break it.
Found while reviewing #792, which fixed one symptom (np.all([...jindex]) treats index 0 as missing, so a permuted or sparse mapping was silently overwritten with 0..n-1).
Where the logic lives today
| Place | What it does |
|---|---|
ETS.__init__ |
counts joints with a jindex; all-but-last sequential auto-fills the last, mixture raises ValueError, none assigns 0..n-1 |
ETS2.__init__ |
the same ~25 lines, copy-pasted |
ETS2.jacob |
re-checks "all set?" and renumbers (the check #792 fixes) |
BaseRobot.__init__ |
re-derives none/all across the links, via _auto_jindex, then assigns in DFS order |
Gripper.__init__ |
the same again with a slightly different filter |
The guarantee does not hold under incremental construction
On main:
a, b = ET.Rz(), ET.Rx()
e = ETS([a]) * ETS([b]) # each piece was auto-assigned jindex 0
[j.jindex for j in e.joints()] # -> [0, 0], n = 2: all set, but not unique
- Concatenating two auto-indexed ETS gives duplicate indices with no error, because the constructor only checks "all or none", not unique and contiguous.
ETS.insertappends to_datawith no re-check at all and does not reset_auto_jindex.ET.jindexhas a public setter, so indices can be changed after construction, outside the owning ETS (Link.jindex,BaseRobot,Gripper,DHRobotandETS2.jacoball do).
Proposal
- One helper (a function, or a method on the common base
BaseETS) that takes the joints and does the whole job: all-or-none check, uniqueness and contiguity, auto-fill, and returns whether the indices were auto-assigned.ETSandETS2constructors call it. - Re-run it from every mutator (
insert,append,__setitem__,__imul__) or resolve it lazily on first use, sincejindicesis already a cached property. - Make
ET.jindexread-only once the ET belongs to an ETS (the ET is already deep-copied into the ETS, so ownership is clear). Mutation then goes through one sanctioned ETS method that keeps the_auto_jindexflag and the cachedjindicesconsistent.Link.jindex,BaseRobot,GripperandDHRobotuse that method. BaseRobotandGrippershare a small classifier (none/all/mixed) instead of each re-writingall([... is None ...]), and their DFS assignment becomes one base-class method.- The unreachable renumbering block in
ETS2.jacobis deleted.
Regression tests: concatenation of two auto-indexed ETS, insert of a joint, permuted explicit indices surviving jacob, and a mixture still raising.
Fits the ets group of the typing pass (problems 61 to 65).
Related
- #792 (the symptom fix, independent of this)
- Lenguaje dominante
- C++
- Estrellas
- 3.6k
- Forks
- 645
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 137
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de petercorke/robotics-toolbox-python
-
plt.pause(0) waits for ever: PoseGraph.plot_scan(pause=0) and Vehicle animation may hangPosiblemente ocupada @huxiaoyi-ovo la tomó hace 1 día. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
petercorke/robotics-toolbox-python#876 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
petercorke/robotics-toolbox-python#709 ·
Los mantenedores suelen responder en 1 día
-
enhancement help wanted
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
petercorke/robotics-toolbox-python#886 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
petercorke/robotics-toolbox-python#884 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: Cubic curvature constraint misses interior extrema between ODE samplesPosiblemente ocupada @Afloat16 la tomó hace 1 día. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
petercorke/robotics-toolbox-python#878 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de petercorke/robotics-toolbox-python
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
foxglove/mcap#1907 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
Documentation
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
qbittorrent/qBittorrent#25127 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
telegramdesktop/tdesktop#31505 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día