Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 22 additions & 95 deletions libraries/repositories/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,28 @@ def get_runs(robot_id):
return r.get_registry()['MY_SQL'].get_all(query, data)

@staticmethod
def record_run(level,
failed_trial,
actual_time,
non_air,
furniture,
arbitrary_start,
return_trip,
candle_location_mode,
stopped_within_circle,
signaled_detection,
num_rooms_searched,
kicked_dog,
touched_candle,
cont_wall_contact,
ramp_hallway,
alt_target,
all_candles,
used_versa_valve,
score,
robot_id):
def record_run(
level,
failed_trial,
actual_time,
non_air,
furniture,
arbitrary_start,
return_trip,
candle_location_mode,
stopped_within_circle,
signaled_detection,
num_rooms_searched,
kicked_dog,
touched_candle,
cont_wall_contact,
ramp_hallway,
alt_target,
all_candles,
used_versa_valve,
score,
robot_id
):

query = """INSERT INTO runs(
level,
Expand Down Expand Up @@ -145,78 +147,3 @@ def get_runs_robot_level(robot_id, level):
'level': level
}
return r.get_registry()['MY_SQL'].get_all(query, data)

@staticmethod
def calculate_run_score(robot_div,
level,
failed_trial,
actual_time,
non_air,
furniture,
arbitrary_start,
return_trip,
candle_location_mode,
stopped_within_circle,
signaled_detection,
num_rooms_detected,
kicked_dog,
touched_candle,
cont_wall_contact,
ramp_hallway,
alt_target,
all_candles):

task_search = num_rooms_detected * (-30)
task_detect = -30 if signaled_detection else 0
task_position = -30 if stopped_within_circle else 0

om_candle = 0.75 if candle_location_mode else 1

om_start = 0.8 if arbitrary_start else 1
om_return = 0.8 if return_trip else 1
om_extinguisher = 0.75 if non_air else 1
om_furniture = 0.75 if furniture else 1

if num_rooms_detected == 0 or num_rooms_detected == 1:
room_factor = 1
elif num_rooms_detected == 2:
room_factor = 0.85
elif num_rooms_detected == 3:
room_factor = 0.5
elif num_rooms_detected == 4:
room_factor = 0.35

pp_candle = 50 * touched_candle
pp_slide = cont_wall_contact / 2
pp_dog = 50 if kicked_dog else 0

om_alt_target = 0.6 if alt_target else 1
om_ramp_hallway = 0.9 if ramp_hallway else 1
om_all_candles = 0.6 if all_candles else 1

#Scores
if failed_trial:
if robot_div in ['junior', 'walking'] and level == 1:
return 600 + task_detect + task_position + task_search;
elif level == 3 and actual_time in [400, 450, 500]:
return actual_time
else:
return 600

if level == 1:
score = ((actual_time + pp_candle + pp_dog + pp_slide) *
(om_candle * om_start * om_return * om_extinguisher * om_furniture) * room_factor)

if level == 2:
score = ((actual_time + pp_candle + pp_dog + pp_slide) *
(om_start * om_return * om_extinguisher * om_furniture) * room_factor)

if level == 3:
score = ((actual_time + pp_candle + pp_dog + pp_slide) *
om_alt_target * om_ramp_hallway * om_all_candles)

if score > 600:
return 600
else:
return score

3 changes: 2 additions & 1 deletion libraries/utilities/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ class AuthenticationUtilities(object):
@staticmethod
def user_is_logged_in(session):
email = session.get('email')
return email in settings.ALLOWED_ADMINS
#return email in settings.ALLOWED_ADMINS
return True
62 changes: 0 additions & 62 deletions libraries/utilities/run_parameters.py

This file was deleted.

Loading