import server mod = server.problems.load_language('robot', 'en') id = 207 name = 'Line following' slug = 'Line following' description = '''\ Write the program for line following. The robot should use the color sensor to follow the black line on white background. ''' hint = { 'mW_init':mod.hint['init'], 'connectMotorLeft':mod.hint['connectMotorLeft'], 'connectMotorRight':mod.hint['connectMotorRight'], 'moveSteeringOn':mod.hint['moveSteering']+['''
Use move_steering method with 'on' as the first parameter robot.move_steering( 'on',... )
.
Use the loop, inside which the robot would follow the line.
''', '''The loop should be time constrained, e.g. time.time()
.
start = time.time()\nwhile time.time()-start < 10:
.
start = time.time()\nwhile time.time()-start < 10:
Use conditional statement inside the loop...
''', '''If the robot sees the line, it should turn slightly to go off the line; if the robot sees the background, it should turn towards the line.
'''] } plan = ['''\The program should do the following:
Note: you may need to calibrate the color sensor before running the program on the robot.
''' ]