Implement M593.3 Read Motor Driver Encoder in the 1HCL. Have it work in open loop as well as closed-loop and assisted open loop.

Best posts made by LindsayC
-
Implement M569.3 Read Motor Driver Encoder in the 1HCL.
-
RE: Implement M569.3 Read Motor Driver Encoder in the 1HCL.
@T3P3Tony It's is sort of round about, but it works reliably.
Latest posts made by LindsayC
-
RE: "M569: expected numeric operand" error.
And finally if you run this code where you just pass a string to the P parameter.
var ind = 0 var driverAddress = "51.0" M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
You get this error message:
Error: in file macro line 3 column 27: M569: expected driver IDWhich is different to the error message you get if the variable is obtained from the object model.
-
RE: "M569: expected numeric operand" error.
Did a bit more digging into what the type is. If you run this code:
var ind = 0 var driverAddress = 50.0 echo var.driverAddress; echo var.driverAddress ^"1"; echo var.driverAddress * 2 while exists (move.axes[{var.ind}].letter) ;go through all axis in order till I find the correct one. if move.axes[{var.ind}].letter == "'a" set var.driverAddress = move.axes[{var.ind}].drivers[0] set var.ind = var.ind +1; echo var.driverAddress echo var.driverAddress ^"1"; echo var.driverAddress *2;
You get:
50.0
50.01
100.0
51.0
51.01
Error: in file macro line 14 column 26: meta command: expected numeric operandsSo the variable returned from the object model for the driver can address can be treated as a string but not as a float. While the original set address that does work for the P parameter can be treated as both a float and a string.
-
RE: "M569: expected numeric operand" error.
Hi,
Upgraded to 3.6.0-rc.1.
And if I run this code:
var ind = 0 var driverAddress = 50.0 while exists (move.axes[{var.ind}].letter) if move.axes[{var.ind}].letter == "'a" set var.driverAddress = move.axes[{var.ind}].drivers[0] set var.ind = var.ind +1; M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
it fails with "Error: in file macro line 9 column 29: M569: expected numeric operand"
If I echo what the variable is. Ie this code:
var ind = 0 var driverAddress = 50.0 echo var.driverAddress while exists (move.axes[{var.ind}].letter) ;go through all axis in order till I find the correct one. if move.axes[{var.ind}].letter == "'a" set var.driverAddress = move.axes[{var.ind}].drivers[0] set var.ind = var.ind +1; echo var.driverAddress M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
I get this from the console:
50.0
51.0
Error: in file macro line 9 column 29: M569: expected numeric operandBut if I run it with just a hard set driverAddress like below.
var ind = 0 var driverAddress = 51.0 echo var.driverAddress M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
It works fine with no error.
Output from console:
51.0This is all on a duet3 in standalone mode.
-
RE: Implement M569.3 Read Motor Driver Encoder in the 1HCL.
@T3P3Tony It's is sort of round about, but it works reliably.
-
"M569: expected numeric operand" error.
I'm trying to use the object model "move.axes[X].drivers[0]" can and driver address to use in M569.X commands to setup closed loop (1hcl) during a home without having to specifically put it in the can address into the home file. Essentially I search for the drive letter, and when I've found it I want to set a variable that has the address. Unfortunately there doesn't seem to be away to turn the string "51.0" in the object model into 51.0 (float?) in the m569.X commands. For instance.
var address = 51.0
M569.1 P{var.address} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
Will work fine.But below code gives a "M569: expected numeric operand" error.
var ind = 0
var driverAddress = 0.0while exists (move.axes[{var.ind}].letter) ;go through all axis in order till I find the correct one.
if move.axes[{var.ind}].letter == "'a"
set var.driverAddress = move.axes[{var.ind}].drivers[0]
set var.ind = var.ind +1;M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
-
RE: Implement M569.3 Read Motor Driver Encoder in the 1HCL.
@LindsayC Although weirdly the position error is associated with the 1HCL board driver itself (boards->2->drivers->positionError) and not the axis it's assigned to (Move->axes) as you'd expect.
-
RE: Implement M569.3 Read Motor Driver Encoder in the 1HCL.
@dc42 I have an application with hard mechanical endstops for 2 positions built into a rotary valve. driven through a gearbox (5:1 precision planetary) with a NEMA 17 stepper and encoder. Angles can be between ~10 degrees up to ~90 degrees depending on application between the stops depending on valve design. In the application getting between the 2 positions quickly (sub 200 ms) and accurately is useful for various reasons.
The idea is to home and accurately find the 2 relative positions. First move in one direction stall and find the angle between them by finding the stall position and corresponding encoder count for position 1. Then move in the opposite direction till I hit the stop and stall and find the encoder count there and calculate the 2 positions based on that information . I have now discovered that there is a position error in full steps in the object model I can use instead that should work for this purpose when combined with the current position.
-
RE: Implement M569.3 Read Motor Driver Encoder in the 1HCL.
Another option. Rework M569.5: Closed loop data collection, so it can output to the standard output (eg the console) instead of to a file. This way it is something G-code could read back in the "reply" parameter and use, as well as external programs just getting the data stream directly instead of having to ask to download the file created and then parse it.
-
RE: Implement M569.3 Read Motor Driver Encoder in the 1HCL.
That should be M569.3. Typo in the title.
[Fixed by Moderator]