@@ -55,6 +55,8 @@ def __init__(self, robot_state, robot_pos):
5555 self .right_ts_data = False
5656 self .top_us_data = - 1
5757
58+ self .text_x = self .screen_width - apply_scaling (220 )
59+
5860
5961 def setup (self ):
6062 """
@@ -126,13 +128,12 @@ def _draw_text(self):
126128 message = self .robot_state .next_sound_job ()
127129 sound = message if message else '-'
128130
129- arcade .draw_text (center_cs , self .screen_width - 140 , self .screen_height - 45 , arcade .color .BLACK_LEATHER_JACKET , 10 )
130- arcade .draw_text (left_ts , self .screen_width - 140 , self .screen_height - 60 , arcade .color .BLACK_LEATHER_JACKET , 10 )
131- arcade .draw_text (right_ts , self .screen_width - 140 , self .screen_height - 75 , arcade .color .BLACK_LEATHER_JACKET , 10 )
132- arcade .draw_text (top_us , self .screen_width - 140 , self .screen_height - 90 , arcade .color .BLACK_LEATHER_JACKET , 10 )
133- arcade .draw_text ('Sound:' , self .screen_width - 140 , self .screen_height - 105 , arcade .color .BLACK_LEATHER_JACKET , 10 )
134- arcade .draw_text (sound , self .screen_width - 140 , self .screen_height - 120 , arcade .color .BLACK_LEATHER_JACKET , 10 ,
135- anchor_y = 'top' )
131+ arcade .draw_text (center_cs , self .text_x , self .screen_height - apply_scaling (80 ), arcade .color .BLACK_LEATHER_JACKET , 10 )
132+ arcade .draw_text (left_ts , self .text_x , self .screen_height - apply_scaling (100 ), arcade .color .BLACK_LEATHER_JACKET , 10 )
133+ arcade .draw_text (right_ts , self .text_x , self .screen_height - apply_scaling (120 ), arcade .color .BLACK_LEATHER_JACKET , 10 )
134+ arcade .draw_text (top_us , self .text_x , self .screen_height - apply_scaling (140 ), arcade .color .BLACK_LEATHER_JACKET , 10 )
135+ arcade .draw_text ('Sound:' , self .text_x , self .screen_height - apply_scaling (160 ), arcade .color .BLACK_LEATHER_JACKET , 10 )
136+ arcade .draw_text (sound , self .text_x , self .screen_height - apply_scaling (180 ), arcade .color .BLACK_LEATHER_JACKET , 10 , anchor_y = 'top' )
136137
137138
138139 def update (self , delta_time ):
@@ -182,12 +183,12 @@ def main():
182183 default = 200 ,
183184 help = "Starting position x-coordinate of the robot, default is 200" ,
184185 required = False ,
185- type = int )
186+ type = check_xy )
186187 parser .add_argument ("-y" , "--robot_position_y" ,
187188 default = 300 ,
188189 help = "Starting position y-coordinate of the robot, default is 300" ,
189190 required = False ,
190- type = int )
191+ type = check_xy )
191192 parser .add_argument ("-o" , "--robot_orientation" ,
192193 default = 0 ,
193194 help = "Starting orientation the robot, default is 0" ,
@@ -226,4 +227,16 @@ def check_scale(value):
226227 return f
227228
228229
230+ def check_xy (value ):
231+ try :
232+ f = int (value )
233+ except ValueError :
234+ raise argparse .ArgumentTypeError ('Coordinate value must be a integer' )
235+
236+ if f < 0 or f > 1000 :
237+ raise argparse .ArgumentTypeError ("%s is an invalid coordinate. Should be between 0 and 1000" % f )
238+
239+ return f
240+
241+
229242main ()
0 commit comments