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/circle20 | |
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/circle20')
-rw-r--r-- | robot/problems/introduction/circle20/common.py | 5 | ||||
-rw-r--r-- | robot/problems/introduction/circle20/en.py | 24 | ||||
-rw-r--r-- | robot/problems/introduction/circle20/sl.py | 12 |
3 files changed, 33 insertions, 8 deletions
diff --git a/robot/problems/introduction/circle20/common.py b/robot/problems/introduction/circle20/common.py index 879f198..4d283d0 100644 --- a/robot/problems/introduction/circle20/common.py +++ b/robot/problems/introduction/circle20/common.py @@ -10,14 +10,11 @@ number = 5 visible = True solution = '''\ -from ev3dev import * -from mindstorms_widgets import mindstorms_widgets - robot = mindstorms_widgets() robot.connect_motor( 'left' ) robot.connect_motor( 'right' ) -fct = 9 # full circle time +fct = 8.9 # full circle time rad = 20 # Direction to make a good radius for the circle robot.move_steering( 'on_for_seconds', direction=rad, power=40, seconds=fct ) ''' diff --git a/robot/problems/introduction/circle20/en.py b/robot/problems/introduction/circle20/en.py index 8210d71..d2c410c 100644 --- a/robot/problems/introduction/circle20/en.py +++ b/robot/problems/introduction/circle20/en.py @@ -1,14 +1,32 @@ # coding=utf-8 import server -mod = server.problems.load_language('python', 'en') +mod = server.problems.load_language('robot', 'en') id = 205 name = 'Circle 20 cm' slug = 'Circle 20 cm' description = '''\ -''' +<p>Write a program that will make the robot drive in circle (r=20cm) and stop after one loop.</p>''' hint = { - + 'mW_init':mod.hint['init'], + 'connectMotorLeft':mod.hint['connectMotorLeft'], + 'connectMotorRight':mod.hint['connectMotorRight'], + 'moveSteering':mod.hint['moveSteering'], + 'onForSeconds':mod.hint['onForSeconds'], + 'direction':mod.hint['direction']+['''<p>The value of this parameter should be such that would make the robot circle with radius 20cm. This value highly depends on the construction of the robot.</p>''', + '''<p><code>robot.move_steering( 'on_for_seconds', direction=20, ... )</code>.</p>'''], + 'seconds':mod.hint['seconds']+['''<p>Experimentally determine the time (in seconds) the robot needs for one loop.</p>''', + '''<p><code>robot.move_steering( 'on_for_seconds', direction=0, seconds=3 )</code>.</p>'''], } + +plan = ['''\ +<p>The program should:</p> +<ol> + <li>create a mindstorms_widgets() object, which represents the robot in your code.</li> + <li>connect the driving motors.</li> + <li>calculate the turn so that the robot would drive in circle with radius 20 cm.</li> + <li>synchronize the motors and run them for a specified time, so that the robot stops after one round.</li> +</ol>''' +] diff --git a/robot/problems/introduction/circle20/sl.py b/robot/problems/introduction/circle20/sl.py index 219f9c7..735458a 100644 --- a/robot/problems/introduction/circle20/sl.py +++ b/robot/problems/introduction/circle20/sl.py @@ -13,7 +13,7 @@ hint = { '''<p><code>robot.connect_motor( 'left' )</code>.</p>'''], 'connectMotorRight':['''<p>Robotu priključi desni motor</p>''', '''<p><code>robot.connect_motor( 'right' )</code>.</p>'''], - 'moveSteering':['''<p>Sinhroniziraj motorja in ju zaženi za 3 sekunde.</p>''', + 'moveSteering':['''<p>Sinhroniziraj motorja.</p>''', '''<p>Za sinhronizirano vožnjo je najbolj primerna metoda <code>robot.move_steering( ... )</code>.</p>'''], 'onForSeconds':['''<p>Prvi argument metode <code>robot.move_steering</code> naj pove, da bo delovanje motorjev časovno omejeno.</p>''', '''<p><code>robot.move_steering('on_for_seconds', ... )</code>.</p>'''], @@ -24,3 +24,13 @@ hint = { '''<p>Za dani polmer izmeri čas, ki ga robot potrebuje za en obhod.</p>''', '''<p><code>robot.move_steering( 'on_for_seconds', direction=0, seconds=3 )</code>.</p>'''], } + +plan = ['''\ +<p>Program izvedemo v naslednjih korakih:</p> +<ol> + <li>Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.</li> + <li>Nanj povežemo oba pogonska motorja.</li> + <li>Izračunamo ostrino zavoja, pri kateri bo robot vozil po krogu s polmerom 20 cm.</li> + <li>Sinhronizirano poženemo oba motorja za premik v izračunani smeri in časovno omejimo na en obhod.</li> +</ol>''' +] |