ServoJ伺服接口改进完成
This commit is contained in:
parent
286b606f5a
commit
54a6733861
Binary file not shown.
@ -164,28 +164,20 @@ class dobot_nova5:
|
||||
break
|
||||
sleep(0.1)
|
||||
|
||||
def ServoJoint(self,joints_list,t=-1,aheadtime=-1,gain=-1):
|
||||
# 关节空间伺服
|
||||
recvmovemess = self.dashboard.ServoJ(*joints_list,t,aheadtime,gain)
|
||||
print("ServoJ:",recvmovemess)
|
||||
print(self.parseResultId(recvmovemess))
|
||||
currentCommandID = self.parseResultId(recvmovemess)[1]
|
||||
print("指令 ID", currentCommandID)
|
||||
while True:
|
||||
currentCommandID = self.parseResultId(self.dashboard.GetCurrentCommandID())[1]
|
||||
if self.feedbackData.robotMode == 9 or self.feedbackData.robotMode == 11:
|
||||
self.dashboard.Stop()
|
||||
self.dashboard.EmergencyStop()
|
||||
print("当前工作停止,机械臂处于急停状态")
|
||||
if self.feedbackData.robotMode == 10: # 10 当前工程暂停
|
||||
print("机械臂为暂停状态")
|
||||
res = self.dashboard.Continue()
|
||||
code = int(res[0])
|
||||
if code == 0:
|
||||
print("机械臂继续已暂停的运动指令")
|
||||
if self.feedbackData.robotMode == 5 and self.feedbackData.robotCurrentCommandID == currentCommandID:
|
||||
print("完成一次伺服动作")
|
||||
break
|
||||
def ServoJoint(self,joints_list):
|
||||
tcp_command = f"servoj({joints_list[0]},{joints_list[1]},{joints_list[2]},{joints_list[3]},{joints_list[4]},{joints_list[5]},t=0.008,aheadtime=20,gain=200)"
|
||||
self.dashboard.sendRecvMsg(tcp_command)
|
||||
print("ServoJ:",tcp_command)
|
||||
if self.feedbackData.robotMode == 9 or self.feedbackData.robotMode == 11:
|
||||
self.dashboard.Stop()
|
||||
self.dashboard.EmergencyStop()
|
||||
print("当前工作停止,机械臂处于急停状态")
|
||||
if self.feedbackData.robotMode == 10: # 10 当前工程暂停
|
||||
print("机械臂为暂停状态")
|
||||
res = self.dashboard.Continue()
|
||||
code = int(res[0])
|
||||
if code == 0:
|
||||
print("机械臂继续已暂停的运动指令")
|
||||
|
||||
|
||||
def ServoPose(self,poses_list,t=-1,aheadtime=-1,gain=-1):
|
||||
@ -405,9 +397,9 @@ if __name__ == "__main__":
|
||||
dobot.RunPoint_P_inJoint(posJ)
|
||||
sleep(1)
|
||||
|
||||
# for i in range(200):
|
||||
# posJ[2] += 0.04
|
||||
# dobot.ServoJoint(joints_list=posJ,t=0.008,aheadtime=20,gain=200)
|
||||
# sleep(0.008)
|
||||
for i in range(400):
|
||||
posJ[2] += 0.04
|
||||
dobot.ServoJoint(posJ)
|
||||
sleep(0.007)
|
||||
|
||||
dobot.disableRobot()
|
Loading…
x
Reference in New Issue
Block a user