<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki2.lessokaji.com/index.php?action=history&amp;feed=atom&amp;title=CycleGUI</id>
	<title>CycleGUI - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki2.lessokaji.com/index.php?action=history&amp;feed=atom&amp;title=CycleGUI"/>
	<link rel="alternate" type="text/html" href="https://wiki2.lessokaji.com/index.php?title=CycleGUI&amp;action=history"/>
	<updated>2026-05-16T15:59:17Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki2.lessokaji.com/index.php?title=CycleGUI&amp;diff=1014&amp;oldid=prev</id>
		<title>Artheru：​Initial bilingual draft (auto-published)</title>
		<link rel="alternate" type="text/html" href="https://wiki2.lessokaji.com/index.php?title=CycleGUI&amp;diff=1014&amp;oldid=prev"/>
		<updated>2026-05-16T11:42:49Z</updated>

		<summary type="html">&lt;p&gt;Initial bilingual draft (auto-published)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;languages/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 概述 / Overview ==&lt;br /&gt;
CycleGUI 是 MDCS 自研的 ''回合式 GUI 框架''：算法代码可以在任何线程、任何时间 ''cast'' 一个协程到 GUI 主线程；协程仅在 ''需要刷新界面''时被唤醒。这种&amp;quot;按需协程&amp;quot;模型让算法核心可以无负担地嵌入实时调试与可视化代码。&lt;br /&gt;
&lt;br /&gt;
CycleGUI is MDCS's homegrown '''cyclic-coroutine GUI framework'''. Algorithm code on any thread can ''cast'' a coroutine onto the GUI thread; the coroutine wakes only when its visuals need refreshing. The &amp;quot;lazy coroutine&amp;quot; model lets the algorithm core embed live-debug code without performance cost.&lt;br /&gt;
&lt;br /&gt;
== 设计动机 / Why ==&lt;br /&gt;
* 机器人算法（SLAM、规划、运动控制）需要 ''频繁、灵活''地可视化中间状态。&lt;br /&gt;
* 传统 GUI 框架要求把算法搬到 GUI 主线程或用观察者模式回调 —— 都侵入性强。&lt;br /&gt;
* CycleGUI 反转控制：算法在原线程跑，GUI 框架托管协程，只在 GUI 需要重绘时调用协程。&lt;br /&gt;
* 让 ''调试代码''与 ''算法代码''几乎无成本共存。&lt;br /&gt;
&lt;br /&gt;
* Robotics algorithms (SLAM, planning, motion) need to visualise intermediate state often and flexibly.&lt;br /&gt;
* Conventional GUI frameworks force the algorithm onto the UI thread or use observer callbacks — both invasive.&lt;br /&gt;
* CycleGUI inverts control: the algorithm stays on its thread; the GUI framework hosts the coroutine and pulls it only on repaint.&lt;br /&gt;
* Debug code and algorithm code coexist with near-zero cost.&lt;br /&gt;
&lt;br /&gt;
== 使用模型 / Usage model ==&lt;br /&gt;
&lt;br /&gt;
  算法代码 (任意线程)&lt;br /&gt;
       │&lt;br /&gt;
       ▼&lt;br /&gt;
   UI.GetPainter(&amp;quot;topic1&amp;quot;)&lt;br /&gt;
       │&lt;br /&gt;
       ▼&lt;br /&gt;
   painter.DrawDot3D(color, position);  ← 任意时刻调用&lt;br /&gt;
   painter.DrawLine3D(...);&lt;br /&gt;
       │&lt;br /&gt;
       ▼&lt;br /&gt;
  CycleGUI 主线程（按需）&lt;br /&gt;
       │&lt;br /&gt;
       ▼&lt;br /&gt;
   渲染到屏幕&lt;br /&gt;
&lt;br /&gt;
详见 [[Special:MyLanguage/如何使用CycleGUI快速开发UI界面|如何使用CycleGUI快速开发UI界面]] 的具体 API。&lt;br /&gt;
For specific APIs see [[Special:MyLanguage/如何使用CycleGUI快速开发UI界面|the usage guide]].&lt;br /&gt;
&lt;br /&gt;
== 核心抽象 / Core abstractions ==&lt;br /&gt;
* '''Painter''' — 一个命名的绘制目标（topic）；多次 `DrawXxx` 累积到同一画面。&lt;br /&gt;
* '''Layer''' — 多个 Painter 组合成一层；可控可见性。&lt;br /&gt;
* '''Cyclic coroutine''' — 一段被框架托管的 `IEnumerable&amp;lt;Cycle&amp;gt;`，每次 ''帧重绘''被执行一次。&lt;br /&gt;
* '''Two-way binding''' — UI 控件（按钮、滑条、输入框）通过协程的 `yield return WaitForXxx` 与算法同步。&lt;br /&gt;
&lt;br /&gt;
== 在 MDCS 中的应用 / Use within MDCS ==&lt;br /&gt;
* '''Detour''': 可视化 SLAM 中间状态（关键帧、闭环候选、协方差椭圆）。&lt;br /&gt;
* '''Clumsy''': 在 Movement 内部可视化 lidar 帧、检测器输出、目标姿态。&lt;br /&gt;
* '''SimpleComposer''': CAD 工具 + 调度时的车流可视化。&lt;br /&gt;
* '''仿真 / 回放''': 把回放数据投射到同一套 CycleGUI 视图。&lt;br /&gt;
&lt;br /&gt;
== 实现位置 / Where ==&lt;br /&gt;
源码：`D:\src\CycleGUI\`（独立仓库）。MDCS 通过 NuGet 引用。&lt;br /&gt;
Source: `D:\src\CycleGUI\` (standalone repo); MDCS depends via NuGet.&lt;br /&gt;
&lt;br /&gt;
== 关键特性 / Key features ==&lt;br /&gt;
* '''零侵入''': 不强制让算法上 GUI 线程。&lt;br /&gt;
* '''跨进程''': 一个 GUI 可以同时呈现多个进程的画面。&lt;br /&gt;
* '''可录制''': 所有 Painter 调用可序列化 → 离线回放。&lt;br /&gt;
* '''Web 版'''（实验）: 把绘制指令转 WebGL，浏览器查看。&lt;br /&gt;
&lt;br /&gt;
* Zero-intrusion — algorithm doesn't migrate to the UI thread.&lt;br /&gt;
* Cross-process — one GUI can render from multiple processes.&lt;br /&gt;
* Recordable — all Painter calls serialise; replay off-line.&lt;br /&gt;
* Web flavour (experimental) — render commands → WebGL, view in browser.&lt;br /&gt;
&lt;br /&gt;
== 与其它框架的对比 / Comparison ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! 项 / Item !! CycleGUI !! ImGui !! Qt&lt;br /&gt;
|-&lt;br /&gt;
| 协程模型 / Coroutine || 是（按需唤醒）/ Yes (lazy) || 否（每帧重画）|| 否（事件驱动）&lt;br /&gt;
|-&lt;br /&gt;
| 跨进程 / Cross-process || 内建 || 需 RPC || 复杂&lt;br /&gt;
|-&lt;br /&gt;
| GUI 主线程要求 / UI-thread req || 无（cast 自动派发）|| 有 || 有&lt;br /&gt;
|-&lt;br /&gt;
| 学习曲线 / Curve || 中 || 低 || 高&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 相关页面 / See also ==&lt;br /&gt;
* [[Special:MyLanguage/如何使用CycleGUI快速开发UI界面|如何使用CycleGUI快速开发UI界面]]&lt;br /&gt;
* [[Special:MyLanguage/开发手册 - SimpleComposer界面开发 - CAD工具|开发手册 - SimpleComposer界面开发 - CAD工具]]&lt;br /&gt;
* [[Special:MyLanguage/LessokajiWeaver编译后处理工具|LessokajiWeaver编译后处理工具]]&lt;br /&gt;
&lt;br /&gt;
[[Category:二次开发相关说明]]&lt;/div&gt;</summary>
		<author><name>Artheru</name></author>
	</entry>
</feed>