<s> import sys , rospy , tf , moveit_commander , random <EOL> from geometry_msgs . msg import Pose , Point , Quaternion <EOL> class R2ChessboardWrapper : <EOL> def __init__ ( self ) : <EOL> self . left_arm = moveit_commander . MoveGroupCommander ( "<STR_LIT>" ) <EOL> def setPose ( self , x , y , z , phi , theta , psi ) : <EOL> orient = Quaternion ( * tf . transformations . quaternion_from_euler ( phi , theta , psi ) ) <EOL> pose = Pose ( Point ( x , y , z ) , orient ) <EOL> self . left_arm . set_pose_target ( pose ) <EOL> self . left_arm . go ( True ) <EOL> def setSquare ( self , square , height_above_board ) : <EOL> if len ( square ) != <NUM_LIT:2> or not square [ <NUM_LIT:1> ] . isdigit ( ) : <EOL> raise ValueError ( <EOL> "<STR_LIT>" % <EOL> square ) <EOL> rank_y = - <NUM_LIT> - <NUM_LIT> * ( ord ( square [ <NUM_LIT:0> ] ) - ord ( '<STR_LIT:a>' ) ) <EOL> file_x = <NUM_LIT:0.5> - <NUM_LIT> * int ( square [ <NUM_LIT:1> ] ) <EOL> z = float ( height_above_board ) + <NUM_LIT:1.0> <EOL> self . setPose ( file_x , rank_y , z , <NUM_LIT> , <NUM_LIT> , - <NUM_LIT> ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> moveit_commander . roscpp_initialize ( sys . argv ) <EOL> rospy . init_node ( '<STR_LIT>' ) <EOL> argv = rospy . myargv ( argv = sys . argv ) <EOL> if len ( argv ) != <NUM_LIT:3> : <EOL> print "<STR_LIT>" <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> r2w = R2ChessboardWrapper ( ) <EOL> r2w . setSquare ( * argv [ <NUM_LIT:1> : ] ) <EOL> moveit_commander . roscpp_shutdown ( ) </s>
