Repository navigation
fix(exchange): 交换模式下电机状态按 motor_hz 投递,不再每次交换都投递 - #38
Merged
Merged
Conversation
IMU 高于 100 Hz 时每个交换应答都带最新电机状态,原先全部注入订阅者与控制通道: 562 Hz 时 250/s、1125 Hz 时 500/s,其中 73% / 87% 与上一帧完全相同(0016s RS00, 固件 1.3.0-rc2 实测)。控制器与记录程序对同一样本处理多次,也与 CHANGELOG "电机状态封顶 100 Hz"不符。 按到期时间投递:每次投递后到期时间推进整一个 motor 周期,留半个交换周期的余量, 平均恰为 motor_hz;100 Hz 交换时每帧都到期,行为不变。多余的计入 ExchangeStats.motor_skipped(Python 同名属性)。 实机 0016s:100/562/1125 Hz 下订阅者都收到 100/s,IMU 570.9/1142.7/s 零丢; 1125 Hz 交换下力位控制 5/5 到位。新增 ImuHighRate.FollowerHighRateExchangeCaps- MotorStatusAtMotorHz;高频目标随交换的用例改为按实际投递的状态数断言。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
start_exchange(motor_hz=100, imu_hz>100)时每个交换应答都带最新电机状态,SDK 原先把它们全部注入订阅者与控制通道:562 Hz IMU 时 250/s、1125 Hz 时 500/s。实测(0016s,RS00,固件 1.3.0-rc2,电机静止)其中 73% / 87% 与上一帧逐字节相同。控制器、记录程序对同一样本处理多次,也与 CHANGELOG 里"电机状态封顶 100 Hz"不符。用户决定:交换模式下电机状态按motor_hz投递,与推流模式一致。改动
FollowerExchange按到期时间投递电机状态:每投递一次,到期时间推进整一个1/motor_hz,留半个交换周期余量,平均恰为motor_hz。100 Hz 交换时每帧都到期,行为不变。ExchangeStats.motor_skipped(C++ / Python)统计被跳过的记录;motor_samples现在是实际投递数。ImuHighRate.FollowerHighRateExchangeCapsMotorStatusAtMotorHz;TargetsRideOnTheNextTelemetryExchangeAtHighRate原先断言"80% 的交换带目标"(控制器每帧都下目标),改为按实际投递的状态数断言,"目标不额外占交换"这一条不变。验证
1125 Hz 交换下
ForcePositionController0.8→0.2→0.8→0.0→0.8 全部到位,target_update_hz100.2,控制错误 0。附带发现(固件侧,不在本 PR)
电机静止、控制环未运行时,固件对电机状态的真实刷新只有约 67 Hz(MIT 下电机主动上报约 15 ms 一帧),推流 100 Hz 时也有约 1/3 是重复帧。固件会话已在源码层定位,见协调看板。
🤖 Generated with Claude Code