summaryrefslogtreecommitdiff
path: root/robot/problems/introduction/forward1m
diff options
context:
space:
mode:
authorMartin Možina <martin.mozina@fri.uni-lj.si>2015-12-28 10:23:46 +0100
committerMartin Možina <martin.mozina@fri.uni-lj.si>2015-12-28 10:23:46 +0100
commit165c7165bb2184c9c9e0576a074ba4f29052bf8f (patch)
tree9b86dbbd1d4c39b52bfd7f54cfb13c2354727a53 /robot/problems/introduction/forward1m
parent4cdea335b0951e3c12dfb7b906f958d6b5be25c6 (diff)
parentc1bb0d56b2c0482c766d094c65fdf0fd9d1aa0ba (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/forward1m')
-rw-r--r--robot/problems/introduction/forward1m/common.py3
-rw-r--r--robot/problems/introduction/forward1m/en.py23
-rw-r--r--robot/problems/introduction/forward1m/sl.py16
3 files changed, 33 insertions, 9 deletions
diff --git a/robot/problems/introduction/forward1m/common.py b/robot/problems/introduction/forward1m/common.py
index a8dd9ad..201a981 100644
--- a/robot/problems/introduction/forward1m/common.py
+++ b/robot/problems/introduction/forward1m/common.py
@@ -10,9 +10,6 @@ number = 2
visible = True
solution = '''\
-from ev3dev import *
-from mindstorms_widgets import mindstorms_widgets
-
robot = mindstorms_widgets()
robot.connect_motor( 'left' )
robot.connect_motor( 'right' )
diff --git a/robot/problems/introduction/forward1m/en.py b/robot/problems/introduction/forward1m/en.py
index bdf2a45..f47d088 100644
--- a/robot/problems/introduction/forward1m/en.py
+++ b/robot/problems/introduction/forward1m/en.py
@@ -1,15 +1,32 @@
# coding=utf-8
import server
-mod = server.problems.load_language('python', 'en')
+mod = server.problems.load_language('robot', 'en')
id = 208
name = 'Forward 1m'
slug = 'Forward 1m'
description = '''\
-
+ Write a program that would make the robot drive forward and stop after 1 meter.
'''
hint = {
-
+ 'mW_init':mod.hint['init'],
+ 'connectMotorLeft':mod.hint['connectMotorLeft'],
+ 'connectMotorRight':mod.hint['connectMotorRight'],
+ 'moveSteering':mod.hint['moveSteering'],
+ 'onForRotations':mod.hint['onForRotations'],
+ 'direction':mod.hint['direction']+['''<p><code>robot.move_steering( '...', direction=0, ... )</code>.</p>'''],
+ 'seconds':mod.hint['seconds']+['''<p><code>robot.move_steering( 'on_for_seconds', direction=0, seconds=3 )</code>.</p>'''],
+ 'rotations':mod.hint['rotations'],
}
+
+plan = ['''\
+<p>Program izvedemo v naslednjih korakih:</p>
+<ol>
+ <li>create a mindstorms_widgets() object, which represents the robot in your code.</li>
+ <li>connect the driving motors.</li>
+ <li>measure the circumference of robot's wheels and compute the number of rotations per meter.</li>
+ <li>synchronize the motors and run them so that the robot would move forward for computed number of rotations.</li>
+</ol>'''
+]
diff --git a/robot/problems/introduction/forward1m/sl.py b/robot/problems/introduction/forward1m/sl.py
index 8045d58..f6209eb 100644
--- a/robot/problems/introduction/forward1m/sl.py
+++ b/robot/problems/introduction/forward1m/sl.py
@@ -4,7 +4,7 @@ name = 'Naprej 1m'
slug = 'Naprej 1m'
description = '''\
-<p>Napiši program, da bo robot peljal naravnost naprej 3 sekunde in se nato ustavil.</p>'''
+<p>Napiši program, da bo robot peljal 1 meter naravnost in se nato ustavil.</p>'''
hint = {
'mW_init':['''<p>Robota v programu predstavimo z mindstorms_widgets(): <code>robot = mindstorms_widgets()</code>.</p>'''],
@@ -12,12 +12,22 @@ 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 in ju zaženi.</p>''',
'''<p>Za sinhronizirano vožnjo je najbolj primerna metoda <code>robot.move_steering( ... )</code>.</p>'''],
'onForRotations':['''<p>Prvi argument metode <code>robot.move_steering</code> naj pove, da bo delovanje motorjev določeno s številom obratov.</p>''',
'''<p><code>robot.move_steering('on_for_rotations', ... )</code>.</p>'''],
'direction':['''<p>Navedi smer premikanja motorjev, naravnost = 0.</p>''',
'''<p><code>robot.move_steering( 'on_for_rotations', direction=0, ... )</code>.</p>'''],
- 'rotations':['''<p>Določi število obratov; za koliko obratov naj se zavrtita motorja? Izmeri dolžino 1m, izpisuj obrate <code>print(robot.motor['left'].count_per_rot, robot.motor['right'].count_per_rot)</code> in tako določi ustrezno število obratov.</p>''',
+ 'rotations':['''<p>Določi število obratov; za koliko obratov naj se zavrtita motorja? Izmeri obseg kolesa in preračunaj, koliko obratov je potrebnih za 1m.</p>''',
'''<p><code>robot.move_steering( 'on_for_rotations', direction=0, rotations=5 )</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>Vklopimo oba motorja v sinhronem načinu tako, da robot vozi naravnost.</li>
+ <li>Glede na obseg koles izračunamo, koliko obratov mora narediti kolo na dolžini 1m; ustrezno nastavimo število obratov, po katerih se robot ustavi.</li>
+</ol>'''
+]