Feature/assisted threading#12
Conversation
…ue with the python data struct types;
Moved assisted threading variables into own struct;
…signed Int (for direction)
…into feature/AssistedThreading
…rotary-controller-f4 into feature/AssistedThreading
|
It would be advantageous if you and I could converge on a common firmware approach to support your Automatic Threading wizard and my Advanced ELS mode features on the UI side, so that those features aren't mutually exclusive. To that end, I'm currently working on a branch where I've merged both of our changes and updated the FW/HW emulator accordingly so that I can test out our respective firmware features side-by-side, compare and contrast, and determine whether one or the other (or some combination of the two) can support all of our use cases. |
|
Happy to discuss further if need be. I also like the ui you did btw 😁 |
|
I'll offer some more specific thoughts/feedback/recommendations once I've had a chance to complete an initial assessment and we can discuss further from there. |
Sounds good ok :D |
|
I'm still working on more of a functional assessment, but got derailed with UI and state machine refactoring along the way. In the interest of time, here is my current impression of how our approaches compare based on code review: Pawcu approach: (please correct me if I've misinterpreted any of this from the code)
Pros:
Cons:
Funkenjaeger approach:
Pros:
Cons:
CommentsI think both have their pros and cons, but I also think it may be possible to merge the positive aspects of each. For instance:
I don't completely love the added complexity of having to manage backlash in order to re-sync off of the scale, but IMO the option to allow free use of the half nut may make it worth the trade. I think I can envision a workflow where once the operator configures and starts the cycle, the whole threading cycle can be done using the mechanical controls on the lathe without needing to touch the touchscreen at all between passes. Thoughts? Concerns? |
|
I'd love to discuss this further with you as to be honest I never considered my approach to be used for turning, only for thread cutting. If we start thinking about the cutting to a shoulder, maybe we could also consider adding logic for a 2nd servo? Just thinking out loud. |
The leadscrew/power feed on a lathe supports two main operations - turning and threading. Turning is functionally the same as threading, except the phase doesn't matter. It doesn't seem efficient to me to ignore one of the two, or to implement entirely separate logic, when one is just a simpler version of the other and both can be accommodated with a common implementation. I think that applies both in FW and in the UI.
To be clear, when I say 'turning up to a shoulder' I am only talking about the turning operation, i.e. cutting moves electronically stopping at the configured Stop Z position - just the same as you do in your threading cycle, just ignoring phase sync. I'm not suggesting that facing off the shoulder would be automated as part of this. That's very easy for the operator to do manually at the end of the cycle by releasing the half nut, manually advancing the carriage just slightly, and retracting the cross-slide. I'm not suggesting bringing a 2nd simultaneous electronically controlled axis into the equation, which would start down the slippery slope toward a full CNC conversion. |
Maybe - like i said i still need to find some time to understand a bit more how your approach will work. I didnt have a lot of time to think about it yet but would it potentially overflow some of the variables if you try to keep track of phase between spindle and servo (especially if servo is using a lot of steps for each turn?) - just thinking out loud at the moment and like I said haven't given it a lot of thought.
Yeah i do get what you mean - i guess i've already started thinking of a cnc conversion😅 |
Just using napkin math, the max step rate that most stepper/servo drivers can even handle is in the ballpark of 200 kHz. At that rate it would take just shy of 3 hours to overflow an int32 accumulator. That's a highly unrealistic corner case, and anyway it's quite trivial to detect and mitigate such an overflow condition. Not a problem.
I get it... like I said, slippery slope. This is currently nowhere near to what a CNC-ready implementation would look like, since that's not what it was designed for. Trying to make it so would be a huge effort to reinvent a wheel that's been done quite well in many other places, while making it worse for its original intended purpose (especially in terms of overcomplication). |
|
I have an initial version of this experimental new automated ELS firmware variant on this branch. As indicated above, my intention here was to merge what I see as the best attributes of your and my original firmware approaches. ELS Stop behavior summary:
Benefits, in my opinion:
There's a writeup here with more information: I've got more work to do with general cleanup, removing temporary debugging instrumentation, testing etc., but so far it seems to be working for me in the full wizard-based automated threading cycle based on your UI work. |
|
Thanks for your contributions folks! I will take some time to review and test the changes as soon as i have a minute! |
Summary
Add assisted threading support (also contains changes from main)
What changed
assistedThreadingData_tstructure inCore/Inc/Ramps.hrampsSharedData_tCore/Src/Ramps.cgetSpindlePhase()calculates spindle phase from encoder positioncomputeServoStepTolerance()defines safe completion tolerance per control cycleapplyAssistedThreading()handles host request / latch / wait / phase match / move completionSynchroRefreshTimerIsr()whenservoMode == 1threadRequestthreadResetspindleScaleIndexthreadPhaseTolerancethreadRemainingStepsthreadStartStepsspindleCountsPerRevBehavior
threadRemainingStepsfor proper direction-aware step trackingBenefits
servoModebehavior intact while extending indexing mode