#NEWLINE# def on_enter( event_data ) : #NEWLINE# #INDENT# ' Adjust pointing.\n\n    * Take 60 second exposure\n    * Call `sync_coordinates`\n        * Plate-solve\n        * Get pointing error\n        * If within `_pointing_threshold`\n            * goto tracking\n        * Else\n            * set set mount target coords to center RA/Dec\n            * sync mount coords\n            * slew to target\n    ' #NEWLINE# pan = event_data . model #NEWLINE# try : #NEWLINE# #INDENT# pan . say ( 'Taking guide picture.' ) #NEWLINE# guide_camera = pan . observatory . get_guide_camera ( ) #NEWLINE# filename = pan . observatory . construct_filename ( guide = True ) #NEWLINE# filename = filename . replace ( 'guide.cr2' , 'guide_{:03.0f}.cr2' . format ( pan . _pointing_iteration ) ) #NEWLINE# pan . logger . debug ( 'Path for guide: {}' . format ( filename ) ) #NEWLINE# guide_image = guide_camera . take_exposure ( seconds = pan . _pointing_exptime , filename = filename ) #NEWLINE# try : #NEWLINE# #INDENT# pan . logger . debug ( 'Waiting for guide image: {}' . format ( guide_image ) ) #NEWLINE# pan . wait_until_files_exist ( guide_image , callback = partial ( sync_coordinates , pan ) , timeout = ( 2 * pan . _pointing_exptime ) ) #NEWLINE# #UNINDENT# except error . Timeout as e : #NEWLINE# #INDENT# pan . logger . warning ( 'Problem taking pointing image' ) #NEWLINE# pan . goto ( 'park' ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# pan . logger . error ( 'Problem waiting for images: {}' . format ( pan ) ) #NEWLINE# pan . goto ( 'park' ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# pan . say ( 'Hmm, I had a problem checking the pointing error. Sending to parking. {}' . format ( e ) ) #NEWLINE# pan . goto ( 'park' )