diff options
author | Martin Možina <martin.mozina@fri.uni-lj.si> | 2015-12-28 10:23:46 +0100 |
---|---|---|
committer | Martin Možina <martin.mozina@fri.uni-lj.si> | 2015-12-28 10:23:46 +0100 |
commit | 165c7165bb2184c9c9e0576a074ba4f29052bf8f (patch) | |
tree | 9b86dbbd1d4c39b52bfd7f54cfb13c2354727a53 /robot/problems/introduction/followline/en.py | |
parent | 4cdea335b0951e3c12dfb7b906f958d6b5be25c6 (diff) | |
parent | c1bb0d56b2c0482c766d094c65fdf0fd9d1aa0ba (diff) |
Merge branch 'master' of 192.168.15.97:codeq-problems
Conflicts:
python/problems/functions/palindrome/sl.py
python/problems/functions/palindromic_numbers/sl.py
Diffstat (limited to 'robot/problems/introduction/followline/en.py')
-rw-r--r-- | robot/problems/introduction/followline/en.py | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/robot/problems/introduction/followline/en.py b/robot/problems/introduction/followline/en.py index 3f816fe..9a588bc 100644 --- a/robot/problems/introduction/followline/en.py +++ b/robot/problems/introduction/followline/en.py @@ -1,14 +1,46 @@ # coding=utf-8 import server -mod = server.problems.load_language('python', 'en') +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']+['''<p>Use move_steering method with 'on' as the first parameter <code>robot.move_steering( 'on',... )</code>.</p>'''], + 'moveSteeringOff':mod.hint['moveSteeringOff'], + 'connectColorSensor':mod.hint['connectColorSensor'], + 'colorSensorMeasureRLI':mod.hint['colorSensorMeasureRLI'], + 'while':['''<p>Use the loop, inside which the robot would follow the line.</p>''', + '''<p>The loop should be time constrained, e.g. <code>time.time()</code>.</p>''', + '''<p><code>start = time.time()\nwhile time.time()-start < 10:</code>.</p>'''], + 'moveTankOn':mod.hint['moveTankOn'], + 'lrPower': mod.hint['lrPower'], + 'moveTankOff': mod.hint['moveTankOff'], + 'time': ['''Use time() to measure time.''', + '''<p><code>start = time.time()\nwhile time.time()-start < 10:</code></p>'''], + 'if': ['''<p>Use conditional statement inside the loop...</p>''', + '''<p>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.</p>'''] } + +plan = ['''\ +<p>The program should do the following:</p> +<ol> + <li>create a mindstorms_widgets() object, which represents the robot in your code.</li> + <li>connect the driving motors.</li> + <li>connect the color sensor.</li> + <li>in a loop, the robot should read the color sensor to check whether it is on or off line.</li> + <li>if it sees black, it should turn right/left; if it sees white, it should turn left/right.</li> + <li>break the loop after specified time, 10 seconds.</li> + <li>stop the motors.</li> +</ol> +<p>Note: you may need to calibrate the color sensor before running the program on the robot.</p> +''' +] |