diff --git a/ch-13/2-displaying-a-pose/robot/arena.py b/ch-13/2-displaying-a-pose/robot/arena.py index 17d4d98..dc317d4 100644 --- a/ch-13/2-displaying-a-pose/robot/arena.py +++ b/ch-13/2-displaying-a-pose/robot/arena.py @@ -20,27 +20,3 @@ target_zone = [ width = 1500 height = 1500 - -def point_is_inside_arena(point): - """Return True if the point is inside the arena""" - # cheat a little, the arena is a rectangle, with a cutout. - # if the point is inside the rectangle, but not inside the cutout, it's inside the arena. - # this is far simpler than any line intersection method. - - # is it inside the rectangle? - if point[0] < 0 or point[0] > width \ - or point[1] < 0 or point[1] > height: - return False - # is it inside the cutout? - if point[0] > 1000 and point[1] < 500: - return False - return True - -def point_is_inside_target_zone(point): - """Return True if the point is inside the target zone""" - # cheat a little, the target zone is a rectangle. - # if the point is inside the rectangle, it's inside the target zone. - if point[0] < 1100 or point[0] > 1250 \ - or point[1] < 900 or point[1] > 1100: - return False - return True diff --git a/ch-13/2-displaying-a-pose/robot/robot.py b/ch-13/2-displaying-a-pose/robot/robot.py index 9992b44..433d8ec 100755 --- a/ch-13/2-displaying-a-pose/robot/robot.py +++ b/ch-13/2-displaying-a-pose/robot/robot.py @@ -17,7 +17,6 @@ ticks_per_revolution = encoder_poles * gear_ratio ticks_to_m = (wheel_circumference_mm / ticks_per_revolution) / 1000 m_to_ticks = 1 / ticks_to_m -wheel_separation_mm = 160 motor_A2 = pwmio.PWMOut(board.GP17, frequency=100) motor_A1 = pwmio.PWMOut(board.GP16, frequency=100) diff --git a/ch-13/3-moving-poses-with-sensors/robot/arena.py b/ch-13/3-moving-poses-with-sensors/robot/arena.py index 17d4d98..dc317d4 100644 --- a/ch-13/3-moving-poses-with-sensors/robot/arena.py +++ b/ch-13/3-moving-poses-with-sensors/robot/arena.py @@ -20,27 +20,3 @@ target_zone = [ width = 1500 height = 1500 - -def point_is_inside_arena(point): - """Return True if the point is inside the arena""" - # cheat a little, the arena is a rectangle, with a cutout. - # if the point is inside the rectangle, but not inside the cutout, it's inside the arena. - # this is far simpler than any line intersection method. - - # is it inside the rectangle? - if point[0] < 0 or point[0] > width \ - or point[1] < 0 or point[1] > height: - return False - # is it inside the cutout? - if point[0] > 1000 and point[1] < 500: - return False - return True - -def point_is_inside_target_zone(point): - """Return True if the point is inside the target zone""" - # cheat a little, the target zone is a rectangle. - # if the point is inside the rectangle, it's inside the target zone. - if point[0] < 1100 or point[0] > 1250 \ - or point[1] < 900 or point[1] > 1100: - return False - return True