• 移动单点输入连杆夹持机构


    1. import sympy as sy
    2. import numpy as np
    3. import matplotlib.pyplot as plt
    4. from matplotlib.animation import FuncAnimation
    5. b,c,d,e,L,F,S=sy.symbols("b,c,d,e,L,F,S")
    6. k1=2*d*c
    7. k2=-2*S*c
    8. k3=S**2-b**2+c**2+d**2
    9. pu=2*sy.atan((-k1+sy.sqrt(k1**2+k2**2-k3**2))/(k3-k2))
    10. fi=sy.atan((d+c*sy.sin(pu))/(S-c*sy.cos(pu)))
    11. F23=F*(L*sy.cos(pu)+e*sy.sin(pu))/(c*sy.sin(fi+pu))
    12. F1=2*F23*sy.cos(fi)
    13. Ax=-S
    14. Bx=-S+b*sy.cos(fi)
    15. By=b*sy.sin(fi)
    16. B1x=-Bx
    17. B1y=d-c*sy.sin(pu)
    18. acx=sy.lambdify(S,Ax.subs({b:80,c:50,d:70,e:20,L:100,F:1200}),modules='numpy')
    19. bx=sy.lambdify(S,Bx.subs({b:80,c:50,d:70,e:20,L:100,F:1200}),modules='numpy')
    20. by=sy.lambdify(S,By.subs({b:80,c:50,d:70,e:20,L:100,F:1200}),modules='numpy')
    21. b1x=sy.lambdify(S,B1x.subs({b:80,c:50,d:70,e:20,L:100,F:1200}),modules='numpy')
    22. b1y=sy.lambdify(S,B1y.subs({b:80,c:50,d:70,e:20,L:100,F:1200}),modules='numpy')
    23. fig,ax = plt.subplots()
    24. plt.rcParams['xtick.direction'] = 'in' # 将x周的刻度线方向设置向内
    25. plt.rcParams['ytick.direction'] = 'in' # 将y轴的刻度方向设置向内
    26. plt.rcParams['axes.unicode_minus']=False
    27. # plt.rcParams['font.family'] = ["Times New Roman"] # 字体设置为Times NewRoman
    28. plt.rcParams['font.sans-serif'] = ['SimHei']
    29. clist = ['blue', 'red', 'green', 'black', 'darkgreen', 'lime', 'gold', 'purple', 'green', 'cyan', 'salmon', 'grey',
    30. 'mediumvioletred', 'darkkhaki', 'gray', 'darkcyan', 'violet', 'powderblue']
    31. markerlst = ['o', '*', 'x', '>', '<', '^', 'D', 'd', '1', '2', '3', '4', 'o', '*', 'x', '>', '<', '^', 'D', 'd',
    32. '1', '2', '3', '4', 'o', '*', 'x', '>', '<', '^', 'D', 'd', '1', '2', '3', '4']
    33. linestylelst = ['-', '--', '-.', ':', '-', '--', '-.', ':', '-', '--', '-.', ':', '-', '--', '-.', ':', '-', '--',
    34. '-.', ':', '-', '--', '-.', ':']
    35. def draw_frame(i):
    36. s=100-i
    37. xa=acx(s)
    38. ya=0
    39. xb=bx(s)
    40. yb=by(s)
    41. xb1 = b1x(s)
    42. yb1 = b1y(s)
    43. xc=0
    44. yc=70
    45. ax.clear()
    46. ax.plot([xa,xb],[ya,yb],c=clist[0])
    47. ax.plot([xb1, xb], [yb1, yb], c=clist[1])
    48. ax.plot([xc, xc], [-yc, yc], c=clist[2])
    49. ax.plot([xa, xb], [ya, -yb], c=clist[3])
    50. ax.plot([xb1, xb], [-yb1, -yb], c=clist[4])
    51. ax.axis('equal')
    52. ax.set_xlim(xmin=-200,xmax=200)
    53. ax.set_ylim(ymin=-200, ymax=200)
    54. plt.tight_layout()
    55. anim=FuncAnimation(fig,draw_frame,frames=45,interval=50)
    56. anim.save("d2.gif",writer='pillow')

  • 相关阅读:
    Excel·VBA数组排列函数
    Lab: system calls
    05 robotFrameWork+selenium2library 一维数组的使用
    以“新IT”助“数智融合”,联想推开“智能化转型”下半场的大门
    Python —— hou.NetworkItem class
    虚拟平面光源的vulkanAPI复现-原文分析
    Spring的IOC原理
    微服务原理
    基于Appian低代码平台开发一个SpaceX网站
    【JAVA】会话跟踪技术
  • 原文地址:https://blog.csdn.net/T20151470/article/details/132769814