DOBOT Magician의 움직이는 영역 (2D)

DobotMagician을 옆에서 볼 때 움직이는 영역을 그립니다.

install
sudo apt install python3-pip -y
pip3 install matplotlib

ki_2_link.py

import matplotlib.pyplot as plt
import math

L1 = 135
L2 = 147
end_effector_params = [61.0,0.0,0.0]

def ki(j1,j2):
  if(check_joint_limit(j1,j2) == False):
    raise Exception('out of range')

  j1_rad = math.pi * j1 / 180
  j2_rad = math.pi * j2 / 180

  x = L1 * math.sin(j1_rad) + L2 * math.cos(j2_rad) + end_effector_params[0]
  y = L1 * math.cos(j1_rad) - L2 * math.sin(j2_rad) + end_effector_params[2]

  return (x,y)

def check_joint_limit(j1,j2):

  d_j = j2 - j1

  if (j1 >= 0 and j1 <= 85):
    if (j2 >= -10 and j2 <= 95):
      return True

  return False

fig = plt.figure()
ax1 = fig.add_subplot(111)

plt.xlim(-100,400)
plt.ylim(-200,200)

plt.xlabel('x')
plt.ylabel('y')

plt.axes().set_aspect('equal')

plt.grid()

for j1 in range(-180,180,1):
  for j2 in range(-180,180,1):
    try:
      x,y = ki(j1,j2)
      plt.plot(x,y,marker='.',color='blue')
    except:
      pass

plt.show()


다음과 같은 영역이 얻어졌습니다

참고



실제 영역



좋은 웹페이지 즐겨찾기