✨
This commit is contained in:
25
forward_test.py
Normal file
25
forward_test.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
from time import sleep
|
||||||
|
import robot
|
||||||
|
|
||||||
|
POWER = 70
|
||||||
|
|
||||||
|
TURN_T = 0.079 # 10 degrees
|
||||||
|
DRIVE_T = 0.25 # 10 centimeter
|
||||||
|
|
||||||
|
RIGHT_WHEEL_OFFSET = 4
|
||||||
|
|
||||||
|
CLOCKWISE_OFFSET = 0.96
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
# Initializes the robot and runs the
|
||||||
|
arlo = robot.Robot()
|
||||||
|
|
||||||
|
arlo.go_diff(POWER, POWER + RIGHT_WHEEL_OFFSET, 1, 1)
|
||||||
|
sleep(DRIVE_T * 10)
|
||||||
|
arlo.stop()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
main()
|
@ -6,19 +6,21 @@ POWER = 70
|
|||||||
TURN_T = 0.079 # 10 degrees
|
TURN_T = 0.079 # 10 degrees
|
||||||
DRIVE_A = 16 # 10 centimeter drive at power 1
|
DRIVE_A = 16 # 10 centimeter drive at power 1
|
||||||
|
|
||||||
|
RIGHT_WHEEL_OFFSET = 4
|
||||||
|
|
||||||
CLOCKWISE_OFFSET = 0.96
|
CLOCKWISE_OFFSET = 0.96
|
||||||
|
|
||||||
def square(arlo, drive_t):
|
def square(arlo, drive_t):
|
||||||
while True:
|
while True:
|
||||||
# Driving forward
|
# Driving forward
|
||||||
arlo.go_diff(POWER, POWER+4, 1, 1)
|
arlo.go_diff(POWER, POWER + RIGHT_WHEEL_OFFSET, 1, 1)
|
||||||
sleep(drive_t * 10)
|
sleep(drive_t * 10)
|
||||||
arlo.stop()
|
arlo.stop()
|
||||||
|
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
||||||
# Turning 90 degrees
|
# Turning 90 degrees
|
||||||
arlo.go_diff(POWER, POWER+4, 0, 1)
|
arlo.go_diff(POWER, POWER + RIGHT_WHEEL_OFFSET, 0, 1)
|
||||||
sleep(TURN_T * 9)
|
sleep(TURN_T * 9)
|
||||||
arlo.stop()
|
arlo.stop()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user