Keep coupled cars on their own rail height - #39
Conversation
Since #36, coupledPose placed each car so its front coupler met the car ahead in all three dimensions. Where the grade changes between two cars, their couplers sit at different heights, so a car behind a locomotive on a slope was pulled up to a block below its rail, burying its wheels in the ballast. Meet the coupler ahead seen from above only, and keep the car's rail height. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthrough
ChangesTrain Coupling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Cars retain their sampled rail height while coupling horizontally across grade changes. The inspected placement behavior and tests support this intended change, with no actionable merge risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
A rabbit checks the couplers in a row Comment |
Problem
Since #36,
Connector.coupledPoseplaced each car so its front coupler met the coupler ahead exactly, in three dimensions. Where the grade changes between two cars, their couplers sit at different heights. So a car behind a locomotive on a slope gets pulled up to about a block off its rail.In the lab on a copy of the Main line (around s 342–350, just past x 5450):
The probe showed the coupling maths itself is right. The predicted coupler position matches the drawn one horizontally, give or take the fixed 0.51 offset both sides use. The problem is only that it forces the heights to match.
Change
coupledPosenow meets the coupler ahead seen from above and keeps the car's rail height (nominal.y). The bend fix from #36, meeting horizontally on curves, is unchanged.Tests
ConnectorTest.passengerFrontMeetsLocomotiveBackWithRealPivotsAndBaseRotation: now checks the couplers meet horizontally and the car keeps its rail height.carOnLevelTrackBehindLocomotiveOnGradeStaysOnItsRail: the lab case. Without the fix the car is placed at y 431.046, where the lab's buried car sat (431.556 − 0.51). With it, the car stays at 432.0.mvn verify: 532 tests pass.This is live in 2.1.1 and 2.2.0 on Dev and Main.
🤖 Generated with Claude Code
Summary by CodeRabbit