中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

python控制nao機器人身體動作實例詳解

發布時間:2020-10-23 09:18:22 來源:腳本之家 閱讀:295 作者:Earl_Martin 欄目:開發技術

本文實例為大家分享了python控制nao機器人身體動作的具體代碼,供大家參考,具體內容如下

今天讀的代碼,順便寫了出來,與文檔的對比,差不多。

import sys
import motion
import almath
import naoqi from ALProxy
 
def StiffnessOn(proxy):
        pName="Body"
        pStiffnessLists
        pTime=1.0
        proxy.stiffnessInterpolation(pName,pStiffnessLists,pTime)
 
def main(robotIP):
        try:
               motionProxy=ALProxy("ALMotion",robotIP,9559)
        except Exception,e:
               print:"could not create a proxy!"
               print:"error is ",e
               
        try:
               postureProxy=ALProxy("ALRobotPosture",robotIP,9559)
        except Exception,e:
               print:"could not create a proxy!"
               print:"error is ",e
 
        StiffnessOn(motionProxy)
        postureProxy.goToPosture("StandInit",0.5)
 
        space=motion.FRAME_ROBOT
        coef=0.5
        times=[coef,2.0*coef,3.0*coef,4.0*coef]
        isAbsolute=False
        dy=+0.06
        dz=-0.03
        dwx==+0.30
 
        effector="Torso"
        path=[
               [0.0,-dy,dz,-dwx,0.0,0.0],
               [0.0,0.0,0.0,0.0,0.0,0.0],
               [0.0,+dy,dz,+dwx,0.0,0.0],
               [0.0,0.0,0.0,0.0,0.0,0.0]
              ]
 
        axisMask=almath.AXIS_MASK_ALL
        motionProxy.post.postionInterpolation(effector,space,path,times,isAbsolute)
 
        #motion of arms with block process
        axisMask=almath.AXIS_MASK_VEL
        times=[1.0*coef,2.0*coef]
        dy=+0.03
        effecor="RArm"
        path=[
               [0.0,dy,0.0,0.0,0.0,0.0],
               [0.0,0.0,0.0,0.0,0.0,0.0]
              ]
        motionProxy.positionInterpolation(effector,space,path,axisMask,times,inAbsolute)
 
if __name__=="__main__":
        robotIP="127.0.0.1"
 
        if len(sys.argv)<=1:
               print"useage default robotIP"
        else:
               robotIP=sys.arv[1]
        main(robotIP)

實例二,控制左右胳膊

#-*-encoding:UTF-8 -*-
 
import sys
import motion
import almath
form naoqi import ALProxy
 
def StiffnessOn(proxy):
        pName="Body"
        pStiffnessLists=1.0
        pTimeLists=1.0
        proxy.stiffnessInterpolation(pName,pStiffnessLists,pTimeLists)
 
def main(robotIP):
 
        #create a proxy to almtion
        try:
               motionProxy=ALProxy("ALMotion",robotIP,9559)
        except Exception,e:
               print "could not create a proxy"
               print "error is ",e
 
        #create a proxy to alrobotposture
        try:
               postureProxy=ALProxy("ALRobotPosture",robotIP,9559)
        except Exception,e:
               print "could not create a proxy"
               print "error is ",e
 
 
        StiffnessOn(motionProxy)
        postureProxy.goToPosture("StandInit",0.5)
        space=motion.FRAME_ROBOT
        isAbsolute=False
 
        effectorList=["LArm","RArm"]
        #motion of arms with block process
        axisMaskList=[almath.AXIS_MASK_VEL,almath.AXIS_MASK_VEL]
        timeLists=[[1.0],[1.0]]
        pathList=[   
                  [
                    [0.0,-0.04,0.0,0.0,0.0,0.0]],
                  [ 
                    [0.0,0.04,0.0,0.0,0.0,0.0]]
                ]
        motionProxy.positionInterpolation(effectorLists,space,pahtLists,axisMaskList,timeLists,isAbsolute)
 
        effectorLists=["LArm","RArm","Torso"]
        axisMaskLists=[
               almath.AXIS_MASK_VEL,
               almath.AXIS_MASK_VEL,
               almath.AXIS_MASK_ALL
               ]
        timeLists=[
               [[0.0,0.0,0.0,0.0,0.0,0.0]],
               [[0.0,0.0,0.0,0.0,0.0,0.0]],
               [0.0,+dy,0.0,0.0,0.0,0.0],
               [0.0,-dy,0.0,0.0,0.0,0.0],
               [0.0,0.0,0.0,0.0,0.0,0.0]
               ]
        motionProxy.positionInterpolations(effectorList,space,pathList,axisMaskList,timeList,isAbsolute)
 
if __name__=="__main__":
        robotIP="127.0.0.1"
        if(sys.argv<1):
               print"usege default ip"
        else:
               robotIP=sys.arv[1]
        main(robotIP)

感受:

這些小的程序最不好處理的就是path中的數據了。這些數據是怎么獲得的?最大的可能就是在choregraph中3D視圖中測試得到,當然還有一種可能就是將choregraph與實體機連接,將機器人置于practice狀態,這樣操作來獲得數據。后者操作性更強,但由于實際原因,用前者的可能性是最大的。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持億速云。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

疏附县| 乌海市| 顺平县| 景洪市| 太谷县| 山西省| 永和县| 延寿县| 临汾市| 金沙县| 灌云县| 怀来县| 始兴县| 安泽县| 鄄城县| 石林| 湖州市| 台北市| 和龙市| 普兰店市| 谷城县| 文山县| 连南| 昌图县| 宁河县| 潞城市| 娱乐| 庄浪县| 博湖县| 江安县| 仙桃市| 垦利县| 读书| 桂平市| 苏尼特左旗| 东山县| 互助| 沁源县| 宜宾市| 太白县| 苏尼特右旗|