Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b34711ebc6 | ||
|
|
0a0e3db400 |
+16
-4
@@ -3,24 +3,28 @@ import time
|
|||||||
|
|
||||||
class RobotController(object):
|
class RobotController(object):
|
||||||
|
|
||||||
def __init__(self, fire_ext_max_capacity = 5, collision_damage = 1, k_sof = 1, k_cas = 1, k_asset = 1):
|
def __init__(self, fire_ext_max_capacity = 5, collision_damage = 1, k_sof = 1, k_cas = 1, k_asset = 1, k_hp = 1, fall_damage = 10):
|
||||||
|
|
||||||
# STATE VARIABLES
|
# STATE VARIABLES
|
||||||
self._fire_ext_max_capacity = fire_ext_max_capacity
|
self._fire_ext_max_capacity = fire_ext_max_capacity
|
||||||
self._fire_ext_capacity = self._fire_ext_max_capacity
|
self._fire_ext_capacity = self._fire_ext_max_capacity
|
||||||
|
|
||||||
self._hit_points = 100
|
self._start_hp = 100
|
||||||
|
self._hit_points = self._start_hp
|
||||||
self._collision_damage = collision_damage
|
self._collision_damage = collision_damage
|
||||||
self._charge_points = 100
|
self._charge_points = 100
|
||||||
|
self._fall_damage = fall_damage
|
||||||
|
|
||||||
self._collisions = []
|
self._collisions = []
|
||||||
self._exted_sofs = []
|
self._exted_sofs = []
|
||||||
self._found_casualty = []
|
self._found_casualty = []
|
||||||
self._found_assets = []
|
self._found_assets = []
|
||||||
|
self._falls = []
|
||||||
|
|
||||||
self._k_sof = k_sof
|
self._k_sof = k_sof
|
||||||
self._k_cas = k_cas
|
self._k_cas = k_cas
|
||||||
self._k_asset = k_asset
|
self._k_asset = k_asset
|
||||||
|
self._k_hp = k_hp
|
||||||
|
|
||||||
|
|
||||||
''' CONTROL '''
|
''' CONTROL '''
|
||||||
@@ -46,10 +50,14 @@ class RobotController(object):
|
|||||||
def send_pick_asset_cmd(self):
|
def send_pick_asset_cmd(self):
|
||||||
raise NotImplemented("")
|
raise NotImplemented("")
|
||||||
|
|
||||||
def get_score(self, time_stamp):
|
def get_score(self, time_stamp = None):
|
||||||
score = self._k_sof * len(self._exted_sofs) + self._k_cas * len(self._found_casualty) + self.k_assest * len(self._found_assets)
|
score = self._k_sof * len(self._exted_sofs) + self._k_cas * len(self._found_casualty) + self._k_asset * len(self._found_assets) + self._k_hp * self._hit_points
|
||||||
return score
|
return score
|
||||||
|
|
||||||
|
def get_str_status(self):
|
||||||
|
status = f"{type(self).__name__}\n - Total score {self.get_score()}\n - Hit points: {self._hit_points}/{self._start_hp}\n - Extingushed sources of fire {len(self._exted_sofs)}\n - Fire extinguiher capacity {self._fire_ext_capacity}/{self._fire_ext_max_capacity}\n - Collisions {len(self._collisions)}\n - Falls {len(self._falls)}"
|
||||||
|
return status
|
||||||
|
|
||||||
''' EVENTS '''
|
''' EVENTS '''
|
||||||
|
|
||||||
def _register_collision(self, time_stamp):
|
def _register_collision(self, time_stamp):
|
||||||
@@ -68,4 +76,8 @@ class RobotController(object):
|
|||||||
self._found_assets.append((time_stamp,
|
self._found_assets.append((time_stamp,
|
||||||
copy.deepcopy(asset_params)))
|
copy.deepcopy(asset_params)))
|
||||||
|
|
||||||
|
def _register_fall(self, time_stamp):
|
||||||
|
self._falls.append(time_stamp)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user