(6-7-04)加速度控制算法:机器人关节加速度限制的分析和可视化(4)比较实际机器人和仿真机器人的关节加速度限制

6.6.4  比较实际机器人和仿真机器人的关节加速度限制

文件comparison.py的功能是比较实际机器人和仿真机器人的关节加速度限制,生成了5个三维表面可视化图,分别展示关节1、关节2(正负方向)、关节3(正负方向)的加速度限制。每个图中都包括仿真机器人和实际机器人的数据,通过图形比较,有助于分析两者之间的差异和相似性。

import pickle
import matplotlib.pyplot as plt
import numpy as np
real_dict = pickle.load(open('results/abb/real/6640.pickle','rb'))
sim_dict = pickle.load(open('results/abb/sim/6640/6640.pickle','rb'))
###surface plots of accleration limits, x as q2, y as q3
x_sim=[]
y_sim=[]
q1_acc_sim=[]
q2_acc_p_sim=[]
q3_acc_p_sim=[]
q2_acc_n_sim=[]
q3_acc_n_sim=[]
for key, value in sim_dict.items():
   x_sim.append(key[0])
   y_sim.append(key[1])
   q1_acc_sim.append(value[0])
   q2_acc_n_sim.append(value[2])
   q2_acc_p_sim.append(value[3])
   q3_acc_n_sim.append(value[4])
   q3_acc_p_sim.append(value[5])
###surface plots of accleration limits, x as q2, y as q3
x_real=[]
y_real=[]
q1_acc_real=[]
q2_acc_p_real=[]
q3_acc_p_real=[]
q2_acc_n_real=[]
q3_acc_n_real=[]
for key, value in real_dict.items():
   x_real.append(key[0])
   y_real.append(key[1])
   q1_acc_real.append(value[0])
   q2_acc_n_real.append(value[2])
   q2_acc_p_real.append(value[3])
   q3_acc_n_real.append(value[4])
   q3_acc_p_real.append(value[5])
#####################################################################surface plots##########################################################
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
surf1 = ax.plot_trisurf(x_sim, y_sim, q1_acc_sim, linewidth=0, antialiased=False,label='sim')
surf2 = ax.plot_trisurf(x_real, y_real, q1_acc_real, linewidth=0, antialiased=False,label='real')
surf1._edgecolors2d = surf1._edgecolor3d
surf1._facecolors2d = surf1._facecolor3d
surf2._edgecolors2d = surf2._edgecolor3d
surf2._facecolors2d = surf2._facecolor3d

ax.set_xlabel('q2 (rad)')
ax.set_ylabel('q3 (rad)')
ax.set_zlabel('q1 acc (rad/s^2)')
plt.title('Joint1 Acceleration Limit')
plt.legend()
plt.show()
plt.show()

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
surf1 = ax.plot_trisurf(x_sim, y_sim, q2_acc_n_sim, linewidth=0, antialiased=False,label='sim')
surf2 = ax.plot_trisurf(x_real, y_real, q2_acc_n_real, linewidth=0, antialiased=False,label='real')
surf1._edgecolors2d = surf1._edgecolor3d
surf1._facecolors2d = surf1._facecolor3d
surf2._edgecolors2d = surf2._edgecolor3d
surf2._facecolors2d = surf2._facecolor3d

ax.set_xlabel('q2 (rad)')
ax.set_ylabel('q3 (rad)')
ax.set_zlabel('q2 acc (rad/s^2)')
plt.title('Joint2 Acceleration Limit-')
plt.legend()
plt.show()

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
surf1 = ax.plot_trisurf(x_sim, y_sim, q2_acc_p_sim, linewidth=0, antialiased=False,label='sim')
surf2 = ax.plot_trisurf(x_real, y_real, q2_acc_p_real, linewidth=0, antialiased=False,label='real')
surf1._edgecolors2d = surf1._edgecolor3d
surf1._facecolors2d = surf1._facecolor3d
surf2._edgecolors2d = surf2._edgecolor3d
surf2._facecolors2d = surf2._facecolor3d
ax.set_xlabel('q2 (rad)')
ax.set_ylabel('q3 (rad)')
ax.set_zlabel('q2 acc (rad/s^2)')
plt.title('Joint2 Acceleration Limit+')
plt.legend()
plt.show()

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
surf1 = ax.plot_trisurf(x_sim, y_sim, q3_acc_n_sim, linewidth=0, antialiased=False,label='sim')
surf2 = ax.plot_trisurf(x_real, y_real, q3_acc_p_real, linewidth=0, antialiased=False,label='real')
surf1._edgecolors2d = surf1._edgecolor3d
surf1._facecolors2d = surf1._facecolor3d
surf2._edgecolors2d = surf2._edgecolor3d
surf2._facecolors2d = surf2._facecolor3d

ax.set_xlabel('q2 (rad)')
ax.set_ylabel('q3 (rad)')
ax.set_zlabel('q3 acc (rad/s^2)')
plt.title('Joint3 Acceleration Limit-')
plt.legend()
plt.show()


fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
surf1 = ax.plot_trisurf(x_sim, y_sim, q3_acc_p_sim, linewidth=0, antialiased=False,label='sim')
surf2 = ax.plot_trisurf(x_real, y_real, q3_acc_n_real, linewidth=0, antialiased=False,label='real')
surf1._edgecolors2d = surf1._edgecolor3d
surf1._facecolors2d = surf1._facecolor3d
surf2._edgecolors2d = surf2._edgecolor3d
surf2._facecolors2d = surf2._facecolor3d

ax.set_xlabel('q2 (rad)')
ax.set_ylabel('q3 (rad)')
ax.set_zlabel('q3 acc (rad/s^2)')
plt.title('Joint3 Acceleration Limit+')
plt.legend()
plt.show()

执行后会绘制一系列三维表面图,效果如图6-16所示。

图6-16  机器人的三维表面图

本项目已完结:

(6-7-01)加速度控制算法:机器人关节加速度限制的分析和可视化(1)定义机器人对象-CSDN博客

(6-7-02)加速度控制算法:机器人关节加速度限制的分析和可视化(2)机器人加速度采集-CSDN博客

(6-7-03)加速度控制算法:机器人关节加速度限制的分析和可视化(3)关节加速度的可视化-CSDN博客

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码农三叔

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值