MPSCARA G28: Intermediate position outside machine limits
-
@oliof said in MPSCARA G28: Intermediate position outside machine limits:
Thanks, I will try that tonight!
Just one note: The distal arm can move clockwise beyond 0 if the area is cleared (i.e. when it's not too close to the endstop setup) -- will I lose this reachable area when I set
B0:140
(for accurate values instead of 140)?Yes you will lose that area, however using it means doing an arm mode switch, which you don't want to do in the middle of a print. If it's a problem then I expect I can find a workaround.
-
Not a problem, just want to make sure I understand the implications. Thanks again!
-
It moves! Well, somehow. But as the moves are repeatable, I probably just need to understand what I'm doing wrong. Since I don't yet, no questions right now, just a fun image about what should be some straight lines ...
-
Try sending this command immediately after homing:
G1 S2 X0 Y0
That should centre both arms, so that they are in line. What XY coordinates does DWC show, or M114 return? It should be X200 Y0.
Likewise, if you send:
G1 S2 X0 Y90
then the distal arm should be 90deg anticlockwise from the proximal arm, and the position should read X100 Y100.
-
I looked up some more info from the Marlin Configuration.h included with the model and updated my config.g accordingly (updated version attached).
I also added the G1 S2 X0 Y0 to the homeall.g and the proximal arm moves a couple degrees further than "absolute north", and the distal arm keeps it's relative position in space parallel to the end stop.
Rough sketch (not to scale, angles not representative):
M114 returns
X:109.070 Y:0.000 Z:0.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count 0 0 0 Machine 109.070 0.000 0.000
X109.07 is almost right as I corrected the arm lengths and set the X offset to 90 in accordance to the Marlin Configuration.h from the thingiverse project. I have added it here for completeness' sake. At the end of the proximal arm moving, there is some blocking in the mechanics, possibly because the distal arm moves in the wrong direction and crashes into the proximal arm.
That hypothesis is supported by the fact that if I run
G1 S2 X0 Y90
instead ofG1 S2 X0 Y0
, the distal arm moves clockwise until it crashes into the proximal arm which gets in the way as it travels to it's new position, and if I runG1 S2 X0 Y-90
, the distal arm keeps position equidistant to the proximal joint:Here, M114 returns
X:8.388 Y:-100.660 Z:0.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count 0 -2581 0 Machine 8.388 -100.660 0.000
It's worth noting that the end of the distal arm is pretty much in line with the z axis and the proximal joint after this move.
This probably means the motor for the distal arm moves in the wrong direction after homing? Can I just set
M569 P1 S0
at the end ofhomeall.g
? And then I probably need to calibrate the motor steps ...
files:
-
In your SCARA machine, when the proximal motor turns but the distal motor doesn't, does the distal arm stay pointing in the same absolute direction, or does its angle relative to the proximal arm stay the same?
-
The distal arm stays pointing in the same direction. In the MPSCARA design, the motors for proximal and distal arm are stacked on top of each other, and the distal arm is driven via a 2-belt stack:
| Z | PM...{[PJ]---PA---[DJ]} DM....[DG]˙˙˙˙˙˙˙{[DJ]---DA---} | Z |
- PM and DM are the proximal and distal motors
- PA and DA are proximal and distal arms
- gear belts are denoted with dots (fullstop for the belts from the motors, high dots for the belt from the distal gear to the distal joint).
- PJ and DJ are the proximal and distal joint
- DG is a gearwheel that transmits from the motor gear to the joint gear, moving indepentently. It has one belt connecting it to the motor, and another belt connecting to the distal joint.
- PJ and DG are centered on the Z axis.
-
Did some further thinking and now I think I got the configuration right. The Marlin configuration mentions the distal motor (Y) goes backwards, which makes sense considering it's flipped 180 degrees ...
So I changed the kinematics for the distal arm from
B0:108
toB-108:0
, and inverted the moves for distal arm inhomeall.g
After this, the
G1 S2 ...
moves as requested by @dc42 behave as expected.G1 S2 X0 Y0; M114; X:199.070 Y:0.000 Z:0.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count 0 0 0 Machine 199.070 0.000 0.000 G1 S2 X0 Y90; M114; X:98.388 Y:100.660 Z:0.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count 0 2581 0 Machine 98.388 100.660 0.000
-
The distal arm stays pointing in the same direction.
In that case you need to use the crosstalk factors in the M669 command, because by default the firmware assumes that the distal motor drives the distal joint angle directly. The value I think you need is C-1:0:0.
Edit: but if the machine is now behaving correctly (after you changed the distal joint range), then I am confused.
-
Should I do that in addition to, or in place of, my changes?
-
Please check that when you send G91 followed by G1 S2 moves:
+X moves the proximal arm anticlockwise
+Y moves the distal arm anticlockwise(viewed from above).
-
Viewed from above, without the crosstalk setting but with the flipped Y motor changes, +X and +Y do indeed move the arms anticlockwise.
Without the flipped Y motor, the crosstalk setting does not alleviate the movement confusion I had before.
I can now draw a nice 180 degrees arc by going from X-90 to X+90 (the little line ar Y-90 happened when I accidentally moved the arm noting the coordinates; any deviation is due to mechanical imprecision and angled distortion of the view):
-
That's good. So try this test again:
@dc42 said in MPSCARA G28: Intermediate position outside machine limits:
Try sending this command immediately after homing:
G1 S2 X0 Y0
That should centre both arms, so that they are in line. What XY coordinates does DWC show, or M114 return? It should be X200 Y0.
Likewise, if you send:
G1 S2 X0 Y90
then the distal arm should be 90deg anticlockwise from the proximal arm, and the position should read X100 Y100.
-
G1 S2 X0 Y0 M114 X:199.070 Y:0.000 Z:4.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count 0 0 10240 Machine 199.070 0.000 4.000 G1 S2 X0 Y90 M114 X:98.388 Y:100.660 Z:4.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count 0 2581 10240 Machine 98.388 100.660 4.000
The values are not exactly X200/Y0, X100/Y100 since I edited the arm lengths according to the Marlin configuration that's been made available by the original designer. The proximal arm length is 98.41, and the distal arm length is 10.6, so the values match.
-
Looks good! Is movement working correctly now?
-
I can now issue moves, but I don't get straight lines, only arcs.
I have modified my kinematics with some initial offsets so I stop crashing the distal arm into the proximal arm ... it seems like the A... and B... limits are not used to limit motion (I also entered an erroneous
G1 S2 X6060
once, and the arm promptly tried to do 6060 degrees of counterclock movement, which was stopped by the robot's base of course). The current kinematics definition isM669 K4 P98.41 D100.66 A-108:108 B-108:0 X160 Y-150; setup SCARA kinematics
here are the results from trying to reach the four corners of my currrently defined bed:
G0 X0 Y0 M114 X:-15.497 Y:14.529 Z:4.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count -1071 -329 10240 Machine -15.497 14.529 4.000 G0 X0 Y300 MM114 X:-15.497 Y:285.471 Z:4.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count 1404 -329 10240 Machine -15.497 285.471 4.000 G0 X40 Y300 G0 X40 Y0 M114 X:-1.540 Y:268.845 Z:4.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count 1223 -329 10240 Machine -1.540 268.845 4.000 G0 X0 Y0 M114 X:-15.497 Y:14.529 Z:4.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count -1071 -329 10240 Machine -15.497 14.529 4.000
Further tests show that if I "re-center" the printer with
G1 S2 X0 Y0
, I reach different locations depending on whether I did a move before re-centering or not, or whether I combine X and Y moves.I am trying to plot this so I can show rather than tell, but it's a bit difficult. See the attached photo for some nice arcs that depend on whether I send a
G0 Xn Ym
, orG0 Xn
andG0 Ym
separately -
here are some more tests:
G28; includes G1 S1 X0Y0 -- marked A in the picture M114 X:39.070 Y:150.000 Z:0.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count 0 0 0 Machine 39.070 150.000 0.000 G0 Y0 ; marked B in the picture M114 X:-1.807 Y:30.801 Z:0.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count -895 -329 0 Machine -1.807 30.801 0.000 G0 Y300; marked C in the picture M114 X:-16.267 Y:286.288 Z:0.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count 1413 -329 0 Machine -16.267 286.288 0.000 G0 Y150 ; distal arm crashed due to blockage of end stop trigger block on distal arm -- circled in the picture M114 X:-16.267 Y:150.000 Z:0.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 E7:0.0 E8:0.0 Count 1273 -2511 0 Machine -16.267 150.000 0.000
-
Did you add the C parameter to the M669 command, that I said I thought you needed in my earlier response?
-
I must have inadvertedly removed that while I was trying to find sensible offsets for X and Y ...
C-1:0:0
brings me one step closer, but is not perfect yet. There seems to be some elliptical effect for X moves still that gets more pronounced the more the arm is away from the middle of the bed (i.e., the position afterG1 S2 X0 Y0
). Y moves are still very much arcs, but now the positions from absolute G0 moves match what DWC reports.This is mostly visible in longer moves (more than 2-5mm), so maybe it's irrelevant for my use case where individual moves will most certainly be shorter. I tried to play with the S and T parameters, but I don't know what reasonable values would look like.
Another observation is that only
G0 ...
moves work, whereasG1 ...
moves fail with "intermediate position outside machine limits" -- I guess this is because G1 is special with SCARA kinematics ...G1 S2 ...
still works to set proximal/distal arm angles. I guess the error message is for the usual case of people trying to move beyond axis limits, and not for people that try to do angle-based moves while in a distance-based coodinate system ...Also, final observation: If you set a value at the second or third factor of M669 C, your Z motor will keep going even if you hit the Z endstop. Don't do that (-:
-
@oliof said in MPSCARA G28: Intermediate position outside machine limits:
C-1:0:0
brings me one step closer, but is not perfect yet. There seems to be some elliptical effect for X moves still that gets more pronounced the more the arm is away from the middle of the bed (i.e., the position afterG1 S2 X0 Y0
). Y moves are still very much arcs, but now the positions from absolute G0 moves match what DWC reports.This is mostly visible in longer moves (more than 2-5mm), so maybe it's irrelevant for my use case where individual moves will most certainly be shorter. I tried to play with the S and T parameters, but I don't know what reasonable values would look like.
Are you referring to G0 moves or to G1 moves? G0 moves will always be curved.
If G1 moves are curved, then the M669 parameters are not correct for your machine. In particular:
-
The distal arm homing angle must be accurate. RRF assumes the distal arm position when the distal homing switch is triggered is either the first or second B parameter, depending on whether you have a high or low end stop position configured in M574. As I recall, you home with the proximal and distal arms in a straight line, so the distal angle is zero, which is why one of your B values is zero. But are the arms exactly in a straight line? If not then you will need to adjust that B value to be the actual angle. For example, if the distal arm is slightly rotated anticlockwise with respect to the proximal arm, then that B value should be slightly positive.
-
The proximal and distal arm lengths must be correctly configured. The proximal arm length is measured between the proximal and distal bearing centres. The distal arm length is measured from the distal arm centre to the nozzle.
You may find it helpful to read section "Calibration" at https://miscsolutions.wordpress.com/2017/08/27/converting-the-robotdigg-scara-printer-to-duet-electronics/.
Another observation is that only
G0 ...
moves work, whereasG1 ...
moves fail with "intermediate position outside machine limits" -- I guess this is because G1 is special with SCARA kinematics ...G1 S2 ...
still works to set proximal/distal arm angles.G1 moves will succeed if the initial position, final position, and all intermediate positions are within the limits you set using M208 and are also reachable. Note, the position after homing the arms is considered to be just outside the reachable area. So at the end of your homing file, use a G0 move to put the head within the reachable area.
Also, final observation: If you set a value at the second or third factor of M669 C, your Z motor will keep going even if you hit the Z endstop. Don't do that (-:
Yes, because those 2 parameters tell the firmware what effect the proximal and distal motors have on the Z height. This is needed for printers such as the Helios.
-