Backend registry: single name → constructor dispatch
Maintainer thường phản hồi trong vòng 1 ngày
@petercorke đang làm issue này rồi.
Từ ngày 25/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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
- Ngôn ngữ chính
- C++
- Star
- 3.6k
- Fork
- 645
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 145
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
-
plt.pause(0) waits for ever: PoseGraph.plot_scan(pause=0) and Vehicle animation may hangCó thể đã có người làm @huxiaoyi-ovo đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
petercorke/robotics-toolbox-python#876 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ 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 1 ngày
-
Isaac Sim backendĐang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
petercorke/robotics-toolbox-python#903 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
tech-debt
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 55/100
petercorke/robotics-toolbox-python#898 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
LatticePlanner: integer headings, and motion primitives with finer turn steps (design first)Có thể đã có người làm @kVinsom đã nhận 3 ngày trước. Đang mởenhancement help wanted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
petercorke/robotics-toolbox-python#895 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của petercorke/robotics-toolbox-python
Issue tương tự
-
[Bug] [Go] Ack returns nil when the server answers with a non-OK statusCó thể đã có người làm @leizhiyuan đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
apache/rocketmq-clients#1465 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
KhronosGroup/Vulkan-Tutorial#534 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug IO
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
MrNeRF/LichtFeld-Studio#3824 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pnnx: manual tanh GELU fusion loses the approximation modeCó thể đã có người làm @ktz03 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Tencent/ncnn#7175 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày