missing return?
ljubomirb opened this issue · 1 comments
ljubomirb commented
Is is possible that return is missing in one of the functions?
Should it look like this?
bool Fabrik2D::solve2(float x, float y, float z, float toolAngle, float grippingOffset, int* lengths)
{
bool solvable;
if (this->numJoints >= 4) {
// Find wrist center by moving from the desired position with tool angle and link length
float oc_x = x - (lengths[this->numJoints-2]+grippingOffset)*cos(toolAngle);
float oc_y = y - (lengths[this->numJoints-2]+grippingOffset)*sin(toolAngle);
// We solve IK from first joint to wrist center
int tmp = this->numJoints;
this->numJoints = this->numJoints-1;
solvable = solve(oc_x, oc_y, lengths);
and then at the end
// Save base angle (if z different from zero)
if (z != 0) {
this->chain->z = z;
this->chain->angle = atan2(z,x);
}
}
}
return solvable;
}
henriksod commented
Thank you for detecting this. I had missed a return at the end of the method. Will change it asap.