I originally created this for my school's FTC team as this year we are using a setup where our manipulator is two joints mounted at the end of a linear slide. However, this program is overkill for our application so we likely won't end up using it but it was still a fun project to make. It is a bit buggy sometimes as I haven't had time to work on this anymore. I also didn't use a ui library like react, which I am regretting, though I thoroughly enjoyed working on this project.
The main idea is that you can define the points for a parametric natural cubic spline (see wikipedia) and have the robot arm follow this path. Originally I was trying to use bezier curves but switched to natural cubic splines.
This project can be interacted with here (you need to use a mouse on computer; trackpad is insufficient): https://jacobh460.github.io/robotInverseK/
Controls:
- Hold middle mouse button and drag to pan

- Scroll to zoom in/out

- Add handles by pressing the lower plus button on the right

- W highlights the area the arm is capable of reaching in green

- Q turns on trace which draws a line (yellow) showing the path the robot arm will actually take (as opposed to the spline which the arm sometimes cannot reach)

- Drag the slider left and right to move the end effector along the spline

- Extra constraints may be added at specific handles for end effector angle (theta_b) or lift length (l1). Attempting to constrain both overdefines the system. For example, constraining theta_b at the last handle:
