Open rsandzimier-machina opened 1 month ago
The solver keeps a reference to the chain. So this fully explains the behaviour.
I don't have the time to do the research whether changing it to a copy of the chain, would affect any 'chaining' of solvers or other common ways to use the library.
I am trying to use ChainFkSolverPos_recursive and I noticed that after constructing the solver, if you modify the chain (the one used to construct the solver) it affects the solver. I went through the source code and for the life of me I can't figure out why the solver should share any memory with the Chain used to construct it. From the source code it seems like it makes a copy of the Chain and also makes a copy of the Segments that make up the chain. So I can't figure out where it still shares memory with the original Chain. Could someone point out to me why this is happening?
Here's an example showing what I am seeing. I create a solver using a chain with 1 joint. I can use the solver without issue. But then if I modify the chain (default constructed so there are 0 joints), I get a size mismatch error code. So it seems that the solver shares memory with the original chain, but I can't figure out where/why.
The output when running the above code is: