remove all logic but detecting end race, adjust tolerance, increase timmings to be on safe side, uncomment debug tooltips

This commit is contained in:
Bartek Dobrowolski-Nowakowski
2022-05-06 09:50:39 +02:00
parent 74581278bd
commit 00a09da3c3
5 changed files with 15 additions and 147 deletions

View File

@@ -50,139 +50,6 @@ Race_PANAM()
Sleep (race_start_delay)
controller.Axes.LX.SetState(62) /* before turn 1, to avoid queue of cars */
Loop {
; Turn 1
; Tooltip
turn_one_end_found := false
if (CheckTurn(turn1.startX, turn1.startY, 3100))
{
turn_one_end_found := true
ToolTipper("Turn 1 start found")
/*
if( A_Index != 1){
Nitrous_Off()
Accel_On(75)
}
*/
controller.Axes.LX.SetState(18-3*%A_Index%)
}
;Sleep(500)
Accel_On(100)
turn_one_end_found := false
; turn_one_end_found := true ; debug TODO check if wheels are curved
if (CheckTurn(turn1.endX, turn1.endY, 2300))
{
turn_one_end_found := true
ToolTipper("Turn 1 end found")
Nitrous_On()
controller.Axes.LX.SetState(75)
}
sleep(2000)
if (turn_one_end_found)
{
controller.Axes.LX.SetState(65)
}
sleep(2500)
if (turn_one_end_found)
{
controller.Axes.LX.SetState(62)
}
sleep(2000)
turn_two_start_found := false
; Turn 2
if( A_Index = 1 || A_Index = 6){
if (CheckTurn(turn2.startX, turn2.startY, 3900))
{
turn_two_start_found := true
}
}
else{
if (CheckTurn(545, turn2.startY)) {
turn_two_start_found := true
}
}
if (turn_two_start_found)
{
ToolTipper("Turn 2 start found")
controller.Axes.LX.SetState(18.3)
}
turn_two_end_found := false
; turn_two_end_found := true ; debug TODO check if wheels are curved
if (CheckTurn(turn2.endX, turn2.endY, 2500))
{
turn_two_end_found := true
ToolTipper("Turn 2 end found")
controller.Axes.LX.SetState(50)
}
if( A_Index = 1 || A_Index = 6){
if (turn_two_end_found)
{
controller.Axes.LX.SetState(75)
}
sleep(2000)
if (turn_two_end_found)
{
controller.Axes.LX.SetState(65)
}
sleep(500)
}
else{
if (turn_two_end_found)
{
Turn_Left(500, 28)
}
}
; Turn 3
if (CheckTurn(turn3.startX, turn3.startY))
{
Nitrous_Off()
ToolTipper("Turn 3 start found")
controller.Axes.LX.SetState(12)
}
turn_three_end_found := false
; turn_three_end_found := true ; debug TODO check if wheels are curved
if (CheckTurn(turn3.endX, turn3.endY))
{
turn_three_end_found := true
Nitrous_On()
ToolTipper("Turn 3 end found")
controller.Axes.LX.SetState(42)
}
sleep(500)
if (turn_three_end_found)
{
controller.Axes.LX.SetState(58)
}
sleep(2000)
if (turn_three_end_found)
{
controller.Axes.LX.SetState(62)
}
sleep(2000)
CheckTurn(lap_marker.startX, lap_marker.startY)
ToolTipper("Lap Complete")
sleep(4000)
} until A_TickCount > t_racefinishtime
controller.Axes.LX.SetState(50)
; ToolTip, Out of Loop, 100, 100, screen
loop {
;ToolTip, Racing, 100, 100, Screen
break_point := false
@@ -190,7 +57,7 @@ Race_PANAM()
for i, c in c1
{
d1 := Distance(c, color_check1)
;ToolTipper( d1 " " pix1y+remote_play_offsetY " " pix1x " " c)
ToolTipper( d1 " " pix1y+remote_play_offsetY " " pix1x " " c)
if (d1 < tolerance ){
break_point := true
break