Closed Thonners closed 4 years ago
On second thoughts, much simpler to check for intersection between the start line and the line between p(t-1), p(t), where p(t) is the position of the vehicle at time t.
Still need some logic to deal with vehicle resets (perhaps just setting lapcount to 0 on reset)
Method two sounds simpler to implement and should exit quickly thanks to the improvements you made for the lidar intersections. Resetting the lapcounter sound reasonable, if someone has needed to reset then their data should be voided
Resetting the vehicle's position results in a new lap being triggered (and a lap being 'completed'
Lap checking could potentially be improved with a few vector based checks of the starting line coords (fail fast to keep runtime down):