summaryrefslogtreecommitdiff
path: root/robot/problems
diff options
context:
space:
mode:
authorJure Žabkar <jure.zabkar@fri.uni-lj.si>2015-12-15 13:13:49 +0100
committerJure Žabkar <jure.zabkar@fri.uni-lj.si>2015-12-15 13:17:48 +0100
commit0883cb2a6b0bac23bd7553618f4e8db7c882a757 (patch)
tree37bc932914857cf3572c7961f9b80f336f00988f /robot/problems
parent6cfee9293d18efed76dc2c83d7a00b1b40230bbf (diff)
Popravki programov pred zagovorom projekta.
Diffstat (limited to 'robot/problems')
-rw-r--r--robot/problems/introduction/circle20/common.py5
-rw-r--r--robot/problems/introduction/countlines/common.py3
-rw-r--r--robot/problems/introduction/forward/common.py3
-rw-r--r--robot/problems/introduction/forward1m/common.py3
-rw-r--r--robot/problems/introduction/gyro90/common.py4
-rw-r--r--robot/problems/introduction/gyrosquare/common.py23
-rw-r--r--robot/problems/introduction/printcolors/common.py2
-rw-r--r--robot/problems/introduction/wall1m/common.py4
8 files changed, 20 insertions, 27 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/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' )
'''