Open DimitriEckert137 opened 4 years ago
Can you please split the line:
const std::string& parname = GetTreeElementParent(segment->second)->first;
into seperate lines. So we know which part of this line is the problem. (Maybe add a print inbetween each line)
Can you tell me if the library is compiled with KDL_USE_NEW_TREE_INTERFACE
on or off? If you don't set it yourself. Please check CMakecache or similar to be really sure.
Ok i split it up like this:
const SegmentMap::const_iterator& parentseg = GetTreeElementParent(segment->second);
const std::string& parname = parentseg->first;
and it seems like the error occurs in the second line.
For the CMakeCache: I dont find this file. Which is probably due to the installation problems I mentioned above (here again the link to the github issue). So this might be the problem after all.
CMakeCache is in the build folder (catkin_ws/build/orocos_kdl
).
So have you compiled kdl from source or are you using ros-$ROS_DISTRO-orocos-kdl
??
It is very logical that the second line can fail, as it is an iterator, which can point to the end of an iterable. In that case it is an nullptr. So could you add a check?
if (parentseg)
std::cout << "Iterator is valid" << std::endl;
else
std::cout << "iterator is invalid" << std::endl;
It has not been concluded yet if this bug is related to your implementation or should be fixed in the library.
It has not been concluded yet if this bug is related to your implementation or should be fixed in the library.
ok. I just closed it because i dont follow this approach anymore and use the chain inverse dynamics solver instead.
Hey! I'm the author of the solver, sorry for not having seen this issue before... 😞
My best guess is that the problem is you build the KDL::Tree
instance as a temporary in the constructor of UrKdl
. The ID solver stores a reference to a tree object, see here. I imagine that after construction of the UrKdl
object, the tree instance is destroyed and you get undefined behavior. Could you try to add the tree as a member variable of UrKdl
and see if this solves the issue? If not, I'll dig more into the issue and try to find the bug :+1:
@smits
Hi everyone
This error might be due to a bad installation (which i mentioned in this issue which i am waiting for an answer to) bu I think its a different problem. I am working with a simulated ur3e robot. I use the kdl_parser to to get a kdl tree from the urdf file.
Its a segfault and by adding printf statement to treeidsolver_recursive_newton_euler.cpp I could narrow it down, so I am pretty sure it happens on the following line:
const std::string& parname = GetTreeElementParent(segment->second)->first;
when it passes it the SECOND time:I tried to printf the name of the current segment to see at which segment the algorithm is at that moment but this also leads to a segfault (already at the first time it passes it).
This is my code:
ContinuousOffsetCalib.hpp:
ContinuousOffsetCalib.cpp:
UrKdl.hpp: