Skip to content
Snippets Groups Projects
Commit 6f134364 authored by ft-Demo's avatar ft-Demo
Browse files

commit by robo pro coding

parent 4119e5a4
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -215,9 +215,9 @@ def search_ball_rot(v):
right_v(v)
def turnBallLeft():
def turnSideLeft():
global v, ticks, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, factor_y, posx_ball, counters, factor_ball_rot, posy_ball, posx_goal, search_dir_left, v_slow, x_min, v_var_ball_xpos, x_max, v_var_ball_ypos, y_ball_far, y_ball_near, y_ball_touch, v_fast, goal_width, pos_goal_both, state
cmd = 'turnBallLeft'
cmd = 'turnSideLeft'
TXT_M_M1_encodermotor.set_speed(int(v_slow), Motor.CCW)
TXT_M_M2_encodermotor.set_speed(int(v_slow), Motor.CW)
TXT_M_M1_encodermotor.start_sync(TXT_M_M2_encodermotor)
......@@ -226,9 +226,9 @@ def turnBallLeft():
TXT_M_M3_encodermotor.start_sync(TXT_M_M4_encodermotor)
def turnBallRight():
def turnSideRight():
global v, ticks, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, factor_y, posx_ball, counters, factor_ball_rot, posy_ball, posx_goal, search_dir_left, v_slow, x_min, v_var_ball_xpos, x_max, v_var_ball_ypos, y_ball_far, y_ball_near, y_ball_touch, v_fast, goal_width, pos_goal_both, state
cmd = 'turnBallRight'
cmd = 'turnSideRight'
TXT_M_M1_encodermotor.set_speed(int(v_slow), Motor.CW)
TXT_M_M2_encodermotor.set_speed(int(v_slow), Motor.CCW)
TXT_M_M1_encodermotor.start_sync(TXT_M_M2_encodermotor)
......@@ -379,7 +379,7 @@ while True:
elif posy_ball > y_ball_far and posy_ball <= y_ball_near:
fwd_v(v_slow)
elif posy_ball > y_ball_near and posy_ball <= y_ball_touch:
turnBallLeft()
turnSideLeft()
elif posy_ball <= y_ball_touch:
bwd_v(v_slow)
else:
......@@ -396,9 +396,9 @@ while True:
fwd_v(v_slow)
elif posy_ball <= y_ball_near:
if posx_goal[0] < posx_ball:
turnBallRight()
turnSideRight()
elif posx_goal[0] > posx_ball:
turnBallLeft()
turnSideLeft()
else:
stop()
elif posy_ball <= y_ball_touch:
......@@ -411,9 +411,9 @@ while True:
fwd_v(v_slow)
elif posy_ball <= y_ball_near:
if posx_goal[1] < posx_ball:
turnBallRight()
turnSideRight()
elif posx_goal[1] > posx_ball:
turnBallLeft()
turnSideLeft()
else:
stop()
elif posy_ball <= y_ball_touch:
......@@ -428,9 +428,9 @@ while True:
if posx_ball > posx_goal[0] and posx_ball < posx_goal[1]:
fwd_v(v_slow)
elif posx_ball < posx_goal[0] and posx_ball < posx_goal[1]:
turnBallLeft()
turnSideLeft()
elif posx_ball > posx_goal[0] and posx_ball > posx_goal[1]:
turnBallRight()
turnSideRight()
else:
stop()
elif posy_ball <= y_ball_touch:
......@@ -444,9 +444,9 @@ while True:
if pos_goal_both >= x_min and pos_goal_both <= x_max:
fwd_v(v_slow)
elif pos_goal_both < x_min:
left_v(v_slow)
left(v_var_ball_xpos, min(max(goal_width * factor_ball_rot, 3), 100))
elif pos_goal_both > x_max:
right_v(v_slow)
right(v_var_ball_xpos, min(max(goal_width * factor_ball_rot, 3), 100))
else:
stop()
elif (posx_ball == None or posy_ball == None) and (posx_goal[0] != None or posx_goal[1] == None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment