What do you look for in good code for a robot arm?

I’ve been working on my #MeArm project since February and we have a fair bit of code floating around for it now. The stuff I’ve actually written is fairly basic, connecting four potentiometers to four analogue pins and driving four servos from the PWM pins (on github here). In the same repo I have the beginnings of some inverse kinematics code but stopped working on it when others started to contribute libraries which frankly are beyond my current coding abilities and seem far more useful than mine!

I’m about to head back into my own IK code and wondered what would be considered to be useful in a basic IK library for similar servo controlled arms like the uArm and #MeArm? My initial thoughts are:

  • Easy access to variables for the lever lengths
  • Pulse widths for different servo types
  • Some kind of calibration variables for the physical stop points on the arm
  • Slow move to position for starting values of servos (pressing reset scares kids silly!)

I’m interested to know what people more expert in the field of Arduino robotics think should be included or even if there are some good examples out there already that I can be pointed towards. I’m keen for any feedback on the project at all really, so please let me have it (good or bad!).

Easy access to variables for the lever lengths

If you can develop the proper equations for the movements, you might put them in a spread sheet that has computational capabilities.

Pulse widths for different servo types

Most hobby servos use standard RC command PWM. What other servos are you considering? Advanced servos like the Dynamixel types?

Some kind of calibration variables for the physical stop points on the arm

You should be able to test the physical limits of a servo in the arm and set high/low position limits in the code.

Slow move to position for starting values of servos (pressing reset scares kids silly!)

Generally speaking you would need to know the current position of the servos in order for them to start moving slowly to another position. Easiest thing to do is have the arm parked in a known position before commanding it to move to another position.