Reporting Current 1HCL Encoder Count and Position Error Flag
-
I have a non-printer application that consists of a Duet 6HC in CNC mode with 3 3HC boards, and 3 1HCL boards over CAN. All boards and DWC are at firmware 3.5.1
For my initial testing of closed loop mode, I have a NEMA 17 with quadrature encoder connected to one of the 1HCL boards.
Everything wired up and tuned out just fine. When I force a position error by holding the motor shaft while performing a move, I get this in DWC:5/28/2024, 10:07:40 AM Warning: Driver 50.0 warning: position tolerance exceeded
I also get this when I go to far with the error:
Event notification Driver 50.0 error: failed to maintain position
So, all is well on the setup and wiring front. I can run open loop and closed loop modes without issue.
Our system is in SBC mode with a Pi 5 running the latest Duet Bookworm image.
We have a Python app on the Pi using dsf to communicate to the Duet. It is displaying information and performing control similar to DWC. We are using the app because we don't want to give our users as much control/access as DWC. We are reading the object model every half second or so (we are working on implementing the "subscription" method of reporting changes only through dsf).M122 B50 reports (edited to just show up to the "pos" value...):
5/28/2024, 10:07:46 AM M122 B50 Diagnostics for board 50: Duet EXP1HCL rev 1.0a or earlier firmware version 3.5.1 (2024-04-19 14:42:46) Bootloader ID: SAME5x bootloader version 2.8 (2023-07-25) All averaging filters OK Never used RAM 75428, free system stack 184 words Tasks: Move(3,nWait 7,0.0%,108) CLSend(3,nWait 6,0.0%,148) HEAT(2,nWait 6,0.0%,106) CanAsync(5,nWait 4,0.0%,67) Driver 0: pos -15976, 80.0 steps/mm, ok, SG min n/a, mspos 8, reads 21606, writes 21606 timeouts 0, steps req 0 done 0
Running the motor a quarter turn or so and another M122 B50 reports:
5/28/2024, 10:08:16 AM M122 B50 Diagnostics for board 50: Duet EXP1HCL rev 1.0a or earlier firmware version 3.5.1 (2024-04-19 14:42:46) Bootloader ID: SAME5x bootloader version 2.8 (2023-07-25) All averaging filters OK Never used RAM 75428, free system stack 184 words Driver 0: pos -11988, 80.0 steps/mm, ok, SG min n/a, mspos 8, reads 43734, writes 43736 timeouts 0, steps req 0 done 0
I found these additions in the object model when I added the 1HCLs and enabled closed-loop mode:
I see a few of the values update in real time, but there is no "latch" when a warning or error occurs.
I couldn't find the pos value anywhere nor a latched boolean signifying the position warning or error.I'm currently monitoring those values in the python code and then latching my own bit to "remember" the fault.
My questions:
How do I get the "pos" value, either in G-code or from dsf call? I.e., -15976 and -11988 from the above snippets
How do I detect the warning and/or error that is generated when the encoder error exceeds the values set in config.g? I.e., the warning and error messages aboveI saw this in the wishlist:
https://forum.duet3d.com/topic/34183/implement-m593-3-read-motor-driver-encoder-in-the-1hcl?_=1716905999470
So, I've added my voice for the feature. -