Skip to content

Use Realtime Scheduling#121

Merged
1cedsoda merged 6 commits intomasterfrom
fix/7
Jul 14, 2025
Merged

Use Realtime Scheduling#121
1cedsoda merged 6 commits intomasterfrom
fix/7

Conversation

@1cedsoda
Copy link
Copy Markdown
Contributor

@1cedsoda 1cedsoda commented May 5, 2025

fix #7

@1cedsoda 1cedsoda force-pushed the fix/7 branch 2 times, most recently from 6a97702 to 9c07ba6 Compare June 17, 2025 15:03
@1cedsoda 1cedsoda requested a review from Copilot June 26, 2025 15:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds real-time scheduling support by locking process memory and setting thread priorities to improve determinism in critical loops.

  • Calls lock_memory early in main to prevent page faults
  • Invokes set_realtime_priority in both the main loop and EtherCAT thread
  • Introduces a new control_core::realtime module with lock_memory and set_realtime_priority and updates dependencies

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
server/src/main.rs Added lock_memory() call with error/info logging
server/src/loop.rs Added set_realtime_priority() in the main loop thread
server/src/ethercat/setup.rs Added set_realtime_priority() in the EtherCAT TxRx thread
control-core/src/realtime.rs New module implementing memory locking and scheduling APIs
control-core/src/lib.rs Exposed the new realtime module
control-core/Cargo.toml Added libc dependency for Unix targets
Comments suppressed due to low confidence (3)

control-core/src/realtime.rs:10

  • The doc comment states priority 80, but the code sets param.sched_priority = 95. Update the documentation to match the actual value or adjust the code to use 80 for consistency.
/// 2. Setting the real-time priority to 80 (on a scale of 1-99, where higher values indicate

control-core/src/realtime.rs:1

  • [nitpick] The new real-time functions lack unit tests. Consider adding tests (possibly via integration/mocking) for lock_memory() and set_realtime_priority() to validate behavior and error handling.
#[cfg(unix)]

control-core/Cargo.toml:24

  • Non-Unix branches use log::error!, but log isn’t listed under [dependencies]. Add log = "0.4" or switch to tracing::error! for consistency and to ensure compilation.
[target.'cfg(unix)'.dependencies]

Comment thread server/src/ethercat/setup.rs
1cedsoda added 5 commits July 14, 2025 14:18
# This is the 1st commit message:

move lock emmory after tracing

# This is the commit message #2:

Only lock future memory
Only lock future memory

disable memory locking
@1cedsoda 1cedsoda marked this pull request as ready for review July 14, 2025 12:20
@1cedsoda 1cedsoda merged commit 9f55171 into master Jul 14, 2025
4 checks passed
@1cedsoda 1cedsoda deleted the fix/7 branch July 14, 2025 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use PREEMT_RT

2 participants