lanius / tinyik

A tiny inverse kinematics solver
MIT License
120 stars 21 forks source link

Links that run along the Z-axis aren't shown in the visualizer #18

Closed satej1210 closed 3 years ago

satej1210 commented 3 years ago

Hello!

First off, this project is awesome! The fact that is it so simple and the code is easy to understand is great.

The problem I have is that when some links are drawn along the Z-axis, the cylinders aren't displayed in the visualizer.

Here's the configuration I'm working with:

tinyik.Actuator(['z', [0, 0, 180.7], 'y', [-612.7, 0, 0], 'y', [-571.55, 0, 0], 'y', [0, -174.15, 0], 'z', [0, 0, -119.85], 'y', [0, -116.55, 0]])

Here's a screenshot from the visualizer: Screenshot (107)

(FYI, I'm using a radius of 10)

Do you know of a workaround for this problem?

Thanks!

satej1210 commented 3 years ago

I forgot to include that there is also a RuntimeWarning that is printed when opening the visualizer:

 <environment_dir>\lib\site-packages\tinyik\visualizer.py:85: RuntimeWarning: invalid value encountered in true_divide
  axis = cross / np.linalg.norm(cross)
lanius commented 3 years ago

Thanks for the nice pull request! I've merged it as a bug fix.