Closed KroogerFx closed 4 weeks ago
Hi! Sorry for late reply. I will look into this sometime this week and get back to you.
Just a quick thought, what if you put the origin of the leg on the end of the red line? Or am I misunderstanding the picture? Would be nice to understand the axis of rotation for each joint.
Okay reading the title I assume the first joint of the leg is attached at a point offset from the rotation vector of the base joint.
Looking into it a bit, I think that the red line could be considered its own arm where the the joint connecting it to the next arm has a fixed angle. This can be solved by adding angular constraints to the joints. As a matter of fact the paper addresses this: http://www.andreasaristidou.com/publications/papers/FABRIK.pdf pp. 249
I will look into it a bit how we can do this with the current implementation. I was planning to do a full revamp of the library at some point, but adding this should not be too difficult to accomplish.
Hello,
Thank you for the reply.
"Okay reading the title I assume the first joint of the leg is attached at a point offset from the rotation vector of the base joint."
Yes this is correct, this would cause the location of the first joint to change coordinates while the base is rotating rather than staying in the same location.
"I think that the red line could be considered its own arm where the the joint connecting it to the next arm has a fixed angle. This can be solved by adding angular constraints to the joints."
This should work but how can I constrain the joints?
It appears the properties of the joint are dynamic and the solver will change them accordingly
// Joint struct typedef struct { float x = 0; // x position of joint relative to origin float y = 0; // y position of joint relative to origin float angle = 0; // angle of joint } Joint;
Is there a way to constrain the first joint angle? That would act as the red offset line.
Thank You
Hi, I merged a pull request where I added joint constraints. Please clone the master branch and try it and let me know how it goes.
Here is an example how to use it:
int success = 0;
int lengths_4_joints[] = {200, 200, 200};
Fabrik2D::AngularConstraint angular_constraints[3] = {
Fabrik2D::AngularConstraint{-M_PI / 2.0, -M_PI / 2.0},
Fabrik2D::AngularConstraint{-2.0 * M_PI, 2.0 * M_PI},
Fabrik2D::AngularConstraint{-2.0 * M_PI, 2.0 * M_PI}};
Fabrik2D fabrik2D(4, lengths_4_joints, angular_constraints, 1);
success = fabrik2D.solve2(100, 100, 100, lengths_4_joints);
Hello,
I am trying to adapt this library to drive a robot leg.
Is there a way to include an offset (red line) from where the first joint attaches to the base rotation?
I have tried changing the values of the joint x, y, and the z value of the chain but can't get a solution.