ik icon indicating copy to clipboard operation
ik copied to clipboard

Target has an offset when setting chain_length

Open Flrefly opened this issue 6 years ago • 2 comments

When I set the effector->chain_length to something smaller than number of nodes-2, the solution has a constant offset to my specified effector->target_position. And this offset gets bigger with smaller chain_lengths.

Am I doing something wrong or is this a bug? I am using the latest master branch.

Flrefly avatar Nov 19 '19 09:11 Flrefly

This does sound like a bug. Can you explain your setup a bit more in detail so I can try and reproduce it? Maybe even share relevant code?

TheComet avatar Nov 23 '19 14:11 TheComet

project.zip

I uploaded the whole project in case the error is somewhere on my side. It's just a small project, where I tried to get familiar with your library. It creates a simple kinematic chain and the end-effector should follow the cursor position.

The relevant file is the KChain.cpp. I set up the solver in line 25-48 (the ik.init already happended in the Application constructor). The method solveIK (line 75-82) is called once per frame.

The effector->chain_length is set in line 42. If I delete this line or set it to number of joints or number of joints -1, everything works fine. The error occures when I set it to number of joints -2 or smaller (in the current example 4 or smaller).

Flrefly avatar Jan 20 '20 09:01 Flrefly