Hello,
I am trying to drive this robot leg in 3 dimensions.
I can do 2D inverse kinematics from scratch but in 3D the math is beyond my ability.
The closest library I have found so far is Fabrik2D since it can rotate on it's base giving 3D ability.
But since I cannot offset that rotation I can't find a way to adapt this library to my application.
Many other libraries require high ram and cpu speeds.
I'm using an esp32 to control everything.
Any suggestions?
Thank You
@krooger I don't know what kinematics is, but it sounds like he same math a game engine uses, which is just matrix arithmetic. Is that close?
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@krooger
I haven't started collecting kinematic library links ... yet. But I've found that James Bruton (James Bruton - YouTube) often has viable code to fill the gap. Adding a generic library can be a PITA in the prototype stage. I have a BittleX quadruped and the kinematic code there is tied up in knots. Others I've seen have the high requirements you mention. I'll pipe up if I come across something interesting.
What is the platform you're using for the bot? Are you using a ESP32 or a Pi?
EDIT: you did say ESP32. Sorry. drain bamage.
@krooger
On second thought, I'm not sure you need to be concerned about the 3rd coord. It defines a plane, similar to the base rotation of the Fabrik2D example. That's the offset you mention. So you use the 2D to get to (x,y) and the offset is the delta from the current z pos.
@krooger
What I'm thinking of is run the solver twice.
1. for (x, y) fixed z.
2. for (x, z) with the y from 1.
I think that should work.
When I get a chance, I'll run a few tests of the code.
Thanks for the replies, I've been AFK.
same math a game engine uses
Indeed that math would work, however it has been over a decade since I've studied Linear Algebra and I'm trying to avoid relearning. I failed that course the first time through haha.
What I'm thinking of is run the solver twice.
Yea I was kind of thinking along the same lines, however I might have thought up a way to solve the problem from scratch just using trig. I'm thinking I can calculate the Z (hip abduction) angle independently which basically tilts the plane, then project my other joints onto this new plane and then solve a 2D problem.
I think this should work and I can re-use the 2D solver I already wrote.
Unfortunately I return to my day job now so might not get to try anytime soon.
Did you try this one? https://github.com/kousheekc/Kinematics
However I'll definitely have to look into this library.
Yea I was kind of thinking along the same lines, however I might have thought up a way to solve the problem from scratch just using trig. I'm thinking I can calculate the Z (hip abduction) angle independently which basically tilts the plane, then project my other joints onto this new plane and then solve a 2D problem.
I did a snap review of the Fabrik library using Google Test and I now think it should work. I have to put a test arm together to really verify it. I will need to get the correct servo axial you use but I can work without it for the moment. I was going to have to do this anyway for my bluesky project, so it will serve two purposes.
FYI, an example of this is the Petoi OpenCat robot. However, it doesn't calculate the angles on the fly and so doesn't use kinematics. They use a separate tool to record the iterative positions and save them in EEPROM for later playback.
I'm working on a test harness for the FABRIK library and need your help to verify that I have the servo layout correct. The picture has 3 servos, (A, B, C) which would correspond to
- A = shoulder or hip
- B = elbow or knee
- C = wrist or ankle.
The layout gives the rough idea of the servo orientation and the linkage between B and C.
Does this match your robot layout? I think you have the C servo moved closer to servo B and use a ridged rod to control the joint but that should be mechanically the same, I think. (My mechanical engineering is, um, ... primitive.)
I also need to get a better idea of how you did the A (shoulder) bracket and how you mounted that to servo B. I don't have a 3D printer so I'm fabricating all of this with popsicle, chopsticks, paper, paperclips, screws, and glue. (Yeah, McGyver lives on.)
If you could provide a better view of the servos, etc., I'd be grateful.
If you could provide a better view of the servos, etc., I'd be grateful.
This model isn't really setup to do a good animation but this should give a pretty good idea of how it is setup.
My design does not have a wrist/ankle joint, so the first 2 joints you see are both hip joints so that it simulates a Ball Joint and can move in 3 Dimension. The last joint will control the Knee flexion.
I think you have the C servo moved closer to servo B and use a ridged rod to control the joint but that should be mechanically the same
I have all my servos bunched up by the hip to reduce the torque on the leg by keeping the weight close to the pivot. So I use a pushrod (not modeled in the video) to transmit the force but it is functionally the same as if I placed the servo at the knee joint. Lots of designs do this but I see it as just additional mass far from the pivot and can put more load on the servos.
The issue I was having with the FABRIK library is that my "arm" reaches parallel with the base rotation whereas the FABRIK library has it so the arm moves perpendicular to the base rotation. I was thinking of a way to adapt the library to work, but I'm pretty sure I'm just going to write the code from scratch when I find a bit more time.
This helps lots. Thanks.
I now have to work out the test stand to keep the rig upright.
Will post what I end up with.
I have seen working examples of inverse kinematics on those toy arms without the need for a library?
I have seen working examples of inverse kinematics on those toy arms without the need for a library?
Perfect, this is almost exactly what I intended to do and also more elegant I'm sure.
I'll definitely follow this framework.
Way cool! This reminds me of James Bruton's solution.
Now I gotta try this one and go for his 6DOF arm.
Great find! (XMas came early this year!)