drag = pan · scroll = zoom

Robotic Milking Arm 2D: Kalman Teat-Tracking & IK Reach

This 2D top-down simulator models the same two algorithms as the 3D version: teat localization and arm reach. A laser/ultrasonic scan model repeatedly samples each teat's position with Gaussian noise while the udder sways as the cow shifts its weight; a scalar recursive (Kalman) filter fuses those noisy scans into a shrinking-uncertainty position estimate, drawn live in the uncertainty chart. Once that estimate is confident enough, a 2-link robot arm — solved analytically with the law-of-cosines inverse-kinematics formulas used on real manipulators, not an iterative approximation — reaches for it and attempts to attach the cup. Because the true teat keeps drifting during the approach, attachment isn't guaranteed: tune sensor noise, cow movement and arm speed, drag/zoom the scene, and watch the live uncertainty chart, cycle timeline and cumulative success rate respond.