lanius / tinyik

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

problem for using multiple solver in same time #13

Closed mostafanorouzi closed 3 years ago

mostafanorouzi commented 3 years ago

Hello When three classes are built from this library at the same time, the calculations for the third class are not done correctly.

self.brush_arm= Actuator(['y', [0., 0., 0.01], 'x', [0., 0., 1.11], 'x', [0., 0., 1.225]]) self.left_leg = Actuator(['x', [0., 0., 1.175], 'x', [0., 0., 1.225],'x', [0., 0., .001] ]) self.right_leg = Actuator(['x', [0., 0., 1.175], 'x', [0., 0., 1.225],'x', [0., 0., .001] ])

lanius commented 3 years ago

Hello.

After you instantiate the actuator, what operations are you doing and what errors are you getting?

Basically, each actuator object should be independent of the other, so I don't think creating multiple objects will affect each other. It may be a different problem though.

mostafanorouzi commented 3 years ago

Hello.

After you instantiate the actuator, what operations are you doing and what errors are you getting?

Basically, each actuator object should be independent of the other, so I don't think creating multiple objects will affect each other. It may be a different problem though.

You can try on this notebook. When three objects are defined, the first object does not work properly while the second and third objects work properly. And by changing the order of the object definition, the first object does not work properly again. I tried all kinds of modes and definitions but it didn't work. As you can see in the notebook, the results are not correct.

https://colab.research.google.com/drive/1R_xqPb3Qt81U60sp3CuSZ79WKkSogbVH?usp=sharing

lanius commented 3 years ago

@mostafanorouzi Thank you! The problem was reproduced in my environment as well. I found that it was a rudimentary bug related to optimizer initialization. Thanks to you, I was able to find this bug.

I've implemented a fix patch and released a new version 2.1.1 without the problem, so please try it.

Thank you very much!