Backend registry: single name → constructor dispatch
I maintainer di solito rispondono entro 1 giorno
@petercorke ci sta già lavorando.
Dal 25/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Part of #886. Groundwork for the new backends; each backend issue is blocked by this one.
Problem
Backend selection is spread over several places:
backends.load_backend(): anif/elifover "swift", "pyplot", "pyplot2"BaseRobot._get_graphical_backend(): aLiteralof the same names, anisinstancechain to pick a default, a Pyodide special case, and Swift-specific fallback logicBaseRobot.plot():type(env).__name__ == "Swift"andisinstance(env, PyPlot)checks
Adding a backend means editing all of these. Also, default_backend isn't lowercased, so robot.default_backend = "Swift" fails with ValueError at plot time.
Proposal
- One registry in
roboticstoolbox.backends, mapping name → target, e.g."swift": "roboticstoolbox.backends.swift:Swift". Built-in backends are entries here. load_backend(name)looks the name up (case-insensitive). A string target is imported only when chosen. An unknown name gives an error listing the registered names. A missing optional package givesModuleNotFoundErrornaming the pip extra.register_backend(name, target, *, replace=False), public:targetis a lazy"module:Class"string, or a callable returning aConnector- registering an existing name raises unless
replace=True - registration is per process (call it before
plot()); entry-point discovery may come later - lets a backend be developed, tested and used outside the RTB tree, e.g.
register_backend("isaacsim", "rtb_isaacsim:IsaacSim"); once accepted into RTB, that call becomes a registry entry - backends that can't live in RTB (licence, GPU) can stay as separate packages
- Default choice stays in
_get_graphical_backend, but works only with names: explicit argument → robot/class default → robot kind → "pyplot". Defaults by robot kind pick only built-ins; a registered backend is used when named or set withset_default_backend(). Normalise case at every entry point. - Capability flags replace type checks. Add flags to
Connector, and usegetattr(env, flag, default)inplot():embeds_in_notebookreplaces__name__ == "Swift"supports_moviereplacesisinstance(env, PyPlot)- existing:
supports_teach,supports_ellipse
- Type hints. The
backendargument becomesstr, validated at runtime against the registry, so the names live in one place and registered names are valid too.
Out of scope
- Changing the
Connectorprotocol itself (#676) - Third-party discovery via entry points
Tests
- Lookup: case-insensitivity, unknown-name error, missing-package error
register_backendwith a string target and a callable target, the duplicate-name error, andreplace=True, all using a fake backend- Default resolution for each robot kind and for Pyodide
- Capability flags read with the right defaults
- The mocked Swift tests use
register_backendand no longer need a class namedSwift
Done when
- Adding a backend is one registry entry plus the backend module
- No
__name__or backendisinstancechecks remain inBaseRobot - Existing tests pass, including the Swift ones
- The docs list the registered backends and their flags, and show
register_backendusage
- Lingua principale
- C++
- Stelle
- 3.6k
- Fork
- 645
- Merge medio
- 1g 8h
- PR unite (30g)
- 145
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di petercorke/robotics-toolbox-python
-
plt.pause(0) waits for ever: PoseGraph.plot_scan(pause=0) and Vehicle animation may hangForse già presa @huxiaoyi-ovo l’ha presa 1 giorno fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
petercorke/robotics-toolbox-python#876 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
petercorke/robotics-toolbox-python#709 ·
I maintainer di solito rispondono entro 1 giorno
-
Isaac Sim backendApertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
petercorke/robotics-toolbox-python#903 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
tech-debt
Difficoltà 4/5 1-2 giorni Idoneità per principianti 55/100
petercorke/robotics-toolbox-python#898 ·
I maintainer di solito rispondono entro 1 giorno
-
LatticePlanner: integer headings, and motion primitives with finer turn steps (design first)Forse già presa @kVinsom l’ha presa 3 giorni fa. Apertaenhancement help wanted
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
petercorke/robotics-toolbox-python#895 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di petercorke/robotics-toolbox-python
Issue simili
-
crash lld:COFF
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
llvm/llvm-project#235970 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: iOS textarea wraps text mid-word because LynxUIBaseInput hardcodes NSLineBreakByCharWrappingAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
lynx-family/lynx#10455 ·
I maintainer di solito rispondono entro 1 giorno
-
A-tools P-low S-blocked task
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
cv::checkRange fails with "Unsupported matrix depth" for fp8 depthsForse già presa @sshivensolanki l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Rifle-variant weapon offsets are saved under the pistol's name [FRIK-093]Forse già presa @rollingrock l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
rollingrock/Fallout-4-VR-Body#182 ·