CornellDataScience / CornellDataScience/self-driving-car

Timed Main Control Loop

Open
#3 4 comments 0 reactions 1 assignee Claimed by @ezh20 View on GitHub
Dominant language
C++
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

# Problem:
- Sensors and estimators must expect to get updates at a fixed time step

# On This Ticket:
- The Main Control Loop MUST be locked into a given control cycle, given from the config file:
- Create a ControlTask, called TimerEnforcer:
- Create a statefield called: 'end_of_last_cycle', with default value: time.time() at default time.
- Let's create a statefield called: 'target_control_cycle_duration', with value 100 by default.

- In the body of TimerEnforcer, create logic that says:
end_of_last = sfr.get('end_of_last_cycle')
target_duration = sfr.get('target_control_cycle_duration)
while "now" - end_of_last < target_duration:
time.sleep(0.001)

This is so that the TimerEnforcer will sleep for as long as it needs to for the entire MainControlLoop to take exactly "target_control_cycle_duration" time.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.