NAO机器头部只支持yaw和pitch运动,具体编程如下。
NAO机器人头部水平旋转30度
from naoqi import ALProxy
import time
import almath
robotIp = "169.254.165.22"#169 254 165 22
Motion = ALProxy("ALMotion",robotIp,9559)
Motion.setStiffnesses("Head",1.0)
names = "HeadYaw" #水平运动
angles = 30.0*almath.TO_RAD
fractionMaxSpeed = 0.1
Motion.setAngles(names,angles,fractionMaxSpeed)
time.sleep(3.0)
Motion.setStiffnesses("Head",0.0)
头部固定
当用手扭动机器人头部时,总会回到设定的角度
from naoqi import ALProxy
import threading
import time
import almath
robotIp = "169.254.165.22"#169 254 165 22
Motion = ALProxy("ALMotion",robotIp,9559)
Motion.setStiffnesses("Head",1.0)
names1 = "HeadYaw" # 水平运动
names2 = "HeadPitch" # 上下运动
angles = 0.0*almath.TO_RAD
fractionMaxSpeed = 0.1
while True:
Motion.setAngles(names1,angles,fractionMaxSpeed)
Motion.setAngles(names2, angles, fractionMaxSpeed)
print "fixing"
#time.sleep(3.0)