@@ -27,6 +27,7 @@ class to their respecitve classes
2727# this boot cycle. This is to highlight weird behaviour in the arena
2828COPY_STAT_FILE = "/tmp/usb_file_uploaded"
2929
30+
3031def setup_logging (level ):
3132 """Display the just the message when logging events
3233 Sets the logging level to `level`"""
@@ -43,6 +44,7 @@ def setup_logging(level):
4344
4445class NoCameraPresent (Exception ):
4546 """Camera not connected."""
47+
4648 def __str__ (self ):
4749 return "No camera found."
4850
@@ -73,7 +75,8 @@ def __init__(self,
7375 # check if copy stat file exists and read it if it does then delete it
7476 try :
7577 with open (COPY_STAT_FILE , "r" ) as f :
76- _logger .info ("Robot code copied %s from USB\n " , f .read ().strip ())
78+ _logger .info ("Robot code copied %s from USB\n " ,
79+ f .read ().strip ())
7780 os .remove (COPY_STAT_FILE )
7881 except IOError :
7982 pass
@@ -92,8 +95,8 @@ def __init__(self,
9295 self .mode = start_data ['mode' ]
9396 else :
9497 _logger .warning ("Robot initalized but usercode running before"
95- "`robot.wait_start`. Robot will not wait for the "
96- "start button until `robot.wait_start` is called." )
98+ "`robot.wait_start`. Robot will not wait for the "
99+ "start button until `robot.wait_start` is called." )
97100
98101 def subsystem_init (self , camera ):
99102 """Allows for initalisation of subsystems after instansating `Robot()`
@@ -117,7 +120,6 @@ def subsystem_init(self, camera):
117120
118121 self ._vision = vision .Vision (self .zone , camera = self .camera )
119122
120-
121123 def report_hardware_status (self ):
122124 """Print out a nice log message at the start of each robot init with
123125 the hardware status"""
@@ -132,13 +134,14 @@ def report_hardware_status(self):
132134 "changing for a charged battery" )
133135
134136 if self ._gg_version != 3 :
135- self ._warnings .append ("Green Giant version not 3 but instead {}" .format (self ._gg_version ))
136-
137- camera_type_str = "Camera: {}" .format (self .camera .__class__ .__name__ )
137+ self ._warnings .append (
138+ "Green Giant version not 3 but instead {}" .format (self ._gg_version ))
138139
140+ camera_type_str = "Camera: {}" .format (
141+ self .camera .__class__ .__name__ )
139142
140- #Adds the secret poem every now and then!
141- if random .randint (0 ,100 ) == 1 :
143+ # Adds the secret poem every now and then!
144+ if random .randint (0 , 100 ) == 1 :
142145 _logger .info ("Today your task is a challenging one" )
143146 _logger .info ("Gifts for the wizard and deliveries to run" )
144147 _logger .info ("But due to the unfortunate timing you can not go" )
@@ -147,14 +150,17 @@ def report_hardware_status(self):
147150 _logger .info ("Starting in your home (where ever it is found)" )
148151 _logger .info ("Then taking gifts from your robots zone " )
149152 _logger .info ("Delivering it to the wizard on its own" )
150- _logger .info ("To the road is good and to the emerald palace is ideal " )
151- _logger .info ("And if in another country you get some but a point they will steal" )
153+ _logger .info (
154+ "To the road is good and to the emerald palace is ideal " )
155+ _logger .info (
156+ "And if in another country you get some but a point they will steal" )
152157 _logger .info ("There are many things that are to be considered" )
153158 _logger .info ("But remember to bring your gifts for the wizard" )
154159
155160 # print report of hardware
156161 _logger .info ("------HARDWARE REPORT------" )
157- _logger .info ("Time: %s" , datetime .now ().strftime ('%Y-%m-%d %H:%M:%S' ))
162+ _logger .info ("Time: %s" , datetime .now ().strftime (
163+ '%Y-%m-%d %H:%M:%S' ))
158164 _logger .info ("Patch Version: 0" )
159165 _logger .info (battery_str )
160166 _logger .info ("ADC Max: %.2fv" , self ._adc_max )
@@ -267,7 +273,8 @@ def wait_start(self):
267273
268274 if self .startfifo is None :
269275 self ._start_pressed = True
270- _logger .info ("No startfifo so using defaults (Zone: {})" .format (self .zone ))
276+ _logger .info (
277+ "No startfifo so using defaults (Zone: {})" .format (self .zone ))
271278 return
272279
273280 blink_thread = threading .Thread (target = self ._wait_start_blink )
0 commit comments