Fix System Config Values for LCM on MacOS and Refactor#1065
Conversation
Greptile OverviewGreptile SummaryRefactors system configuration logic out of Key improvements:
Minor issue:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant LCMService
participant configure_system_for_lcm
participant SystemConfigurator
participant OS as Operating System
User->>LCMService: start()
LCMService->>configure_system_for_lcm: configure_system_for_lcm(check_only=False)
alt Platform is Linux
configure_system_for_lcm->>configure_system_for_lcm: Create LinuxMulticast & LinuxBuffer
else Platform is Darwin (macOS)
configure_system_for_lcm->>configure_system_for_lcm: Create MacOSMulticast, MacOSBuffer & MacOSUlimit
end
configure_system_for_lcm->>SystemConfigurator: configure_system(checks)
alt CI Environment
SystemConfigurator-->>configure_system_for_lcm: Skip (CI detected)
else Not CI
loop For each check
SystemConfigurator->>SystemConfigurator: check()
SystemConfigurator->>OS: Read system values (sysctl, netstat, etc.)
OS-->>SystemConfigurator: Current values
end
alt All checks pass
SystemConfigurator-->>configure_system_for_lcm: No changes needed
else Some checks fail
SystemConfigurator->>User: Display required changes & prompt
User-->>SystemConfigurator: User response (y/n)
alt User confirms
loop For each failing check
SystemConfigurator->>SystemConfigurator: fix()
SystemConfigurator->>OS: Apply changes (sudo if needed)
OS-->>SystemConfigurator: Success/Failure
end
else User declines & critical check failed
SystemConfigurator->>SystemConfigurator: raise SystemExit(1)
end
end
end
configure_system_for_lcm-->>LCMService: Configuration complete
LCMService->>LCMService: Start LCM loop
|
| # On macOS, use multicast with TTL=0 to keep traffic local | ||
| self.url = _DEFAULT_LCM_URL_MACOS | ||
| if self.url is None: | ||
| self.url = _DEFAULT_LCM_URL |
There was a problem hiding this comment.
this confirmed to be the default LCM for all OS's. I wanted to get it from lcm directly but it seems they don't expose it
| # ----------------------------- generic enforcement of system configs ----------------------------- | ||
|
|
||
|
|
||
| def configure_system(checks: list[SystemConfigurator], check_only: bool = False) -> None: |
There was a problem hiding this comment.
this is generic enough that it maybe shouldn't live under protocol/service.
There was a problem hiding this comment.
yes, can move later when other systems need it
This test sometimes in CI registers 1001 msg, likely due to some parallel test exec on the same machine (but never less) so something could be off on your end? lcm handles 50k messages per sec easily on my machine
you can run to check on your end, curious about mac and if it can be tuned. I assume it's mac network stack but to make sure you can run raw udp test and see what's the lcm encode/decode slowdown cost here I get 250k msgs / sec
|
yeah this is good idea, will review soon tnx |
leshy
left a comment
There was a problem hiding this comment.
this is great, can push in, leaving comments on benchmarking for macos people
… Unitree Go2 Navigation & Exploration Beta Pre-Release v0.0.8: Unitree Go2 Navigation & Exploration Beta, Transport Updates, Documentation updates, Rerun fixes, Person follow, Readme updates ## What's Changed * Small docs clarification about stream getters by @leshy in #1043 * Fix split view on wide monitors by @jeff-hykin in #1048 * Docs: Install & Develop by @jeff-hykin in #1022 * Add uv to nix and fix resulting problems by @jeff-hykin in #1021 * v0.0.8 by @paul-nechifor in #1050 * Style changes in docs by @paul-nechifor in #1051 * Revert "Add uv to nix and fix resulting problems" by @leshy in #1053 * Transport benchmarks + Raw ros transport by @leshy in #1038 * feat: default to rerun-web and auto-open browser on startup (browser … by @Nabla7 in #1019 * bbox detections visual check by @leshy in #1017 * fix: only auto-open browser for rerun-web viewer backend by @Nabla7 in #1066 * move slow tests to integration by @paul-nechifor in #1063 * Streamline transport start/stop methods by @Kaweees in #1062 * Person follow skill with EdgeTAM by @paul-nechifor in #1042 * fix: increase costmap floor z_offset to avoid z-fighting by @Nabla7 in #1073 * Fixed issue #1074 by @alexlin2 in #1075 * ROS transports initial by @leshy in #1057 * Fix System Config Values for LCM on MacOS and Refactor by @jeff-hykin in #1065 * SHM Transport basic fixes by @leshy in #1041 * commented out Mem Transport test case by @leshy in #1077 * Docs/advanced streams update 2 by @leshy in #1078 * Fix more tests by @paul-nechifor in #1071 * feat: navigation docker updates from bona_local_dev by @baishibona in #1081 * Fix missing dependencies by @Kaweees in #1085 * Release readme fixes by @spomichter in #1076 ## New Contributors * @baishibona made their first contribution in #1081 **Full Changelog**: v0.0.7...v0.0.8


Unit test with
cd dimos/protocol/service;pytest, integration test withdimos --replay run unitree-go2I needed to fix something in lcmservice, and Ivan had mentioned that the system checks in lcmservice were messy. I agreed so I refactored it
REFACTOR CHANGES:
system_configurator.pyNEW STUFF (beyond refactor)
ulimit -ncheck for MacOS (default max number of open files is 256 on MacOS) was added.67_108_864(64Mb) "worked" was just the setter command failing with a warning and not being very loud (while the rest of dimensional still ran). It seems that 8_388_608 is a hardcoded limit in the MacOS kernel. The logic now is split where MacOS is using the 8_388_608 value, and Linux uses 67_108_864NOTE:
test_high_volume_messagesseems flakey on CI @leshy (on dev or this PR). Passes every time for me on a dimensional laptop. On my mac its not even close to passing (450's out of 1000)