Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin crashes in configure when mainJointPosPot is a zero vector. #1

Open
FrederikBark opened this issue Feb 3, 2025 · 1 comment
Assignees

Comments

@FrederikBark
Copy link
Member

FrederikBark commented Feb 3, 2025

In MimicJoints.cc line 70 the following if statement exists:

if(mainJointPosOpt.has_value()){
gzdbg << "Initial position of main joint found" << std::endl;
mainPos = mainJointPosOpt.value()[0];
}

There are cases in which mainJointPosOpt is of type std::optional< [std::vector]< double > > with a length of 0. The check only checks if the function was executed successfully and not if it the vector has an element at position 0. The following access leads to a segmentation fault.

Is the mainPos value essential to be set and a warning should be given if not, or is this value optional and a simple range check fix be enough here?

@Excelsius314
Copy link
Contributor

"mainPos" is currently more or less obsolete and this piece of code can be removed accordingly. The original idea was to set joints to their correct starting position (based on their defined offset to the main joint) in line 146 but during my testing the main position component was never available during the configuration phase. This results in the mimic joints being initialized to their offset without considering the main joint initial position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants