python控制nao機(jī)器人身體動(dòng)作實(shí)例詳解
本文實(shí)例為大家分享了python控制nao機(jī)器人身體動(dòng)作的具體代碼,供大家參考,具體內(nèi)容如下
今天讀的代碼,順便寫了出來,與文檔的對比,差不多。
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)
實(shí)例二,控制左右胳膊
#-*-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中的數(shù)據(jù)了。這些數(shù)據(jù)是怎么獲得的?最大的可能就是在choregraph中3D視圖中測試得到,當(dāng)然還有一種可能就是將choregraph與實(shí)體機(jī)連接,將機(jī)器人置于practice狀態(tài),這樣操作來獲得數(shù)據(jù)。后者操作性更強(qiáng),但由于實(shí)際原因,用前者的可能性是最大的。
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- Python實(shí)現(xiàn)企業(yè)微信機(jī)器人每天定時(shí)發(fā)消息實(shí)例
- Python調(diào)用釘釘自定義機(jī)器人的實(shí)現(xiàn)
- Python使用微信接入圖靈機(jī)器人過程解析
- 基于python的itchat庫實(shí)現(xiàn)微信聊天機(jī)器人(推薦)
- python實(shí)現(xiàn)機(jī)器人卡牌
- Python實(shí)現(xiàn)微信機(jī)器人的方法
- Python3從零開始搭建一個(gè)語音對話機(jī)器人的實(shí)現(xiàn)
- 基于Python的微信機(jī)器人開發(fā) 微信登錄和獲取好友列表實(shí)現(xiàn)解析
- Python實(shí)現(xiàn)微信翻譯機(jī)器人的方法
- Python qqbot 實(shí)現(xiàn)qq機(jī)器人的示例代碼
- python實(shí)現(xiàn)微信自動(dòng)回復(fù)機(jī)器人功能
- 如何用Python做一個(gè)微信機(jī)器人自動(dòng)拉群
- Python QQBot庫的QQ聊天機(jī)器人
- 使用python接入微信聊天機(jī)器人
- itchat-python搭建微信機(jī)器人(附示例)
- python實(shí)現(xiàn)微信機(jī)器人: 登錄微信、消息接收、自動(dòng)回復(fù)功能
- 手把手教你使用Python創(chuàng)建微信機(jī)器人
- Python開發(fā)企業(yè)微信機(jī)器人每天定時(shí)發(fā)消息實(shí)例
相關(guān)文章
pandas數(shù)據(jù)預(yù)處理之dataframe的groupby操作方法
下面小編就為大家分享一篇pandas數(shù)據(jù)預(yù)處理之dataframe的groupby操作方法,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-04-04
Python操作RabbitMQ服務(wù)器實(shí)現(xiàn)消息隊(duì)列的路由功能
RabbitMQ是一個(gè)消息隊(duì)列服務(wù)器,這里我們針對Python+Pika+RabbitMQ的服務(wù)器端環(huán)境,來看一下如何使用Python操作RabbitMQ服務(wù)器實(shí)現(xiàn)消息隊(duì)列的路由功能2016-06-06
python 動(dòng)態(tài)調(diào)用函數(shù)實(shí)例解析
這篇文章主要介紹了python 動(dòng)態(tài)調(diào)用函數(shù)實(shí)例解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-10-10
Python將視頻或者動(dòng)態(tài)圖gif逐幀保存為圖片的方法
本文是基于opencv將視頻和動(dòng)態(tài)圖gif保存為圖像幀的方法,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2019-09-09
ubuntu系統(tǒng)下使用pm2設(shè)置nodejs開機(jī)自啟動(dòng)的方法
今天小編就為大家分享一篇ubuntu系統(tǒng)下使用pm2設(shè)置nodejs開機(jī)自啟動(dòng)的方法,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-05-05

