From f80206e6a4e4cec1574a375cb04dbdf07d3e02cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=BDabkar?= Date: Wed, 23 Dec 2015 11:28:05 +0100 Subject: angleska verzija --- robot/problems/introduction/followline/en.py | 34 +++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'robot/problems/introduction/followline') diff --git a/robot/problems/introduction/followline/en.py b/robot/problems/introduction/followline/en.py index 3f816fe..1551d1b 100644 --- a/robot/problems/introduction/followline/en.py +++ b/robot/problems/introduction/followline/en.py @@ -7,8 +7,40 @@ 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',... ).

'''], + 'moveSteeringOff':mod.hint['moveSteeringOff'], + 'connectColorSensor':mod.hint['connectColorSensor'], + 'colorSensorMeasureRLI':mod.hint['colorSensorMeasureRLI'], + 'while':['''

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:.

'''], + 'moveTankOn':mod.hint['moveTankOn'], + 'lrPower': mod.hint['lrPower'], + 'moveTankOff': mod.hint['moveTankOff'], + 'time': ['''Use time() to measure time.''', + '''

start = time.time()\nwhile time.time()-start < 10:

'''], + 'if': ['''

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:

+
    +
  1. create a mindstorms_widgets() object, which represents the robot in your code.
  2. +
  3. connect the driving motors.
  4. +
  5. connect the color sensor.
  6. +
  7. in a loop, the robot should read the color sensor to check whether it is on or off line.
  8. +
  9. if it sees black, it should turn right/left; if it sees white, it should turn left/right.
  10. +
  11. break the loop after specified time, 10 seconds.
  12. +
  13. stop the motors.
  14. +
+

Note: you may need to calibrate the color sensor before running the program on the robot.

+''' +] \ No newline at end of file -- cgit v1.2.1