$search
00001 import rospy 00002 00003 # go to crouching position 00004 def crouch(motionProxy): 00005 numJoints = len(motionProxy.getJointNames('Body')) 00006 00007 allAngles = [0.0,0.0, # head 00008 1.545, 0.33, -1.57, -0.486, 0.0, 0.0, # left arm 00009 -0.3, 0.057, -0.744, 2.192, -1.122, -0.035, # left leg 00010 -0.3, 0.057, -0.744, 2.192, -1.122, -0.035, # right leg 00011 1.545, -0.33, 1.57, 0.486, 0.0, 0.0] # right arm 00012 00013 if (numJoints == 26): 00014 angles = allAngles 00015 elif (numJoints == 22): # no hands (e.g. simulator) 00016 angles = allAngles[0:6] + allAngles[8:24] 00017 else: 00018 rospy.logerr("Unkown number of joints: %d", numJoints) 00019 return 00020 00021 try: 00022 motionProxy.angleInterpolation('Body', angles, 1.5, True); 00023 00024 except RuntimeError,e: 00025 print "An error has been caught" 00026 print e