summaryrefslogtreecommitdiff
path: root/robot/problems/introduction/followline
diff options
context:
space:
mode:
authorJure Žabkar <jure.zabkar@fri.uni-lj.si>2015-12-23 11:28:05 +0100
committerJure Žabkar <jure.zabkar@fri.uni-lj.si>2015-12-23 11:28:05 +0100
commitf80206e6a4e4cec1574a375cb04dbdf07d3e02cd (patch)
treef5e9c17d8b5d4f212b7460496fdbb7226253f086 /robot/problems/introduction/followline
parent0883cb2a6b0bac23bd7553618f4e8db7c882a757 (diff)
angleska verzija
Diffstat (limited to 'robot/problems/introduction/followline')
-rw-r--r--robot/problems/introduction/followline/en.py34
1 files changed, 33 insertions, 1 deletions
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']+['''<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>
+'''
+] \ No newline at end of file