WOW!!! That is cool!!! Very nice job so far.
After a quick look at the code I see a lot of things going on between range checks.
Just wondering what would happen it you setup a timer to trigger an interrupt routine.
The interrupt routine would be the range check. That way the range would be know almost instantly for corrections.
Or add range checking in between the IF/ENDIF statements. Places like this
Code:
aftermain:
gosub skidandreverse
frontfreetostopreverse = frontfreetostopreversesetup
if rangefront < frontfree then 'turn left as there is something ahead in front
gosub SteerFullLeft
goto main
endif
IF rangeright = 0 then
endif
if rangeright > outertrack then 'turn right as we are too far away
gosub SteerHalfRight
endif
if rangeright < desiredtrack and oldrangeright < rangeright then
gosub SteerStraight
endif
if rangeright > desiredtrack and oldrangeright > rangeright then
gosub SteerStraight
endif
Bookmarks