#NEWLINE# def resetCameraToHeadView( view ) : #NEWLINE# #INDENT# head = robotModel . getLinkFrame ( 'head' ) #NEWLINE# pelvis = robotModel . getLinkFrame ( 'pelvis' ) #NEWLINE# viewDirection = np . array ( [ 1.0 , 0.0 , 0.0 ] ) #NEWLINE# pelvis . TransformVector ( viewDirection , viewDirection ) #NEWLINE# cameraPosition = ( np . array ( head . GetPosition ( ) ) + ( 0.1 * viewDirection ) ) #NEWLINE# camera = view . camera ( ) #NEWLINE# focalOffset = ( np . array ( camera . GetFocalPoint ( ) ) - np . array ( camera . GetPosition ( ) ) ) #NEWLINE# focalOffset /= np . linalg . norm ( view ) #NEWLINE# camera . SetPosition ( cameraPosition ) #NEWLINE# camera . SetFocalPoint ( ( cameraPosition + ( focalOffset * 0.03 ) ) ) #NEWLINE# camera . SetViewUp ( [ 0 , 0 , 1 ] ) #NEWLINE# camera . SetViewAngle ( 90 ) #NEWLINE# view . render ( )