ykcheungab
73b1fa7fa4
docs: correct the _perf path references after the bench moved
...
The `_perf/` measurement bench was gitignored and had never been committed, so
23 of the 27 scripts cited by the perf documents were already lost. The 11
surviving files (4 scripts, cfg_dm1.json, 5 result JSONs, the 53 MB MJPG clip)
have been moved to D:\orisys_ws\docs\performance\perf-measurements\ and the
scripts patched to resolve their defaults next to themselves. The directory has
been removed from this repo.
These three files said the scripts were deleted, which was only half true:
they are moved, and the four surviving ones still run. Repointed:
- src/orisys/sensor.py: the FILTER_PRESETS comment now names the real location
(comment only; FILTER_PRESETS itself is unchanged).
- docs/filters.md and examples/filters/README.md: the same correction for the
latency/noise measurement provenance.
No behaviour change.
2026-09-27 21:49:26 +08:00
ykcheungab
d5b938738e
docs: point perf references at the workspace docs tree; ignore .scratch/
...
orisys-sdk-perf-plan.md moved to D:\orisys_ws\docs\performance\ as part of the
2026-09-27 workspace cleanup. docs/filters.md and examples/filters/README.md now
name the new location; the _perf/ measurement scripts they also cited are deleted
(the document keeps every measured number).
Also ignore .scratch/, the new per-task scratch directory (see
D:\orisys_ws\AGENTS.md).
2026-09-27 21:14:20 +08:00
ykcheungab
e2ac36269c
added ruff code reivew
2026-09-27 19:21:55 +08:00
ykcheungab
07da372204
add drift script
2026-09-25 15:28:01 +08:00
ykcheungab
0e903792bd
fix test sample s1.mp4 missing
2026-09-20 11:46:03 +08:00
ykcheungab
153f51df11
change sample s1_480.mp4 to s1.mp4
2026-09-20 11:39:02 +08:00
ykcheungab
2e7b65298b
fixed test_signal_processing error
2026-09-20 11:36:30 +08:00
ykcheungab
e2b906a640
fix preflight config path check
2026-09-20 11:20:47 +08:00
ykcheungab
45419a59c4
fix preflight version check
2026-09-20 11:13:21 +08:00
ykcheungab
05b2354d0d
update to 0.5.3
2026-09-20 11:01:33 +08:00
ykcheungab
1cf78c9d71
fixed calibration data not loading due to path
2026-09-20 11:00:33 +08:00
ykcheungab
14fbfec62e
remove hand.py, replaced by pipeline.py
2026-09-14 13:55:30 +08:00
ykcheungab
11962cdc34
配置没写的滤波键等于"关",不再回落到会滤波的默认值 - What: DEFAULT_FORCE_MEDIAN_WINDOW 3 -> 1、DEFAULT_FLOW_EMA_ALPHA 0.5 -> 1.0(DEFAULT_FORCE_LOWPASS_HZ 本就是 0.0),并把注释改成"配置文件没写的键就是关,而不是我们觉得合理的那一档"——原因写在注释里:否则设备会去滤一个没人要求滤的测量,而文件里没有任何线索;实测的延迟/降噪数据保留在注释中,作为 balanced/low_noise 预设的依据。docs/filters.md 第 2 节增加"缺省 = 关"这一条并说明没有 filters 段的配置什么都不滤,预设表里 balanced 的用途由"默认建议"改为"建议起步档"(它不再是默认值)。examples/filters/README.md 补一句"整段删掉等价于 off"。tests/test_filter_presets.py 新增 test_a_config_with_no_filters_block_filters_nothing:把 box bundle 的 filters 段整段删掉后构造真实 Sensor,断言 filters_state() 报 ema 1.0 / median 1 / cutoff 0.0 且 any_stage_applied 为 False。 - Why: 上一版只把"非法值"改成回落到关,但"键根本不写"仍会走 DEFAULT_* 从而把 EMA 0.5 + 中值 3 打开——这与"配置自描述、文件说什么就跑什么、出厂默认全关"矛盾,且现实里存在大量没有 filters 段的手写配置(例如 _perf/cfg_res_280x300.json),它们会在无人察觉的情况下继续滤波。缺省开是这条链上最后一个隐藏默认值。 - Verification: 删掉 filters 段后实测 filters_state() = (1.0, 1, 0.0) 且 any_stage_applied=False,出厂 box/mini/finger 三份同样为全关;pytest tests/test_filter_presets.py + tests/test_calibration.py → 33 passed;SDK 全量 336 passed / 15 skipped(唯一失败仍是需要 1200 帧而样例只有 577 帧的 longrun 测试);app 侧 studio 85 项与 shared 142 项测试、ui_check 554 项检查在升级后的 0.5.2 下全绿。 - Not in this change: 出厂 bundle 的三个显式值未动(本来就全关);_perf 的两个校验脚本不在仓库内,已就地补上显式 filters 段(balanced)以保持"开 vs 关"对照仍有意义;app 侧 wrapper/齿轮/CSV 17 列未动。
2026-09-14 10:53:33 +08:00
ykcheungab
ae5bf0c208
断开连接不再因无头 OpenCV 抛错 - What: Sensor.disconnect() 里的 cv2.destroyAllWindows() 包上 try/except cv2.error:无头构建(opencv-python-headless)没有 highgui,destroyAllWindows 会抛 "The function is not implemented",此前会让 finally 里 disconnect() 的调用方(测试、采集退出路径)拿到一个与传感器无关的异常。 - Why: 跑 SDK 测试时发现 tests/test_calibration.py::test_sensor_cal_path_v2_applies_to_read_info 与 test_set_calibration_swaps_curve 在本机(cv2 4.14.0 headless)稳定失败,断言本身都过了,报错在 finally 的 disconnect() 第 1098 行;这不是滤波改动引入的,但会一直污染每次验证,且 SDK 明确支持无头/CI 使用(backend="cpu"、external-frame 模式)。 - Verification: 修前该模块 7 failed / 13 passed(含上述两个既有测试),修后 20 passed;SDK 全量 335 passed / 15 skipped(唯一失败为需要 1200 帧而 data/sample/s1_480p.mp4 只有 577 帧的 longrun 测试)。 - Not in this change: 未改 disconnect() 的其他分支;未引入 highgui 依赖探测,只在真正调用失败时忽略。
2026-09-14 10:44:13 +08:00
ykcheungab
7f8e5d0975
四个滤波预设落成机器可读的配置文件,并加上防漂移测试 - What: 新增 examples/filters/filters_{off,low_latency,balanced,low_noise}.json —— 每个都是完整可整块替换的 filters 段(五键齐全:flow_ema_alpha / force_median_window / force_lowpass_cutoff_hz / force_lowpass_order / force_lowpass_sample_rate_hz),数值即 FILTER_PRESETS 展开后的结果;examples/filters/README.md 说明这四份副本的存在与用途;新增 tests/test_filter_presets.py(12 项):预设名恰为四个、每个示例文件 == 默认块叠加该预设(改预设或改文件都会红)、每份都是含三个开关键的真实 filters 段、三个出厂 bundle(box/mini/finger)的 filters 段仍为全关、且用 external-frame 模式构造真实 Sensor 核对 filters_state() 报的也是全关(文件与设备必须一致)。 - Why: 之前的实现计划里写的是"四个 sensor_<preset>.json 整机配置",但整机配置要按传感器各复制一份、且必然随 bundle 漂移;README 里内嵌的 JSON 又无法被测试覆盖,等于把"建议用哪档滤波"这句话留在了一处会过时的散文里。改成"filters 片段 + 断言与 FILTER_PRESETS 逐值一致的测试",既不谎称是完整配置,也不会静默过时。 - Verification: pytest tests/test_filter_presets.py → 12 passed;SDK 全量 335 passed / 15 skipped(唯一失败仍是需要 1200 帧而样例只有 577 帧的 longrun 测试)。 - Not in this change: 未生成按传感器复制的整机配置;docs/filters.md 的预设表未纳入测试(只有这四个文件与代码常量对齐);app 侧未动。
2026-09-14 10:44:07 +08:00
ykcheungab
35190562e5
标定指纹改读生效值并按测量/读数分组 - What: calibration.py 新增 FILTER_MEASUREMENT_KEYS(flow_ema_alpha)与 FILTER_READOUT_KEYS(中值窗口、低通截止/阶数/采样率/rate_auto)、filters_fingerprint()(把 Sensor.filters_state() 归一化成 {measurement, readout, preset, source}:非法值丢弃、来源没写的键不出现而不是补默认、空映射返回 {} 表示"无记录")、filter_mismatches()(按组判读差异)与 _filters_from_config / _flat_filters_from(扁平旧格式与 preset 展开的兼容解析,显式键优先);pipeline_from_sensor_json() 新增 filters_state= 关键字——传了生效值就用生效值,否则读文件的 filters 段并标注 source="sensor.json.filters",返回结构化 filters 键,删除原先会凭空补出 0.5/3/10 的扁平键与 enabled 覆盖逻辑;Calibration.to_dict() 写 meta.filters(同时保留扁平键供旧读者按名取用);parse() 把 filters 读回 pipeline(此前 to_dict 写进 meta 的滤波键在读回时被整段丢弃,指纹实际是"只写不读");check() 改用 filter_mismatches 分开报告——measurement 组差异进 warnings 且措辞含 not comparable,readout 组差异进新增字段 CheckResult.notes(只记录、不拦截);build(extra_meta=…) 把 filters 与扁平滤波键折进结构化组。tests/test_calibration.py 新增 11 项测试(分组、preset 展开与显式键优先、enabled:false 全关、非法值为空而非默认、写入-读回往返、旧扁平文档读回、生效值压过文件、四个预设逐档核对)。docs/filters.md 新增第 7 节。 - Why: 用户决策 B 要求"Sensor.filters_state() 作为唯一生效值出口,calibration.py 指纹与 session.json 都读它、不读配置文件,指纹分 measurement/readout 两组";动手时确认旧实现三个问题叠加:来源错(读文件、被 filters.enabled 覆盖、文件没写就补默认 0.5/3/10),写进 meta 的指纹在读回时被丢弃,check() 因此永远比不出滤波差异——审计链是断的,不是不精确。 - Verification: SDK 全量 pytest 335 passed / 15 skipped,唯一失败 test_vnormal_longrun_no_outlier_jumps 需要 1200 帧而 data/sample/s1_480p.mp4 只有 577 帧(环境/数据,与本改动无关);external-frame 模式逐预设构造真实 Sensor,filters_fingerprint(filters_state()) 得 off(1.0,1,0.0) / low_latency(1.0,3,0.0) / balanced(0.5,3,0.0) / low_noise(0.3,3,10.0);写入→读回往返后 measurement/readout/preset 完整保留且 to_dict 幂等;旧扁平 meta 文档仍读回同一指纹;.repro/verify_cal_filters.py 50 项全绿。 - Not in this change: 未动 app(app 的 meta_from_sensor_json 只取 4 个键,不受影响);未升级 venv 内 SDK;examples/filters 的四个机器可读预设片段与 app 侧 wrapper/齿轮/CSV 17 列未动。
2026-09-14 10:43:58 +08:00
ykcheungab
b956d071ea
滤波说明落到文档与 examples:三级位置/性质、四个预设、可追溯性清单 - What: 新增 docs/filters.md(json.load 不支持注释,故建议以"代码预设 + 文档 + 可复制配置"承载:三级滤波的作用位置与性质对照——flow_ema_alpha 在 compute_flow/HHD 之前、改变测量故两次录制不可比,中值与低通是读数滤波;取值规则:每级按值开关、非法值一律关、filters.enabled 仅作废弃别名、显式键优先于预设;FILTER_PRESETS 四个档位的延迟与用途表;configure()/filters_state() 用法;force_triplets() 两个 buffer 的语义与尖峰实测 10/999;可追溯性五条清单)与 examples/filters/README.md(off/low_latency/balanced/low_noise 四段可直接整块替换的 filters 配置、preset 等价写法、"从预设出发只改一个键"的写法、复制后用 filters_state() 核对生效值的片段)。 - Why: 用户提出"在 json 里加 comment 说明建议的滤波,或在 examples 里写",查证 configs.py 使用 json.load 且环境无 json5/commentjson,加注释会导致加载失败;因此把建议做成可执行预设并在文档与 examples 中给出可复制版本。 - Verification: 文档中的四个预设与 FILTER_PRESETS 逐值一致;示例片段与 sensors/*/sensor.json 的 filters 段结构一致;filters_state()/force_triplets() 的行为已用 external-frame 模式实测(预设解析结果与尖峰 10/999 对照)。 - Not in this change: 未生成四个独立的 sensor_<preset>.json 整机配置文件(README 里给的是整块 filters 段);calibration.py 指纹尚未改读 filters_state();venv 内 SDK 未升级;app 侧 wrapper/齿轮与 CSV 17 列未动。
2026-09-14 10:36:00 +08:00
ykcheungab
0beb36a1af
滤波预设与生效值出口:FILTER_PRESETS + filters_state() + force_triplets() - What: 新增 FILTER_PRESETS(off/low_latency/balanced/low_noise,数值取自 _perf 的延迟表,low_noise 含 10 Hz 低通)与 available_filter_presets() 供 UI 取用;配置可写 filters.preset 且显式键优先于预设值;新增 Sensor.filters_state()(preset + measurement 组 flow_ema_alpha/flow_ema_applied/hhd_downsample/dis_mode + readout 组中值与低通的窗口/截止/阶数/采样率/是否 auto/是否生效 + sample_rate_source + any_stage_applied + source="sensor.filters_state")作为唯一"生效值"出口;新增 Sensor.force_triplets() 一次返回 {filtered:{raw,newton}, unfiltered:{raw,newton}},并在 _apply_force_filter 中于链后、标定前保存 _force_filtered_raw(修正:此前滤波后的 raw 计数没有保存,force_triplets 的 filtered.raw 实际返回的是输入);reset() 清空未滤波缓存。 - Why: 用户要求配置自描述(A)并把"生效值"作为审计唯一依据(B),同时要保留滤波前数据以便"两个 buffer、两个单位都保留";顺带证实并修掉了 filtered.raw 指向输入这一标签错误。 - Verification: external-frame 模式逐预设构造真实 Sensor 打印 filters_state:off/low_latency/balanced/low_noise 分别为 (ema 1.0 off, median 1 off, lp 0.0 off) / (1.0 off, 3 on, 0.0 off) / (0.5 on, 3 on, 0.0 off) / (0.3 on, 3 on, 10.0 on);注入 10,10,10,999,10,10 观察力三元组,filtered.raw 在尖峰帧为 10.0、unfiltered.raw 为 999.0,证明中值生效且未滤波 buffer 完整;compileall 通过。 - Not in this change: calibration.py 指纹尚未改读 filters_state(),examples/filters 与 docs/filters.md 未加,venv 里的 SDK 未升级(app 行为不变,仍硬编码 10 Hz 低通),app 侧 wrapper/齿轮/CSV 17 列未动。
2026-09-14 10:35:51 +08:00
ykcheungab
1adb1c30f0
滤波配置自描述:去掉覆盖式总开关,每级按自己的值生效 - What: sensor.py 删除 filters.enabled 这个覆盖层——flow_ema_alpha / force_median_window / force_lowpass_cutoff_hz 现在各自按值生效(0<α<1 才滤、≤1 关中值、≤0 关低通),非法值一律回落到"关"而不再回落到"默认开"(原实现里非法取值的 except 分支会把 cutoff 变回 10 Hz);enabled 仅作废弃别名保留(显式 false = 三级全关)并在 verbose 时提示弃用,true 不再有覆盖作用;_filters_enabled 改为派生量(任一级在滤才为真)供旧调用方查询。三份 sensors/{box,mini,finger}/sensor.json 的 filters 段改为自描述且默认全关(flow_ema_alpha 1.0 / force_median_window 1 / force_lowpass_cutoff_hz 0.0 / order 2 / sample_rate "auto")。 - Why: 用户问"flow_ema_alpha 是不是受 filter_enabled 控制、这样合适吗",查证后确认三级都被同一总开关覆盖,且出厂配置写 enabled:false 却仍列着 0.5/3,导致文件说的与设备实际跑的不一致(审计/指纹会误报);同时 flow_ema_alpha 位于 HHD 之前、改变的是测量本身,与中值/低通这类读数滤波性质不同,不应被一个开关捆绑。 - Verification: 用 SDK 的 external-frame 模式逐个 bundle 构造真实 Sensor 并读取解析结果:box/mini/finger 均为 ema=1.0、median=1、cutoff=0.0、lowpass_on=False、any_stage=False;三份 JSON 解析通过;compileall 通过;SDK 内 _filters_enabled 仅剩派生定义一处引用。 - Not in this change: 未动采集路径与 read_info/force_triplets(第 2 步),未动 calibration.py 指纹(第 2 步),未升级 venv 里的 SDK(第 5 步)——因此 app 当前行为不变(它仍在运行时硬编码 lowpass_cutoff_hz=10,压过本配置),"默认关"要到 app 改用 FilterSettings.apply_to(sensor) 后才在界面体现。
2026-09-14 10:26:39 +08:00
ykcheungab
514874e2f4
added 5 sensors multi-stream support, 5 finger reach > 100 fps stable using .mp4 video
2026-09-13 12:18:27 +08:00
ykcheungab
0d5d8ff70d
update filter, flow ema 0.5 + med 3
2026-09-12 19:36:36 +08:00
ykcheungab
5f78115429
fix pypi cannot check after upload
2026-09-12 17:43:40 +08:00
ykcheungab
488c8b0bc1
fixed testpypi upload
2026-09-12 17:34:46 +08:00
ykcheungab
94f38bc389
fix github release
2026-09-12 17:01:35 +08:00
ykcheungab
174bceabc4
automate publishing: release github + release pypi
2026-09-12 16:50:55 +08:00
ykcheungab
388f34ca85
faster linux build
2026-09-12 16:36:59 +08:00
ykcheungab
35af74f639
exclude docs from wheel; harden bundle item handling; single-source version
2026-09-12 16:19:34 +08:00
ykcheungab
57bef85e32
fix preflight
2026-09-12 16:00:40 +08:00
ykcheungab
9537cf91a1
added preflight check
2026-09-12 15:49:28 +08:00
zhangyijian
9c23ba3d50
Merge pull request 'Feature/cal json v2' ( #21 ) from feature/cal_json_v2 into dev
...
Reviewed-on: #21
2026-09-10 21:48:55 +08:00
ykcheungab
96f4428230
added calibration data handling functions
2026-09-10 21:47:36 +08:00
ykcheungab
9cbba08d68
tuned sensitivity to max. by default
2026-09-03 15:23:51 +08:00
ykcheungab
ad680b77dc
0.5.1
2026-09-02 21:47:51 +08:00
zhangyijian
bc059e3539
Merge pull request 'Hotfix/mems cam open' ( #20 ) from hotfix/mems_cam_open into dev
...
Reviewed-on: #20
2026-09-02 21:38:48 +08:00
ykcheungab
5be2d9759a
hotfix/camera not connected error
2026-09-02 21:37:40 +08:00
ykcheungab
32823a7666
test if optical flow integration error: not significant for Mems
2026-09-01 21:27:10 +08:00
zhangyijian
26168852ef
Merge pull request 'fix input flag convention mismatch' ( #18 ) from feature/force_cal into dev
...
Reviewed-on: #18
2026-08-26 20:27:35 +08:00
ykcheungab
36e0c22de6
fix input flag convention mismatch
2026-08-26 20:26:05 +08:00
zhangyijian
a387b8b693
Merge pull request 'Feature/force cal' ( #17 ) from feature/force_cal into dev
...
Reviewed-on: #17
2026-08-26 20:22:27 +08:00
ykcheungab
8a4be5f8f2
update to 0.5.0
2026-08-26 20:20:37 +08:00
ykcheungab
68910e63c1
fix finger gui cannot choose camera
2026-08-26 20:19:55 +08:00
ykcheungab
577e3fe528
update pip install .copy manifest for developments
2026-08-26 20:04:40 +08:00
ykcheungab
32d4164471
update examples to fix path issues
2026-08-26 19:38:47 +08:00
ykcheungab
d59e1cb7fb
fix path errors
2026-08-26 19:22:37 +08:00
zhangyijian
2cb152b76e
Merge pull request 'refractor stitcher class into module' ( #16 ) from refractor/stitcher into dev
...
Reviewed-on: #16
2026-08-23 16:25:27 +08:00
ykcheungab
ab97efe039
refractor stitcher class into module
2026-08-23 16:24:53 +08:00
zhangyijian
135857b6de
Merge pull request 'refractor capture to a module' ( #15 ) from refractor/capture into dev
...
Reviewed-on: #15
2026-08-23 15:53:55 +08:00
ykcheungab
8a7760f12b
refractor capture to a module
2026-08-23 15:53:02 +08:00
zhangyijian
4583dc3a40
Merge pull request 'Refractor/config package' ( #14 ) from refractor/config_package into dev
...
Reviewed-on: http://100.106.67.31:3000/orisys-tech/orisys-sdk/pulls/14
2026-08-23 12:25:28 +08:00
ykcheungab
1ceb0d9ca4
organize settings to dedicated sensors folder, json + assets
2026-08-23 12:21:24 +08:00