global-navigation-runtime-config.md
4.81 KB
Global Navigation Runtime Config
Location
Runtime config is under:
AppSettings:GlobalNavigation
In this repo, examples are already added to:
src/Rcs.Api/appsettings.Development.jsonsrc/Rcs.Api/appsettings.Production.json
Coordinator
Path:
AppSettings:GlobalNavigation:Coordinator
Fields:
-
ResumeStablePassThreshold- Consecutive pass checks required before leaving hold/queue.
-
ResumeDispatchCooldownSeconds- Minimum interval between scheduler-triggered resume dispatches for same hold key.
-
ResumeScanIntervalMilliseconds- Poll interval for hold-resume scheduler to pick due requests.
-
HoldSecondsShort- Standard hold cooldown duration.
-
HoldSecondsQueue- Queue hold cooldown duration for junction occupancy.
-
QueueStaleSeconds- Expiration window for queue fairness tickets; stale robots are cleaned from queue.
-
ConflictEscalateNearestWaitThreshold- Fail streak threshold to try
WaitNearestpatch.
- Fail streak threshold to try
-
ConflictEscalateDetourThreshold- Fail streak threshold to try
LocalDetour.
- Fail streak threshold to try
-
ConflictEscalateLateralYieldThreshold- Fail streak threshold to try
LateralYield.
- Fail streak threshold to try
-
ConflictEscalateParkingThreshold- Fail streak threshold to try
ParkingYield.
- Fail streak threshold to try
-
ConflictEscalateRetreatThreshold- Fail streak threshold to try
Retreat.
- Fail streak threshold to try
-
ConflictEscalateReplanThreshold- Fail streak threshold to try
ReplanTail.
- Fail streak threshold to try
-
EnableLateralYield- Enable/disable
LateralYield.
- Enable/disable
-
EnableParkingYield- Enable/disable
ParkingYield.
- Enable/disable
-
EnableRetreat- Enable/disable
Retreat.
- Enable/disable
-
DecisionMetricsIntervalSeconds- Logging interval for
[GlobalNav] DecisionMetrics.
- Logging interval for
PathCas
Path:
AppSettings:GlobalNavigation:PathCas
Fields:
-
MetricsIntervalSeconds- Logging interval for
[PathCAS]metric line.
- Logging interval for
-
WindowDurationSeconds- Sliding window used for high-conflict detection.
-
HighConflictMinAttempts- Minimum attempts in window before conflict-ratio backoff is enabled.
-
HighConflictRatioThreshold- Conflict ratio threshold (0.0-1.0) to trigger backoff.
-
EnableHighConflictBackoff- Enable/disable jitter delay under high conflict ratio.
-
BackoffMinMs- Minimum jitter delay.
-
BackoffMaxMs- Maximum jitter delay.
Tuning Suggestion
- If robots often oscillate at junctions:
- increase
ResumeStablePassThresholdfrom 2 to 3.
- increase
- If congestion is short and frequent:
- lower
HoldSecondsShortto reduce idle wait.
- lower
- If CAS conflict spikes under burst:
- lower
HighConflictRatioThresholdslightly and keep backoff enabled.
- lower
- If parking/retreat causes too many long detours:
- raise corresponding escalate thresholds by 1.
- If side-lane yielding is overused in narrow maps:
- increase
ConflictEscalateLateralYieldThresholdor disableEnableLateralYield.
- increase
- If queue blocking appears unfair at busy junctions:
- tune
QueueStaleSeconds(too high causes stale tickets, too low causes requeue churn).
- tune
Runtime Verification
Use provided scripts:
- Hot reload smoke:
scripts/global-nav/Invoke-GlobalNavHotReloadSmoke.ps1
- HTTP concurrency stress template:
scripts/global-nav/Invoke-PathCasHttpStressTemplate.ps1
- Hold/queue/resume smoke:
scripts/global-nav/Invoke-GlobalNavHoldQueueResumeSmoke.ps1
Typical flow:
- Keep service running with
reloadOnChange=truedefault behavior. - Run hot reload smoke script and confirm log:
[GlobalNav] ConfigUpdated ...
- Run stress template against your send-next endpoint and confirm logs:
[PathCAS] ...-
[PathCAS] HighConflictBackoff ...when conflict is high. -
[GlobalNav] ResumeMetrics ...for hold-resume scheduler behavior.
- Run hold/queue/resume smoke with optional log parsing:
- Example:
powershell -File scripts/global-nav/Invoke-GlobalNavHoldQueueResumeSmoke.ps1 -ApiBaseUrl http://localhost:5000 -RobotManufacturer HUAHENG -RobotSerialNumber 1001 -LogPath logs/app.log - Confirm patterns:
[GlobalNav] HoldEscalationCandidatesqueue turn pendingResumeDispatchTriggered[GlobalNav] ResumeMetrics
- Example:
Hold Resume Trigger Flow
When SendNextSegment enters Hold or Queue:
- Hold state is persisted with CAS and
HoldUntilUtc. - A resume request is scheduled by
IGlobalNavigationResumeScheduler. -
SendNextSegmentprecheck will short-circuit while hold window is not reached. - Scheduler wakes at
ResumeAtUtc, then validates:- cache
PlanVersionstill matches the scheduled version -
RouteModeis stillHoldingAtWaitNodeorQueueingForJunction - for queue mode, robot ticket reaches queue head (fairness gate)
- robot is not driving
- cache
- If checks pass, scheduler triggers
SendNextSegmentAsync(manufacturer, serialNumber). - If stale/transient (version changed, still driving, lock in progress), it skips or requeues.