Feature/automatic threading#46
Conversation
Added automatic threading settings popup
Started adding wizard logic
Added logic so that step 2 allows manual input; Added logic to convert manual inputs to encoder_steps
Added logic to check for valid stop position
…nvert position to units based on scale ratio; Added steps for material width a doc; Refactored wizard to make some functions re-usable;
Added warning popup when there is mismatch between expected saddle start position and current position; Fixed random bugs causing app to crash when not connected; Fixed wizard stop logic; Fixed goto_next_step logic to only proceed if wizard is running and IFF the callback allows it to proceed - this is required for when we are waiting for the servo to finish
…even if cursor leaves button area; Added logic for retracting of saddle; Added logic to stop wizard if switching between modes;
…nstead of uint8_t as this was causing issues when communicating with the firmware; Started fixing bugs with scales not always having positive ratios; Fixed issue with retraction jog_speed; Fixed issue with servo not being turned off when stopping Assisted Threading; Fixed issue with go_to_start step not properly checking that cross_slide has been retracted;
WIP - further bug fixes on the assisted threading wizard; Minor code clean-up on assited threading wizard;
…y sets the sync ratios; Continued fixes to the assisted threading logic;
Converted the servo threading to use thread remaining steps which is a signed Int for direction purposes; Servo will remain being enabled once threading operation starts instead of disabling it each time after each step - servo will only get disabled if the threading operation stops. This was done since for small steps, sometimes the servo is enabled too late and it doesn't turn in time; Direction for servo retract and cut should be fixed and working well depending on scale, spindle and servo directions;
Added logic for better preload and adjust steps by waiting for the scale encoder to stop changing
Minor fixes + improvements
…h inthread_profile_type (strEnum and StringProperty)
… values; Removed logic for getting cutting depth from scale position;
Added threading max speed; Bug fixes;
Fixed issue with the backlash cusion not being displayed properly because of int conversion
…n wether ELS or AT is selected; Commented debug logs when waiting for threading done
Added decelaration on retract;
… firing before the firmware gets updated with the new state
…thon into feature/AutomaticThreading
…sideration when it shouldn't as the PPR is per revolution not per degree
|
This feature evidently also requires your corresponding changes to the STM32 firmware ( PR: bartei/rotary-controller-f4#12 ) in order to function - a rather important detail for this PR! |
|
This is rather timely, as I am currently working on revising the ELS UI and was beginning to add the capability to turn or thread up to a shoulder with electronic stop, jog to retract, and re-sync for the next pass - similar to what you've done, but less automated. I already made my own firmware changes, but with a different approach than you used. I'll take a closer look at what you did and consider whether I want to adopt your approach instead. |
Yes! I knew I was missing something when writing the description. Thanks for pointing it out - updated it accprdingly
Glad to hear it might help, hope that maybe we can find a middle ground so we can merge this to main 😊 |
Agreed! On the firmware front, it's interesting to me how differently you and I approached the challenge of accomplishing the electronic stop and maintaining sync between spindle and leadscrew between passes. I don't think either is right or wrong, just very different, so I'm having a hard time comparing to decide which I like better! On the software front, I was planning to integrate into the ELS mode page and support simpler use cases like turning up to a shoulder. The wizard approach is great for automated threading cycles, I'd just like to figure a way to fall back to a simpler UI workflow for the simpler/less-automated use cases without needing to have a separate mode/screen for it. |
OK I'm curious now how did you do it on the firmware side? 😁 Oh and I had some help from chatgpt to get good ideas on how to do it so I can't take full credit for it XD |
I'd describe my approach as being a digital adaptation of the way an operator would thread on a purely mechanical lathe using the half nut and threading dial:
For that last step (re-sync), I could take inspiration from your implementation and rather than doing the short re-sync move, just wait for the spindle to rotate into phase before resuming - then it would be even MORE analogous to using a threading dial. I'd describe your approach as CNC-like, as you're calculating the cutting move (# steps) in software up front before starting the move. Makes sense for the automated threading use case, as you're basically implementing a whole canned cycle that just happens to involve some operator intervention. So now the questions I'm thinking through are:
Oh no worries, Claude is helping me out, I'm just being rather prescriptive about how I want it implemented :)
Makes sense. What I was thinking is that by default, the ELS screen would come up in basic mode, no advanced features enabled and looking pretty much the same as it does now, just with a button for toggling the advanced features on/off. When toggled on, a new bar would appear (either above the ELS bar, or right below the Z axis bar) that would have some UI controls for simpler electronic stop use cases (e.g. turning up to a shoulder), and then a wizard button that would bring up your assisted threading wizard instead for the max level of automation. |
|
Not sure I'm fully following your approach but then again my engineering and lathe skills suck (hence why I really wanted to implement this assisted threading xD) First priority though I think would be to split the wizard into separate files for better readability and testing. Github copilot came with a nice plan, but broke everything during implementation. Still need to try Claude (ran out of credits last time xD) In the meantime I also want to try and implement a compound slide feature where the els advances just slightly for each doc based on a calculation (which I still need to learn 😅) |
Similar to what you achieve by setting the compound to roughly half the thread angle and advancing the tool from pass to pass using the compound instead of the cross-slide - except leaving the compound slide out of it and accomplishing the compound movement electronically instead? Neat idea, and wouldn't take much to implement.
Sounds similar to the indexing feature of the existing RCP Index mode screen, which seems to be oriented toward cutting/grinding spiral flutes - which are basically multi-start threads, in a way. I don't think it would take much... in my FW I'd just increment the leadscrew by an offset equal to / . In yours, I think you'd just increment your latched spindle phase by / . The UI could just be a copy-paste from the Index mode screen. |
In theory yes. But I tend to realise that what seems simple in my mind always ends up in opening a can of worms and bugs :D
Yes i might take some of the UI from that. However I was thinking most of the setup would be done in the popup, and once you finish one thread cut at full depth, then you move to the next one. Still need to have a proper think about it. |
|
To avoid further cluttering your PR, I started an issue on my own fork for further discussion about the alternate implementation I'm working on. I welcome your feedback/collaboration. I completed an initial mockup of how I envision it all being visually integrated into the ELS mode screen, with an incremental approach where the user can enable progressively more automation as they choose, from basic turning up to a shoulder all the way up to the mostly-automated assisted threading wizard based on your implementation. Screenshots and explanation are in the above linked issue. |
Disabled sync toggle on scale when in Assisted Threading mode - this will be handled automatically; Fixed compound z offset calculation
Summary
IMPORTANT: Requires the corresponding PR on the STM32 Firmware in order to function: bartei/rotary-controller-f4#12
Add assisted threading support to, including the AT wizard flow, spindle sync / pitch validation, LHT/RHT fixes, and UI integration. This branch also includes upstream
dev/mainmerge work and stabilization for the new assisted-threading feature.What changed
Added Assisted Threading UI and wizard flow:
rcp/components/home/assisted_threading_bar.pyrcp/components/home/assisted_threading_wizard.pyrcp/components/home/assisted_threading_settings_popup.pyrcp/components/home/at_mode_layout.pyAdded thread type and AT mode support:
rcp/components/home/thread_type.pyrcp/components/home/coordbar.pyrcp/components/home/dro_coordbar.pyrcp/components/home/servobar.pyFixed issue with servo/spindle sync in ELS mode:
rcp/dispatchers/axis.pyAdded/Updated UI/screen components
Behavior
Notes