From 3ad0fba1d3215eaf45e18cfa72dd3e7e5228a8b3 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 10 Dec 2015 16:01:55 +0100 Subject: Add Slovenian descriptions for the Robot course --- robot/problems/introduction/sl.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 robot/problems/introduction/sl.py (limited to 'robot') diff --git a/robot/problems/introduction/sl.py b/robot/problems/introduction/sl.py new file mode 100644 index 0000000..24a72ca --- /dev/null +++ b/robot/problems/introduction/sl.py @@ -0,0 +1,2 @@ +name = 'Uvod' +description = 'Premikanje in zaznavanje.' -- cgit v1.2.1 From 91962ece64d200dcb93ce4a549c98bf4f94a22f7 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sun, 13 Dec 2015 18:17:41 +0100 Subject: Tweak robot "no hint" message --- robot/sl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'robot') diff --git a/robot/sl.py b/robot/sl.py index 9ffcc40..daf0496 100644 --- a/robot/sl.py +++ b/robot/sl.py @@ -5,7 +5,7 @@ description = 'Uvodni tečaj za robota.' hint = { 'no_hint': ['''\ -

Namig ne obstaja! Poskusi uporabiti misli.

+

Namig ne obstaja!

'''], 'system_error': ['''\ -- cgit v1.2.1 From be94b55b835283de53c686343164641e15abe806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=BDabkar?= Date: Mon, 14 Dec 2015 12:44:58 +0100 Subject: Zadnje spremembe pred zagovorom. --- robot/problems/introduction/circle20/sl.py | 8 ++++++++ robot/problems/introduction/countlines/common.py | 3 +-- robot/problems/introduction/countlines/naloga10_countLines.py | 3 +-- robot/problems/introduction/followline/naloga12_followLine.py | 3 +-- robot/problems/introduction/mindstorms_widgets_OLD.py | 1 + robot/problems/introduction/printcolors/naloga09_printColors.py | 3 +-- robot/problems/introduction/rotateback/common.py | 1 - robot/problems/introduction/rotateback/naloga11_rotateBack.py | 3 +-- robot/problems/introduction/wall1m/common.py | 3 +-- 9 files changed, 15 insertions(+), 13 deletions(-) (limited to 'robot') diff --git a/robot/problems/introduction/circle20/sl.py b/robot/problems/introduction/circle20/sl.py index 219f9c7..abe70eb 100644 --- a/robot/problems/introduction/circle20/sl.py +++ b/robot/problems/introduction/circle20/sl.py @@ -24,3 +24,11 @@ hint = { '''

Za dani polmer izmeri čas, ki ga robot potrebuje za en obhod.

''', '''

robot.move_steering( 'on_for_seconds', direction=0, seconds=3 ).

'''], } + +plan = [ '''\ +

1) Naredi robota

+''', +''' + +''' +] diff --git a/robot/problems/introduction/countlines/common.py b/robot/problems/introduction/countlines/common.py index 5b8db2e..6a50988 100644 --- a/robot/problems/introduction/countlines/common.py +++ b/robot/problems/introduction/countlines/common.py @@ -11,8 +11,7 @@ visible = True solution = '''\ import time -from ev3dev import * -from mindstorms_widgets import mindstorms_widgets +from mindstorms_widgets import * color_table = ['none', 'black', 'blue', 'green', 'yellow', 'red', 'white', 'brown'] diff --git a/robot/problems/introduction/countlines/naloga10_countLines.py b/robot/problems/introduction/countlines/naloga10_countLines.py index d1a8326..7079f7c 100644 --- a/robot/problems/introduction/countlines/naloga10_countLines.py +++ b/robot/problems/introduction/countlines/naloga10_countLines.py @@ -7,8 +7,7 @@ Naloga 10: """ import time -from ev3dev import * -from mindstorms_widgets import mindstorms_widgets +from mindstorms_widgets import * color_table = ['none', 'black', 'blue', 'green', 'yellow', 'red', 'white', 'brown'] diff --git a/robot/problems/introduction/followline/naloga12_followLine.py b/robot/problems/introduction/followline/naloga12_followLine.py index 347e89e..e6e19a0 100644 --- a/robot/problems/introduction/followline/naloga12_followLine.py +++ b/robot/problems/introduction/followline/naloga12_followLine.py @@ -8,8 +8,7 @@ Naloga 12: import sys sys.path.append('/home/user/codeq') import time -from ev3dev import * -from mindstorms_widgets import mindstorms_widgets +from mindstorms_widgets import * robot = mindstorms_widgets() robot.connect_motor( 'left' ) diff --git a/robot/problems/introduction/mindstorms_widgets_OLD.py b/robot/problems/introduction/mindstorms_widgets_OLD.py index 4151133..f69f5c7 100644 --- a/robot/problems/introduction/mindstorms_widgets_OLD.py +++ b/robot/problems/introduction/mindstorms_widgets_OLD.py @@ -302,6 +302,7 @@ class mindstorms_widgets: if mode == 'on' and pulse: self._led_pulse( color ) pass + # the sensor should be perfectly still while resetting the gyro def resetGyro(self): self.gs.mode = 'GYRO-RATE' diff --git a/robot/problems/introduction/printcolors/naloga09_printColors.py b/robot/problems/introduction/printcolors/naloga09_printColors.py index 59dfdb0..2e9d323 100644 --- a/robot/problems/introduction/printcolors/naloga09_printColors.py +++ b/robot/problems/introduction/printcolors/naloga09_printColors.py @@ -17,8 +17,7 @@ Naloga 9: import sys sys.path.append('/home/user/codeq') import time -from ev3dev import * -from mindstorms_widgets import mindstorms_widgets +from mindstorms_widgets import * color_table = ['none', 'black', 'blue', 'green', 'yellow', 'red', 'white', 'brown'] diff --git a/robot/problems/introduction/rotateback/common.py b/robot/problems/introduction/rotateback/common.py index 10cca87..2dacaf3 100644 --- a/robot/problems/introduction/rotateback/common.py +++ b/robot/problems/introduction/rotateback/common.py @@ -10,7 +10,6 @@ number = 11 visible = True solution = '''\ -from ev3dev import * from mindstorms_widgets import mindstorms_widgets def sgn(x): diff --git a/robot/problems/introduction/rotateback/naloga11_rotateBack.py b/robot/problems/introduction/rotateback/naloga11_rotateBack.py index 0bab735..2677f05 100644 --- a/robot/problems/introduction/rotateback/naloga11_rotateBack.py +++ b/robot/problems/introduction/rotateback/naloga11_rotateBack.py @@ -2,12 +2,11 @@ # coding=utf-8 print (""" -Naloga 11: +Naloga 11: Robot naj drži smer - če ga obrnemo iz začetne smeri, naj se zasuka nazaj v prvotno smer. Ob pritisku na stikalo, naj se resetira (smer nastavi na 0). """) import sys sys.path.append('/home/user/codeq') import time -from ev3dev import * from mindstorms_widgets import mindstorms_widgets def sgn(x): diff --git a/robot/problems/introduction/wall1m/common.py b/robot/problems/introduction/wall1m/common.py index 07d1e1a..4492cdc 100644 --- a/robot/problems/introduction/wall1m/common.py +++ b/robot/problems/introduction/wall1m/common.py @@ -10,8 +10,7 @@ number = 6 visible = True solution = '''\ -from ev3dev import * -from mindstorms_widgets import mindstorms_widgets +from mindstorms_widgets import * robot = mindstorms_widgets() robot.connect_motor( 'left' ) -- cgit v1.2.1 From b4e46b75f5e2a890b41d2e20a89767590e54ccb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=BDabkar?= Date: Tue, 15 Dec 2015 10:34:40 +0100 Subject: Dodani plani za robotske probleme. --- robot/problems/introduction/circle20/sl.py | 16 +++++++++------- robot/problems/introduction/countlines/common.py | 1 + robot/problems/introduction/countlines/sl.py | 13 +++++++++++++ robot/problems/introduction/followline/common.py | 8 +++----- robot/problems/introduction/followline/sl.py | 15 +++++++++++++++ robot/problems/introduction/forward/sl.py | 10 ++++++++++ robot/problems/introduction/forward1m/sl.py | 14 ++++++++++++-- robot/problems/introduction/gyro90/common.py | 3 --- robot/problems/introduction/gyro90/sl.py | 11 +++++++++++ robot/problems/introduction/gyrosquare/common.py | 3 --- robot/problems/introduction/gyrosquare/sl.py | 11 +++++++++++ robot/problems/introduction/printcolors/common.py | 2 -- robot/problems/introduction/printcolors/sl.py | 13 +++++++++++++ robot/problems/introduction/rotateback/common.py | 2 -- robot/problems/introduction/rotateback/sl.py | 12 ++++++++++++ robot/problems/introduction/spotturn90/common.py | 5 +---- robot/problems/introduction/spotturn90/sl.py | 11 +++++++++++ robot/problems/introduction/square20/common.py | 3 --- robot/problems/introduction/square20/sl.py | 11 +++++++++++ robot/problems/introduction/wall1m/common.py | 2 -- robot/problems/introduction/wall1m/sl.py | 14 ++++++++++++++ 21 files changed, 147 insertions(+), 33 deletions(-) (limited to 'robot') diff --git a/robot/problems/introduction/circle20/sl.py b/robot/problems/introduction/circle20/sl.py index abe70eb..735458a 100644 --- a/robot/problems/introduction/circle20/sl.py +++ b/robot/problems/introduction/circle20/sl.py @@ -13,7 +13,7 @@ hint = { '''

robot.connect_motor( 'left' ).

'''], 'connectMotorRight':['''

Robotu priključi desni motor

''', '''

robot.connect_motor( 'right' ).

'''], - 'moveSteering':['''

Sinhroniziraj motorja in ju zaženi za 3 sekunde.

''', + 'moveSteering':['''

Sinhroniziraj motorja.

''', '''

Za sinhronizirano vožnjo je najbolj primerna metoda robot.move_steering( ... ).

'''], 'onForSeconds':['''

Prvi argument metode robot.move_steering naj pove, da bo delovanje motorjev časovno omejeno.

''', '''

robot.move_steering('on_for_seconds', ... ).

'''], @@ -25,10 +25,12 @@ hint = { '''

robot.move_steering( 'on_for_seconds', direction=0, seconds=3 ).

'''], } -plan = [ '''\ -

1) Naredi robota

-''', -''' - -''' +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.
  2. +
  3. Nanj povežemo oba pogonska motorja.
  4. +
  5. Izračunamo ostrino zavoja, pri kateri bo robot vozil po krogu s polmerom 20 cm.
  6. +
  7. Sinhronizirano poženemo oba motorja za premik v izračunani smeri in časovno omejimo na en obhod.
  8. +
''' ] diff --git a/robot/problems/introduction/countlines/common.py b/robot/problems/introduction/countlines/common.py index 6a50988..925fc06 100644 --- a/robot/problems/introduction/countlines/common.py +++ b/robot/problems/introduction/countlines/common.py @@ -31,6 +31,7 @@ while time.time()-start < 2.1: stevec += 1 color = c robot.move_steering( 'off' ) + print( "Stevilo crt:", stevec ) ''' diff --git a/robot/problems/introduction/countlines/sl.py b/robot/problems/introduction/countlines/sl.py index 4e1c3d4..1f8ea18 100644 --- a/robot/problems/introduction/countlines/sl.py +++ b/robot/problems/introduction/countlines/sl.py @@ -24,3 +24,16 @@ hint = { '''

Zanka je lahko časovno omejena, npr. z uporabo metode time.time().

''', '''

while time.time()-start < 1.1:.

'''], } + +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.
  2. +
  3. Nanj povežemo oba pogonska motorja.
  4. +
  5. Povežemo barvni senzor.
  6. +
  7. Vklopimo oba motorja tako, da robot vozi naravnost.
  8. +
  9. V zanki naj robot bere barve in jih šteje.
  10. +
  11. Zanka naj se konča po vnaprej določenem času, npr. 3 sekunde.
  12. +
  13. Ustavimo oba motorja.
  14. +
''' +] diff --git a/robot/problems/introduction/followline/common.py b/robot/problems/introduction/followline/common.py index 3e84cd4..46df5c6 100644 --- a/robot/problems/introduction/followline/common.py +++ b/robot/problems/introduction/followline/common.py @@ -11,8 +11,6 @@ visible = True solution = '''\ import time -from ev3dev import * -from mindstorms_widgets import mindstorms_widgets robot = mindstorms_widgets() robot.connect_motor( 'left' ) @@ -21,10 +19,10 @@ robot.connect_sensor( 'color' ) start = time.time() while time.time()-start < 10: - if robot.color_sensor_measure('reflected_light_intensity') < 30: - L, R = 0, 20 + if robot.color_sensor_measure('reflected_light_intensity') < 50: + L, R = 0, 30 else: - L, R = 20, 0 + L, R = 30, 0 robot.move_tank( 'on', lr_power=[L,R]) robot.move_tank( 'off' ) ''' diff --git a/robot/problems/introduction/followline/sl.py b/robot/problems/introduction/followline/sl.py index 848fe2b..cdc6e19 100644 --- a/robot/problems/introduction/followline/sl.py +++ b/robot/problems/introduction/followline/sl.py @@ -32,3 +32,18 @@ hint = { 'if': ['''

V zanki uporabi pogojni stavek...

''', '''

Če robot vidi črto, naj zavije z nje; če vidi podlago, naj zavije proti črti.

'''] } + +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.
  2. +
  3. Nanj povežemo oba pogonska motorja.
  4. +
  5. Povežemo barvni senzor.
  6. +
  7. V zanki preverjamo, kakšno barvo vidi robot s senzorjem.
  8. +
  9. Če vidi črno, naj zavije desno, če vidi belo, naj zavije levo. (Sledi desnemu robu črte).
  10. +
  11. Zanka naj se konča po vnaprej določenem času, 10 sekund.
  12. +
  13. Ustavimo oba motorja.
  14. +
+

Opomba: potrebna je predhodna kalibracija barvnega senzorja.

+''' +] diff --git a/robot/problems/introduction/forward/sl.py b/robot/problems/introduction/forward/sl.py index a6f7e86..cd9b096 100644 --- a/robot/problems/introduction/forward/sl.py +++ b/robot/problems/introduction/forward/sl.py @@ -21,3 +21,13 @@ hint = { 'seconds':['''

Napiši časovno omejitev v sekundah.

''', '''

robot.move_steering( 'on_for_seconds', direction=0, seconds=3 ).

'''], } + +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.
  2. +
  3. Nanj povežemo oba pogonska motorja.
  4. +
  5. Vklopimo oba motorja v sinhronem načinu tako, da robot vozi naravnost.
  6. +
  7. Določimo čas trajanja vožnje 3 sekunde.
  8. +
''' +] diff --git a/robot/problems/introduction/forward1m/sl.py b/robot/problems/introduction/forward1m/sl.py index 8045d58..2240d3c 100644 --- a/robot/problems/introduction/forward1m/sl.py +++ b/robot/problems/introduction/forward1m/sl.py @@ -12,12 +12,22 @@ hint = { '''

robot.connect_motor( 'left' ).

'''], 'connectMotorRight':['''

Robotu priključi desni motor

''', '''

robot.connect_motor( 'right' ).

'''], - 'moveSteering':['''

Sinhroniziraj motorja in ju zaženi za 3 sekunde.

''', + 'moveSteering':['''

Sinhroniziraj motorja in ju zaženi.

''', '''

Za sinhronizirano vožnjo je najbolj primerna metoda robot.move_steering( ... ).

'''], 'onForRotations':['''

Prvi argument metode robot.move_steering naj pove, da bo delovanje motorjev določeno s številom obratov.

''', '''

robot.move_steering('on_for_rotations', ... ).

'''], 'direction':['''

Navedi smer premikanja motorjev, naravnost = 0.

''', '''

robot.move_steering( 'on_for_rotations', direction=0, ... ).

'''], - 'rotations':['''

Določi število obratov; za koliko obratov naj se zavrtita motorja? Izmeri dolžino 1m, izpisuj obrate print(robot.motor['left'].count_per_rot, robot.motor['right'].count_per_rot) in tako določi ustrezno število obratov.

''', + 'rotations':['''

Določi število obratov; za koliko obratov naj se zavrtita motorja? Izmeri obseg kolesa in preračunaj, koliko obratov je potrebnih za 1m.

''', '''

robot.move_steering( 'on_for_rotations', direction=0, rotations=5 ).

'''], } + +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.
  2. +
  3. Nanj povežemo oba pogonska motorja.
  4. +
  5. Vklopimo oba motorja v sinhronem načinu tako, da robot vozi naravnost.
  6. +
  7. Glede na obseg koles izračunamo, koliko obratov mora narediti kolo na dolžini 1m; ustrezno nastavimo število obratov, po katerih se robot ustavi.
  8. +
''' +] diff --git a/robot/problems/introduction/gyro90/common.py b/robot/problems/introduction/gyro90/common.py index 06b4f1d..78c5dca 100644 --- a/robot/problems/introduction/gyro90/common.py +++ b/robot/problems/introduction/gyro90/common.py @@ -10,9 +10,6 @@ number = 7 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/gyro90/sl.py b/robot/problems/introduction/gyro90/sl.py index 0a82c6d..c0f9451 100644 --- a/robot/problems/introduction/gyro90/sl.py +++ b/robot/problems/introduction/gyro90/sl.py @@ -27,3 +27,14 @@ hint = { 'while':['''

Program naj teče dokler je kot zasuka manjši od 90 stopinj.

''', '''

robot.gyro_sensor_measure() < 90:

'''], } + +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.
  2. +
  3. Nanj povežemo oba pogonska motorja.
  4. +
  5. Povežemo žiroskop in ga resetiramo.
  6. +
  7. Vklopimo oba motorja tako, da se vrtita z enako močjo, a v različnih smereh; robot se začne obračati na mestu.
  8. +
  9. V zanki merimo kot zasuka in zanko končamo, ko kot doseže 90 stopinj.
  10. +
''' +] diff --git a/robot/problems/introduction/gyrosquare/common.py b/robot/problems/introduction/gyrosquare/common.py index 5bf6068..872f436 100644 --- a/robot/problems/introduction/gyrosquare/common.py +++ b/robot/problems/introduction/gyrosquare/common.py @@ -10,9 +10,6 @@ number = 8 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/gyrosquare/sl.py b/robot/problems/introduction/gyrosquare/sl.py index 16b2c94..7d1f832 100644 --- a/robot/problems/introduction/gyrosquare/sl.py +++ b/robot/problems/introduction/gyrosquare/sl.py @@ -36,3 +36,14 @@ hint = { 'seconds':['''

Napiši časovno omejitev v sekundah.

''', '''

robot.move_steering( 'on_for_seconds', direction=0, seconds=3 ).

'''], } + +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.
  2. +
  3. Nanj povežemo oba pogonska motorja.
  4. +
  5. Povežemo žiroskop in ga resetiramo.
  6. +
  7. Napišemo funkcijo, ki robota pelje naravnost po stranici, nato pa ga na mestu obrne za 90 stopinj.
  8. +
  9. Zgornja funkcijo pokličemo 4-krat zaporedoma.
  10. +
''' +] diff --git a/robot/problems/introduction/printcolors/common.py b/robot/problems/introduction/printcolors/common.py index 4377c57..9b06575 100644 --- a/robot/problems/introduction/printcolors/common.py +++ b/robot/problems/introduction/printcolors/common.py @@ -11,8 +11,6 @@ visible = True solution = '''\ import time -from ev3dev import * -from mindstorms_widgets import mindstorms_widgets color_table = ['none', 'black', 'blue', 'green', 'yellow', 'red', 'white', 'brown'] diff --git a/robot/problems/introduction/printcolors/sl.py b/robot/problems/introduction/printcolors/sl.py index d233b0e..c705eaa 100644 --- a/robot/problems/introduction/printcolors/sl.py +++ b/robot/problems/introduction/printcolors/sl.py @@ -34,3 +34,16 @@ hint = { '''

while time.time()-start < 1.1:.

'''], 'print':['''

V zanki na zaslon izpisuj barvo, ki jo zazna robot.

'''] } + +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.
  2. +
  3. Nanj povežemo oba pogonska motorja.
  4. +
  5. Povežemo barvni senzor.
  6. +
  7. Vklopimo oba motorja tako, da robot vozi naravnost.
  8. +
  9. V zanki naj robot bere barve in vsako izpiše na zaslon.
  10. +
  11. Zanka naj se konča po vnaprej določenem času, npr. 3 sekunde.
  12. +
  13. Ustavimo oba motorja.
  14. +
''' +] diff --git a/robot/problems/introduction/rotateback/common.py b/robot/problems/introduction/rotateback/common.py index 2dacaf3..7c8ce44 100644 --- a/robot/problems/introduction/rotateback/common.py +++ b/robot/problems/introduction/rotateback/common.py @@ -10,8 +10,6 @@ number = 11 visible = True solution = '''\ -from mindstorms_widgets import mindstorms_widgets - def sgn(x): return -1 if x<0 else (1 if x>0 else 0) diff --git a/robot/problems/introduction/rotateback/sl.py b/robot/problems/introduction/rotateback/sl.py index 269ea34..3242a80 100644 --- a/robot/problems/introduction/rotateback/sl.py +++ b/robot/problems/introduction/rotateback/sl.py @@ -31,3 +31,15 @@ hint = { 'while':['''

Program naj teče v neskončni zanki.

''', '''

while 1:

'''], } + +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.
  2. +
  3. Nanj povežemo oba pogonska motorja.
  4. +
  5. Robotu dodamo žiroskop in ga resetiramo.
  6. +
  7. Robotu dodamo stikalo.
  8. +
  9. V neskončni zanki beremo vrednost kota z žiroskopom.
  10. +
  11. Glede na zasuk iz začetne lege, robota na mestu obrnemo v začetno smer.
  12. +
''' +] diff --git a/robot/problems/introduction/spotturn90/common.py b/robot/problems/introduction/spotturn90/common.py index add6643..e01de39 100644 --- a/robot/problems/introduction/spotturn90/common.py +++ b/robot/problems/introduction/spotturn90/common.py @@ -10,9 +10,6 @@ number = 3 visible = True solution = '''\ -from ev3dev import * -from mindstorms_widgets import mindstorms_widgets - robot = mindstorms_widgets() robot.connect_motor( 'left' ) robot.connect_motor( 'right' ) @@ -30,7 +27,7 @@ hint_type = { 'seconds': Hint('seconds'), } -def hint( code): +def hint( code ): tokens = get_tokens(code) # if code does not include mindstorms_widgets(), a student gets a hint that the robot should be somehow represented in the program diff --git a/robot/problems/introduction/spotturn90/sl.py b/robot/problems/introduction/spotturn90/sl.py index fe477aa..e3541c0 100644 --- a/robot/problems/introduction/spotturn90/sl.py +++ b/robot/problems/introduction/spotturn90/sl.py @@ -19,3 +19,14 @@ hint = { 'seconds':['''

Napiši časovno omejitev v sekundah.

''', '''

robot.move_tank( 'on_for_seconds', ..., seconds=... ).

'''], } + +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.
  2. +
  3. Nanj povežemo oba pogonska motorja.
  4. +
  5. Povežemo barvni senzor.
  6. +
  7. Vklopimo oba motorja tako, da se z enako močjo vrtita v različnih smereh.
  8. +
  9. Motorja izlopimo po pretečenem času, ki pri izbrani moči obrne robota za 90 stopinj.
  10. +
''' +] diff --git a/robot/problems/introduction/square20/common.py b/robot/problems/introduction/square20/common.py index a293712..ce8bc14 100644 --- a/robot/problems/introduction/square20/common.py +++ b/robot/problems/introduction/square20/common.py @@ -10,9 +10,6 @@ number = 4 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/square20/sl.py b/robot/problems/introduction/square20/sl.py index f52ddf7..50b335f 100644 --- a/robot/problems/introduction/square20/sl.py +++ b/robot/problems/introduction/square20/sl.py @@ -27,3 +27,14 @@ hint = { 'lrPower': ['''

Za obrat na mestu se morata kolesi vrteti z enako močjo in v nasprotni smeri.

''', '''

robot.move_tank( 'on_for_seconds', lr_power=[20,-20], seconds=.95 ).

'''], } + +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.
  2. +
  3. Nanj povežemo oba pogonska motorja.
  4. +
  5. Vklopimo oba motorja tako, da robot vozi naravnost.
  6. +
  7. Robot se na mestu obrne za 90 stopinj; motorja z enako močjo, v različnih smereh.
  8. +
  9. Še 3-krat ponovimo koraka 3 in 4.
  10. +
''' +] diff --git a/robot/problems/introduction/wall1m/common.py b/robot/problems/introduction/wall1m/common.py index 4492cdc..42b4067 100644 --- a/robot/problems/introduction/wall1m/common.py +++ b/robot/problems/introduction/wall1m/common.py @@ -10,8 +10,6 @@ number = 6 visible = True solution = '''\ -from mindstorms_widgets import * - robot = mindstorms_widgets() robot.connect_motor( 'left' ) robot.connect_motor( 'right' ) diff --git a/robot/problems/introduction/wall1m/sl.py b/robot/problems/introduction/wall1m/sl.py index 18518d5..cbb27ed 100644 --- a/robot/problems/introduction/wall1m/sl.py +++ b/robot/problems/introduction/wall1m/sl.py @@ -29,3 +29,17 @@ hint = { 'while':['''

Uporabi zanko: robot naj se pelje naprej, dokler ne pride do razdalje 50 cm od zida.

''', '''

Uporabi še eno zanko: robot naj se pelje naprej z 20% močjo, dokler ne pride do razdalje 20 cm od zida.

'''], } + +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. Naredimo objekt mindstorms_widgets(), s katerim predstavimo robota.
  2. +
  3. Nanj povežemo oba pogonska motorja.
  4. +
  5. Robotu dodamo ultrazvočni senzor.
  6. +
  7. Vklopimo oba motorja tako, da robot vozi naravnost; moč nastavimo na 80.
  8. +
  9. V zanki merimo razdaljo z UZ senzorjem; zanko končamo, ko je razdalja <50 cm.
  10. +
  11. Moč motorjev nastavimo na 20.
  12. +
  13. V zanki merimo razdaljo z UZ senzorjem; zanko končamo, ko je razdalja <20 cm.
  14. +
  15. Ustavimo oba motorja.
  16. +
''' +] -- cgit v1.2.1 From 6cfee9293d18efed76dc2c83d7a00b1b40230bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=BDabkar?= Date: Tue, 15 Dec 2015 10:49:23 +0100 Subject: Popravek v namigu za problem followline --- robot/problems/introduction/followline/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'robot') diff --git a/robot/problems/introduction/followline/common.py b/robot/problems/introduction/followline/common.py index 46df5c6..e28ca35 100644 --- a/robot/problems/introduction/followline/common.py +++ b/robot/problems/introduction/followline/common.py @@ -59,13 +59,13 @@ def hint( code): if not (has_token_sequence(tokens, ['connect_sensor', '(' ]) and 'color' in code): return [{'id': 'connectColorSensor'}] - if not (has_token_sequence(tokens, ['move_steering', '(']) and 'on' in code): + if not (has_token_sequence(tokens, ['move_tank', '(']) and 'on' in code): return [{'id': 'moveTankOn'}] if not 'lr_power' in code: return [{'id': 'lrPower'}] - if not (has_token_sequence(tokens, ['move_steering', '(']) and 'off' in code): + if not (has_token_sequence(tokens, ['move_tank', '(']) and 'off' in code): return [{'id': 'moveTankOff'}] if not (has_token_sequence(tokens, ['color_sensor_measure', '(']) and 'reflected_light_intensity' in code): -- cgit v1.2.1 From 0883cb2a6b0bac23bd7553618f4e8db7c882a757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=BDabkar?= Date: Tue, 15 Dec 2015 13:13:49 +0100 Subject: Popravki programov pred zagovorom projekta. --- robot/problems/introduction/circle20/common.py | 5 +---- robot/problems/introduction/countlines/common.py | 3 +-- robot/problems/introduction/forward/common.py | 3 --- robot/problems/introduction/forward1m/common.py | 3 --- robot/problems/introduction/gyro90/common.py | 4 ++-- robot/problems/introduction/gyrosquare/common.py | 23 +++++++++++++---------- robot/problems/introduction/printcolors/common.py | 2 +- robot/problems/introduction/wall1m/common.py | 4 ++-- 8 files changed, 20 insertions(+), 27 deletions(-) (limited to 'robot') 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/countlines/common.py b/robot/problems/introduction/countlines/common.py index 925fc06..6d2bf13 100644 --- a/robot/problems/introduction/countlines/common.py +++ b/robot/problems/introduction/countlines/common.py @@ -11,7 +11,6 @@ visible = True solution = '''\ import time -from mindstorms_widgets import * color_table = ['none', 'black', 'blue', 'green', 'yellow', 'red', 'white', 'brown'] @@ -24,7 +23,7 @@ robot.move_steering( 'on' ) start = time.time() stevec = 0 color = -1 -while time.time()-start < 2.1: +while time.time()-start < 1.2: c = robot.color_sensor_measure( 'color' ) # values: 0-7 see the scale above if c!=color: if c!=6 and c!=0: diff --git a/robot/problems/introduction/forward/common.py b/robot/problems/introduction/forward/common.py index 5a46d86..0793d72 100644 --- a/robot/problems/introduction/forward/common.py +++ b/robot/problems/introduction/forward/common.py @@ -9,9 +9,6 @@ number = 1 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/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/gyro90/common.py b/robot/problems/introduction/gyro90/common.py index 78c5dca..1828001 100644 --- a/robot/problems/introduction/gyro90/common.py +++ b/robot/problems/introduction/gyro90/common.py @@ -18,11 +18,11 @@ robot.connect_sensor( 'gyro' ) robot.gyro_set_mode( 'angle' ) robot.reset_gyro() -power = 15 +power = 10 robot.move_tank( 'on', lr_power=[power,-power] ) while robot.gyro_sensor_measure() < 90: pass -robot.move_tank( 'off' ) +robot.move_tank( 'off', brake_at_end=True ) ''' hint_type = { diff --git a/robot/problems/introduction/gyrosquare/common.py b/robot/problems/introduction/gyrosquare/common.py index 872f436..79ae131 100644 --- a/robot/problems/introduction/gyrosquare/common.py +++ b/robot/problems/introduction/gyrosquare/common.py @@ -10,26 +10,29 @@ number = 8 visible = True solution = '''\ +import time + robot = mindstorms_widgets() robot.connect_motor( 'left' ) robot.connect_motor( 'right' ) robot.connect_sensor( 'gyro' ) robot.gyro_set_mode( 'angle' ) -robot.reset_gyro() -power = 20 -def forward_and_turnRight(power, angle): - robot.move_steering( 'on_for_seconds', direction=0, power=power, seconds=2 ) +def forward_and_turnRight(power=10, angle=90): + robot.move_steering( 'on_for_seconds', direction=0, power=power, seconds=5 ) + time.sleep(.5) + robot.reset_gyro() + robot.gyro_set_mode( 'angle' ) + print(robot.gyro_sensor_measure( )) robot.move_tank( 'on', lr_power=[power,-power] ) - while robot.gyro_sensor_measure( 'angle' ) < angle: + while robot.gyro_sensor_measure( ) < angle: pass - robot.move_tank( 'off' ) + robot.move_tank( 'off', brake_at_end=True ) + print(robot.gyro_sensor_measure( )) -forward_and_turnRight(power, 89) -forward_and_turnRight(power, 179) -forward_and_turnRight(power, 269) -forward_and_turnRight(power, 359) +for i in range(4): + forward_and_turnRight() ''' hint_type = { diff --git a/robot/problems/introduction/printcolors/common.py b/robot/problems/introduction/printcolors/common.py index 9b06575..79f4d2a 100644 --- a/robot/problems/introduction/printcolors/common.py +++ b/robot/problems/introduction/printcolors/common.py @@ -22,7 +22,7 @@ robot.connect_sensor( 'color' ) robot.move_steering( 'on') start = time.time() color = -1 -while time.time()-start < 2.1: +while time.time()-start < 1.2: c = robot.color_sensor_measure('color') if c!=color: print( c, color_table[c]) diff --git a/robot/problems/introduction/wall1m/common.py b/robot/problems/introduction/wall1m/common.py index 42b4067..e8a5917 100644 --- a/robot/problems/introduction/wall1m/common.py +++ b/robot/problems/introduction/wall1m/common.py @@ -15,10 +15,10 @@ robot.connect_motor( 'left' ) robot.connect_motor( 'right' ) robot.connect_sensor( 'ultrasonic' ) robot.move_steering( 'on', power=80 ) -while robot.ultrasonic_sensor_measure( 'distance-cm' ) > 500: +while robot.ultrasonic_sensor_measure( 'distance-cm' ) > 50: pass robot.move_steering( 'on', power=20 ) -while robot.ultrasonic_sensor_measure( 'distance-cm' ) > 200: +while robot.ultrasonic_sensor_measure( 'distance-cm' ) > 20: pass robot.move_steering( 'off' ) ''' -- cgit v1.2.1 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/en.py | 42 ++++++++++++++++++++++++ robot/problems/introduction/circle20/en.py | 22 +++++++++++-- robot/problems/introduction/countlines/common.py | 6 ++-- robot/problems/introduction/countlines/en.py | 25 +++++++++++++- robot/problems/introduction/en.py | 2 ++ robot/problems/introduction/followline/en.py | 34 ++++++++++++++++++- robot/problems/introduction/forward/en.py | 17 +++++++++- robot/problems/introduction/forward1m/en.py | 21 ++++++++++-- robot/problems/introduction/forward1m/sl.py | 2 +- 9 files changed, 160 insertions(+), 11 deletions(-) create mode 100644 robot/problems/introduction/en.py (limited to 'robot') diff --git a/robot/en.py b/robot/en.py index f296516..61314e9 100644 --- a/robot/en.py +++ b/robot/en.py @@ -3,5 +3,47 @@ name = 'Robot' description = 'Introductory Robot course.' + hint = { + 'init':['''

In code the robot is represented by mindstorms_widgets(): robot = mindstorms_widgets().

'''], + 'connectMotorLeft':['''

Connect the left motor to the robot.

''', + '''

robot.connect_motor( 'left' ).

'''], + 'connectMotorRight':['''

Connect the right motor to the robot.

''', + '''

robot.connect_motor( 'right' ).

'''], + 'moveSteering':['''

Synchronize the motors.

''', + '''

Use move_steering method for synchonization robot.move_steering( ... ).

'''], + 'moveSteeringOff':['''

Stop the motors.

''', + '''

robot.move_steering( 'off' ).

'''], + 'onForSeconds':['''

The first argument of robot.move_steering should specify that the motors will run for a certain amount of time.

''', + '''

robot.move_steering('on_for_seconds', ... ).

'''], + 'direction':['''

Define the direction of moving; negative/positive values represent a left/right turn.

'''], + 'seconds':['''

Determine the running time of the motors.

'''], + 'connectColorSensor':['''

Connect the color sensor to the robot.

''', + '''

robot.connect_sensor( 'color' ).

'''], + 'colorSensorMeasure':['''

While the robot is moving forward, it should use the color sensor in 'color' mode to recognize the colors.

''', + '''

robot.color_sensor_measure( 'color' ).

'''], + 'colorSensorMeasureRLI':['''

Use the color sensor in 'reflected_light_intensity' mode.

''', + '''

robot.color_sensor_measure( 'reflected_light_intensity' ).

'''], + 'moveTankOn':['''

Use the method for separate motor control, to set each motor's power separately.

''', + '''

The most appropriate for this is robot.move_tank( ... ).

''', + '''

robot.move_tank( 'on', ...)

'''], + 'lrPower': ['''

Set the powers of the left and right motor.

''', + '''

robot.move_tank( 'on', lr_power=[ ... ])

'''], + 'moveTankOff': ['''Stop the robot.''', + '''

robot.move_tank( 'off' )

'''], + 'onForRotations':['''

Set the first argument of robot.move_steering method so that the motors will run for the specified number of rotations.

''', + '''

robot.move_steering('on_for_rotations', ... ).

'''], + 'rotations':['''

Determine the number of rotations; how many turns should the motors do in a meter? Measure the circumference of the wheel and compute the number of rotations per meter.

''', + '''

robot.move_steering( 'on_for_rotations', direction=0, rotations=5 ).

'''], + 'no_hint': ['''\ +

No hint here!

+'''], + + 'system_error': ['''\ +

System error: [%=message%].

+'''], + + 'test_results': ['''\ +

Your program passed [%=passed%] / [%=total%] tests.

+'''], } diff --git a/robot/problems/introduction/circle20/en.py b/robot/problems/introduction/circle20/en.py index 8210d71..c677cce 100644 --- a/robot/problems/introduction/circle20/en.py +++ b/robot/problems/introduction/circle20/en.py @@ -7,8 +7,26 @@ name = 'Circle 20 cm' slug = 'Circle 20 cm' description = '''\ -''' +

Write a program that will make the robot drive in circle (r=20cm) and stop after one loop.

''' 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']+['''

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.

''', + '''

robot.move_steering( 'on_for_seconds', direction=20, ... ).

'''], + 'seconds':mod.hint['seconds']+['''

Experimentally determine the time (in seconds) the robot needs for one loop.

''', + '''

robot.move_steering( 'on_for_seconds', direction=0, seconds=3 ).

'''], } + +plan = ['''\ +

The program should:

+
    +
  1. create a mindstorms_widgets() object, which represents the robot in your code.
  2. +
  3. connect the driving motors.
  4. +
  5. calculate the turn so that the robot would drive in circle with radius 20 cm.
  6. +
  7. synchronize the motors and run them for a specified time, so that the robot stops after one round.
  8. +
''' +] diff --git a/robot/problems/introduction/countlines/common.py b/robot/problems/introduction/countlines/common.py index 6d2bf13..bf5343b 100644 --- a/robot/problems/introduction/countlines/common.py +++ b/robot/problems/introduction/countlines/common.py @@ -21,17 +21,17 @@ robot.connect_sensor( 'color' ) robot.move_steering( 'on' ) start = time.time() -stevec = 0 +counter = 0 color = -1 while time.time()-start < 1.2: c = robot.color_sensor_measure( 'color' ) # values: 0-7 see the scale above if c!=color: if c!=6 and c!=0: - stevec += 1 + counter += 1 color = c robot.move_steering( 'off' ) -print( "Stevilo crt:", stevec ) +print( "Number of lines:", counter ) ''' hint_type = { diff --git a/robot/problems/introduction/countlines/en.py b/robot/problems/introduction/countlines/en.py index 8b3b275..009a752 100644 --- a/robot/problems/introduction/countlines/en.py +++ b/robot/problems/introduction/countlines/en.py @@ -7,8 +7,31 @@ name = 'Count lines' slug = 'Count lines' description = '''\ + Write a program to count the color lines on white background using the robot with a color sensor. The robot should drive forward, crossing the lines and count them. ''' 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'], + 'colorSensorMeasure':mod.hint['colorSensorMeasure'], + 'while':['''

Use the while loop: inside, the robot should read the current color and increase the counter when the color changes.

''', + '''

Interrupt the loop after a certain amount of time; determine the time the robot needs to drive over all the colors experimentally; use time.time().

''', + '''

while time.time()-start < 1.5:.

'''], } + +plan = ['''\ +

The program should:

+
    +
  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. synchronize the motors and run them so that the robot would move forward.
  8. +
  9. inside the loop, let the robot recognize colors and increase the counter.
  10. +
  11. interrupt the loop after a certain amount of time.
  12. +
  13. stop the motors.
  14. +
''' +] diff --git a/robot/problems/introduction/en.py b/robot/problems/introduction/en.py new file mode 100644 index 0000000..5236b4e --- /dev/null +++ b/robot/problems/introduction/en.py @@ -0,0 +1,2 @@ +name = 'Introduction' +description = 'Motors and sensors.' 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 diff --git a/robot/problems/introduction/forward/en.py b/robot/problems/introduction/forward/en.py index be73921..5f78d57 100644 --- a/robot/problems/introduction/forward/en.py +++ b/robot/problems/introduction/forward/en.py @@ -8,5 +8,20 @@ description = '''\ ''' 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']+['''

robot.move_steering( 'on_for_seconds', direction=0, ... ).

'''], + 'seconds':mod.hint['seconds']+['''

robot.move_steering( 'on_for_seconds', direction=0, seconds=3 ).

'''], } + +plan = ['''\ +

The program should:

+
    +
  1. create a mindstorms_widgets() object, which represents the robot in your code.
  2. +
  3. connect the driving motors.
  4. +
  5. synchronize the motors and run them so that the robot would move forward for 3 seconds.
  6. +
''' +] \ No newline at end of file diff --git a/robot/problems/introduction/forward1m/en.py b/robot/problems/introduction/forward1m/en.py index bdf2a45..f923059 100644 --- a/robot/problems/introduction/forward1m/en.py +++ b/robot/problems/introduction/forward1m/en.py @@ -7,9 +7,26 @@ 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']+['''

robot.move_steering( '...', direction=0, ... ).

'''], + 'seconds':mod.hint['seconds']+['''

robot.move_steering( 'on_for_seconds', direction=0, seconds=3 ).

'''], + 'rotations':mod.hint['rotations'], } + +plan = ['''\ +

Program izvedemo v naslednjih korakih:

+
    +
  1. create a mindstorms_widgets() object, which represents the robot in your code.
  2. +
  3. connect the driving motors.
  4. +
  5. measure the circumference of robot's wheels and compute the number of rotations per meter.
  6. +
  7. synchronize the motors and run them so that the robot would move forward for computed number of rotations.
  8. +
''' +] diff --git a/robot/problems/introduction/forward1m/sl.py b/robot/problems/introduction/forward1m/sl.py index 2240d3c..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 = '''\ -

Napiši program, da bo robot peljal naravnost naprej 3 sekunde in se nato ustavil.

''' +

Napiši program, da bo robot peljal 1 meter naravnost in se nato ustavil.

''' hint = { 'mW_init':['''

Robota v programu predstavimo z mindstorms_widgets(): robot = mindstorms_widgets().

'''], -- cgit v1.2.1 From bebd9806a957cd91fe0e507091bc7d0fd385f865 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 23 Dec 2015 14:57:52 +0100 Subject: Fix: import robot hints from the correct directory --- robot/problems/introduction/circle20/en.py | 2 +- robot/problems/introduction/countlines/en.py | 2 +- robot/problems/introduction/followline/en.py | 4 ++-- robot/problems/introduction/forward/en.py | 5 ++++- robot/problems/introduction/forward1m/en.py | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) (limited to 'robot') diff --git a/robot/problems/introduction/circle20/en.py b/robot/problems/introduction/circle20/en.py index c677cce..d2c410c 100644 --- a/robot/problems/introduction/circle20/en.py +++ b/robot/problems/introduction/circle20/en.py @@ -1,6 +1,6 @@ # 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' diff --git a/robot/problems/introduction/countlines/en.py b/robot/problems/introduction/countlines/en.py index 009a752..7655b21 100644 --- a/robot/problems/introduction/countlines/en.py +++ b/robot/problems/introduction/countlines/en.py @@ -1,6 +1,6 @@ # coding=utf-8 import server -mod = server.problems.load_language('python', 'en') +mod = server.problems.load_language('robot', 'en') id = 206 name = 'Count lines' diff --git a/robot/problems/introduction/followline/en.py b/robot/problems/introduction/followline/en.py index 1551d1b..9a588bc 100644 --- a/robot/problems/introduction/followline/en.py +++ b/robot/problems/introduction/followline/en.py @@ -1,6 +1,6 @@ # coding=utf-8 import server -mod = server.problems.load_language('python', 'en') +mod = server.problems.load_language('robot', 'en') id = 207 name = 'Line following' @@ -43,4 +43,4 @@ plan = ['''\

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

''' -] \ No newline at end of file +] diff --git a/robot/problems/introduction/forward/en.py b/robot/problems/introduction/forward/en.py index 5f78d57..400c452 100644 --- a/robot/problems/introduction/forward/en.py +++ b/robot/problems/introduction/forward/en.py @@ -1,5 +1,8 @@ # coding=utf-8 +import server +mod = server.problems.load_language('robot', 'en') + name = 'Forward 3s' slug = 'Forward 3s' @@ -24,4 +27,4 @@ plan = ['''\
  • connect the driving motors.
  • synchronize the motors and run them so that the robot would move forward for 3 seconds.
  • ''' -] \ No newline at end of file +] diff --git a/robot/problems/introduction/forward1m/en.py b/robot/problems/introduction/forward1m/en.py index f923059..f47d088 100644 --- a/robot/problems/introduction/forward1m/en.py +++ b/robot/problems/introduction/forward1m/en.py @@ -1,6 +1,6 @@ # coding=utf-8 import server -mod = server.problems.load_language('python', 'en') +mod = server.problems.load_language('robot', 'en') id = 208 name = 'Forward 1m' -- cgit v1.2.1