1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
#-*-encoding:UTF-8-*- ''' Cartesian control :arm trajectory example''' import sys import motion import almath from naoqi import ALProxy def StiffnessOn(proxy): pName = "Body" pStiffnessLists = 1.0 pTimeLists = 1.0 proxy.stiffnessInterpolation(pName,pStiffnessLists,pTimeLists) def main(robotIP): '''showing a hand ellipoid ''' try : motionProxy = ALProxy( "ALProxy" ,robotIP, 9559 ) except Exception,e: print "could not create a proxy " print "error was " ,e try : postureProxy = ALProxy( "ALRobotProxy" ,robotIP, 9559 ) except Exception ,e: print "could not create a proxy" print "error was" ,e #send nao in stiffness on setStiffnessOn(motionProxy) #send nao to pose init postureProxy.goToPosture( "StandInit" , 0.5 ) effector = "LArm" space = motion.FRAME_ROBOT path = [ [ 0.0 , - 0.05 , + 0.00 , 0.0 , 0.0 , 0.0 ], #pose1 [ 0.0 , + 0.00 , + 0.04 , 0.0 , 0.0 , 0.0 ], #pose2 [ 0.0 , + 0.04 , + 0.00 , 0.0 , 0.0 , 0.0 ], #pose3 [ 0.0 , + 0.00 , - 0.02 , 0.0 , 0.0 , 0.0 ], #pose4 [ 0.0 , - 0.05 , + 0.00 , 0.0 , 0.0 , 0.0 ], #pose5 [ 0.0 , + 0.00 , + 0.00 , 0.0 , 0.0 , 0.0 ] ] #pose6 axisMask = 7 times = [ 0.5 , 1.0 , 2.0 , 3.0 , 4.0 , 4.5 ] #seconds isAbsolute = False motionProxy.positionInterpolation(effector,space,path,axisMask,times,isAbsolute) if __name__ = = "__main__" : robotIP = "127.0.0.1" if len (sys.argv)< = 1 : print "usage local ip " else : robotIP = sys.argv[ 1 ] main(robotIP) |