Here I disclose my experience using Marlin for my scara robot. I’ve had published the code here:
Please be aware I don’t intent to release a new Marlin “scara” version; this code is just for Virk I. However, maybe it could be useful for someone else.
Current status of scara support
After googling a lot and testing several Marlin versions, I concluded that the “newest” Marlin version with working scara support is 1.0.2. Maybe I missed something, but it’s known that scara support is broken on last versions.
So basically you can use 1.0.2 for a parallel scara 3D printer without modifications. However, Virk isn’t a printer and required some changes.
Changes for Virk
Most of hard work was already done; all I did was some small modifications. Main changes were:
- Homing setup: I’ve had added minimal and maximal angle for rotary joints, and target angles for homing position.
- M667 / M668: By default, the scara mode is “left” (like a right human arm), but you can change to “right” arm using M668, and go back to left using M669. I’m aware a smarter approach would be a nice addon, but this works now.
- M669: this is a gripper mcode M669 S<servo_pos> P<active_time>. P is optional; default <active_time> is 500. I guess I will change this to receive the size of the target object, instead of the servo position. As I said before, a SFR sensor would be a better way, but it’s out of the scope by now.
- checkScaraDestinationAngles() check the angles never go outside range.
- trimCartesianDestination() trims movements outside reachable area; the arm go as close as it can.
- Forward and inverse kinematic transform: my robot wasn’t a parallel scara, so calculate_SCARA_forward_Transform() and calculate_delta() were changed for “standard” scara (every motor coupled, independently, to its link).
- Servo disable: a servo is disabled when -1 is passed as parameter. This was required for M669.
Please note I’ve not included standard configuration like lenght of scara links or motor setup, as those are just setup and not my changes.
You can see most of these changes in this commit.
- It’s better to start testing Marlin into non-scara mode. A positive move should result into a counter-clockwise move, in the X (shoulder) and in the Y axis (elbow). Homing should also work if properly configured. Then, you can enable scara mode.
- Finding the right jerk parameters it’s just a trial/error process. Please note my Z axis, unlike rotary joints, is rigid, hence the z jerk for Virk should be lower (actually 0), otherwise it could miss steps . High jerk values on X and Y seems to help reach higher speeds.
- My coordinated system: 0, 0 at the robot center, Y towards front, X towards robot right.
- If you have different motor configuration I can consider to add as an option, if doesn’t involve to much time and its a generic, non specific case. Seduction is a very bussy business, you know :D.
A note about Wangsamas
Wangsamas firmware, Repetier based, has very nice features, and in some of my tests it seemed to outperform Marlin. However, I wasn’t able to solve some issues, so at this moment I will stay with Marlin.
I guess the best open software for controlling a cnc robot is, actually, linuxcnc. However, Marlin is a great starting point … why kill the ant with a tank. Smoothieware … who knows. Machinekit … looks cool.
And now the most importat question… ¿should I add a 4th axis? (gripper rotation) ¿what do you think?