pinocchio: getJointId should throw if out of range
Currently, if I query a joint that does not exist, I get the index of vector.end() which is out of bounds of njoints. Instead, if a joint does not exist, it should throw an exception (without me calling existJointName).
This relates to https://github.com/stack-of-tasks/pinocchio/blob/e038c7bf283b1df56a35014455e0e2d6f36e03ac/src/multibody/model.hxx#L209-L218
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 1
- Comments: 19 (19 by maintainers)
Sorry @gabrielebndn, I wrote a mistake. I wanted to say:
I do think this change will break existing codeMy opinion on this is that this is an endless discussion that never goes well beyond Pinocchio. To me, there is no good answer whether an exception or some integer indicating a bad entry.
It will. I suggest to:
JointId getJointId (std::string name, bool throwIfNotFound = false).This delays the API change to version 3.