本文整理汇总了Python中PyPR2.getHeadPos方法的典型用法代码示例。如果您正苦于以下问题:Python PyPR2.getHeadPos方法的具体用法?Python PyPR2.getHeadPos怎么用?Python PyPR2.getHeadPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyPR2
的用法示例。
在下文中一共展示了PyPR2.getHeadPos方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_human
# 需要导入模块: import PyPR2 [as 别名]
# 或者: from PyPR2 import getHeadPos [as 别名]
def find_human():
global HUMAN_DETECTION_COUNTER,revolve_counter
while revolve_counter==1 and PyPR2.getHeadPos()[0]<1.5 and HUMAN_DETECTION_COUNTER==0:
revolve_cw()
while revolve_counter==-1 and PyPR2.getHeadPos()[0]>-1.5 and HUMAN_DETECTION_COUNTER==0:
revolve_acw()
while PyPR2.getHeadPos()[0] >1.2 and HUMAN_DETECTION_COUNTER==0:
revolve_counter = -1
revolve_acw()
find_human()
while PyPR2.getHeadPos()[0] <-1.2 and HUMAN_DETECTION_COUNTER==0:
revolve_counter = 1
revolve_cw()
find_human()
if HUMAN_DETECTION_COUNTER!=0:
adjust_to_shooting(PyPR2.getHeadPos()[1])
示例2: adjust_to_shooting
# 需要导入模块: import PyPR2 [as 别名]
# 或者: from PyPR2 import getHeadPos [as 别名]
def adjust_to_shooting():
global last_proximity
proximity = check_head_proximity()
if proximity== True and last_proximity==False:
PyPR2.moveBodyTo(0.0,0.0,(0.65)*PyPR2.getHeadPos()[0],1)
#PyPR2.moveHeadTo(0.0,y)
last_proximity = proximity
示例3: revolve_acw
# 需要导入模块: import PyPR2 [as 别名]
# 或者: from PyPR2 import getHeadPos [as 别名]
def revolve_acw():
(a,b) = PyPR2.getHeadPos()
#PyPR2.say("searching")
PyPR2.moveHeadTo(a-0.3,0.0)
示例4: check_head_proximity
# 需要导入模块: import PyPR2 [as 别名]
# 或者: from PyPR2 import getHeadPos [as 别名]
def check_head_proximity():
(a,b) = PyPR2.getHeadPos()
if a>0.6 or a<-0.6:
return True
else:
return False