This Fuction is set up the class to calulate the forward and inverse kinematics for the delta. ArmLength, RodLength, BassTri and PlatformTri are the set values from the Delta robot defined as the following:
ArmLength: Lenght of the first arm (mm)
RodLength:Lenght of the second arm (mm)
BassTri: Distance (Sb) of the upper platform (mm)
PlatformTri:Distance (Sp) between the axle and the lower paltform (mm)
See image below to see how to take the measurement.
Millimetre, meters, inches or any other lenth measurement can be used for ArmLength, RodLength, BassTri and PlatformTri. The measurement will need to be the same for x, y and z.
For my delta robot this line would be as (in mm):
DeltaKinematics DK(63,125,030,85);
Another library would be AccelStepper which provides an object-oriented interface for 2, 3 or 4 pin stepper motors and motor drivers.
I started with the code using in this project and modify it based on my own data. (stepPin and dirPin assigned to each driver and also the free pins in the board).
As I explained in Electroncis design and production, I had three limit switches on the upper plate connected to the main board that could be touched by the upper arm and helped me to find the origo. I used the free pins on the microcontorller by:
#define ALimitPin 9
#define BLimitPin 10
#define CLimitPin 11
After several tries, finally, I set the home positioning by measuring the approximate angle of arms.
Then, I needed to figure out guiding the steps. First, I started with z positioning and then, added the movements in x and y directions. I started with the z movement (here, upper moves are assigned with minus values according to the aligmnemt of the axis) and then, added moves to x and y.