#NEWLINE# @ lib . api_call #NEWLINE# def move( self , speed , angle = 0 ) : #NEWLINE# #INDENT# "Move holonomically without rotation.\n\n        :param speed: Magnitude of robot's translation speed (% of max).\n        :type speed: float\n        :param angle: Angle of translation in degrees (90=left, 270=right).\n        :type angle: float\n        " #NEWLINE# self . logger . debug ( 'speed: {}, angle: {}' . format ( speed , angle ) ) #NEWLINE# try : #NEWLINE# #INDENT# assert ( OmniDriver . min_speed <= speed <= OmniDriver . max_speed ) #NEWLINE# #UNINDENT# except AssertionError : #NEWLINE# #INDENT# raise AssertionError ( 'Speed is out of bounds' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# assert ( OmniDriver . min_angle <= angle <= OmniDriver . max_angle ) #NEWLINE# #UNINDENT# except AssertionError : #NEWLINE# #INDENT# raise AssertionError ( 'Angle is out of bounds' ) #NEWLINE# #UNINDENT# if ( speed == 0 ) : #NEWLINE# #INDENT# self . logger . debug ( 'Special case for speed == 0' ) #NEWLINE# self . set_motor ( 'north' , 0 ) #NEWLINE# self . set_motor ( 'south' , 0 ) #NEWLINE# self . set_motor ( 'east' , 0 ) #NEWLINE# self . set_motor ( 'west' , 0 ) #NEWLINE# return #NEWLINE# #UNINDENT# north = ( speed * ( - sin ( ( ( angle * pi ) / 180 ) ) ) ) #NEWLINE# south = ( speed * ( - sin ( ( ( angle * pi ) / 180 ) ) ) ) #NEWLINE# west = ( speed * cos ( ( ( angle * pi ) / 180 ) ) ) #NEWLINE# east = ( speed * cos ( ( ( angle * pi ) / 180 ) ) ) #NEWLINE# self . logger . debug ( 'pre-scale : north: {:6.2f}, south: {:6.2f}, east: {:6.2f}, west: {:6.2f}' . format ( north , south , east , west ) ) #NEWLINE# max_wheel_speed = max ( [ fabs ( north ) , fabs ( south ) , fabs ( east ) , fabs ( west ) ] ) #NEWLINE# north = ( ( north * speed ) / max_wheel_speed ) #NEWLINE# south = ( ( south * speed ) / max_wheel_speed ) #NEWLINE# west = ( ( west * speed ) / max_wheel_speed ) #NEWLINE# east = ( ( east * speed ) / max_wheel_speed ) #NEWLINE# self . logger . debug ( 'post-scale: north: {:6.2f}, south: {:6.2f}, west: {:6.2f}, east: {:6.2f}' . format ( north , south , west , east ) ) #NEWLINE# self . set_motor ( 'north' , north ) #NEWLINE# self . set_motor ( 'south' , south ) #NEWLINE# self . set_motor ( 'west' , west ) #NEWLINE# self . set_motor ( 'east' , max_wheel_speed )