代码结构优化 性能优化#4703
Merged
Merged
Conversation
仿真循环中新增关节控制代码
donghaiwang
approved these changes
Dec 27, 2025
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.
修改概述:
修改的详细描述
模块化拆分:将大函数拆分为小函数(如_init_joint_info、_setup_camera),单一职责原则
配置增强:使用field默认值工厂,支持更灵活的配置;新增supported_modes、max_fps等配置项
减少锁竞争:优化collect_plot_data,批量处理数据而非逐行操作
减少 IO 操作:状态打印改为批量输出,减少控制台 IO
优化随机数生成:随机模式下每 0.2 秒更新一次随机值,减少关节抖动
减少重绘:绘图更新仅在数据变化时执行,避免无效重绘
经过了什么样的测试?
运行效果
动图、视频、截图等
