Replies: 5 comments 20 replies
-
On the UGS website, it says “ real time tool position feedback”. What is meant by that? Theoretical position or actual position? Having done some more research, I believe the above closed loop implementing could be achieved by using this library: https://github.com/PaulStoffregen/Encoder I’m not sure having 3 separate encoders (on a dedicated MCU) while writing the positions via serial/usb will work as expected, yet another experiment in the pipeline. It wouldn’t really make sense to implement, if we loose encoder pulses. Ultimately it depends on MCU speed vs encoder pulse frequency. I do believe it is important to have the encoders on the same MCU in order to synchronize the sensed positions. According to the above lib. Doc. Page the teensy 2.0 (16Mhz 8bit MCU) has a maximum interrupt freq of 127 kHz. Not bad for a AVR. If doing a feedrate of 762mm/min the stepper will rotate at 6.35 rps which translates to (6.35 x 4096) 26.000 changes in states (interrupts). This is using a 8mm pitch lead screw with a 4:1 belt gearing. Hmm 🤔 the SAMD21 runs at 48Mhz and it’s a 32bit MCU. The conversion from step/encoder pulses to mm could be done on the UGS side. How often the encoder position should be sent to UGS I’m not so sure. It would be like points on the Gcode “line”, which will make it possible to catch those microsteps lost in action. If the machine has two Y axis steppers, then misalignment could be corrected, maybe during a brief pause. From this lib. Git page it says that windows will accept a 8ms USB data transfer frequency. https://github.com/abaelen/Arduino-Isochronous-USB So, with a 762mm/min feedrate (12.7mm/sec) the dots will be 0,1016 mm. a part. For resetting the encoders to zero position, one idea could be to have the stepper controller pull a pin high or low, since Isochronous USB is a one way stream. This should make the MCU go into programming or setting mode, so we can talk to it. |
Beta Was this translation helpful? Give feedback.
-
Hmm.. arcs would be a challenge. I guess we know the center of the arc? Maybe it can be done with math, the visual approach would perhaps be too flimsy. So if the sensed coordinate is between two points representing a arc in the Gcode, run the arc math to get distance to Gcode path. Maybe you can even extrapolate the feed rate if the data is coming at a fixed interval? You are the expert 😅 The Z axis should have its own 2D window synced with X and Y to enable 3D carving. |
Beta Was this translation helpful? Give feedback.
-
You might be interested in klipper. I understand that it works with step
planning for one or more controllers on a computer and the controllers just
need to deal with timing the steps properly.
https://www.klipper3d.org/Features.html
I'm not sure what this sort of scheme has to do with UGS. Maybe you could
implement a klipper mode?
Will.
…On Fri, Aug 26, 2022, 11:41 AM Juan-Antonio Søren E. Pedersen < ***@***.***> wrote:
What about backlash?
From my understanding backlash will not effekt the final result if one
does a rough pass and then a final or several detail oriented passes.
Linear encoders would be a step up I guess. Maybe that should be my focus.
Anyways, thank you for your feedback and eyes on this. Keep up the good
work!
—
Reply to this email directly, view it on GitHub
<#1967 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA6URPG57I24UOYMR5PBWLV3DQTDANCNFSM57L36T3A>
.
You are receiving this because you are subscribed to this thread.Message
ID: <winder/Universal-G-Code-Sender/repo-discussions/1967/comments/3484993
@github.com>
|
Beta Was this translation helpful? Give feedback.
-
Hi @winder Time has passed, and I think I’ve found a viable solution, that could work with UGS. In the search for a S-curve planner algorithm, that can work with SimpleFOC, closed loop field oriented control, I found a paper describing a math-concept for that. The math checks out, and I’m able to calculate some pretty smooth trajectories. here is the dev repo: https://github.com/Juanduino/S4_CurvePlanner/tree/main My initial focus was just getting this working with OpenPNP, which has several options for the level of Gcode control. The simplest being just point-to-point commands w. M400. Naturally we can still adjust jerk, acceleration, feedrate for individual tasks, like nozzle change etc. So how can this benefit UGS. Well the math-concept does not end with point-to-point moves, but actually goes into multi-axis/joint synchronization. This means, we can place part of the algorithm in the UGS Gcode parser and send time synchronized moves to independent sub-nodes (eg. a USB connected motor controller running SimpleFOC). On a CNC or laser-cutter etc. having the option to use open-source servos (real closed loop control) should provide a substantial upgrade. Especially for larger system, outside the range of stepper-drivers. Theoretically the math in C++ can be integrated through a DLL in UGS or it can be ported to Java, I’m not able to discern if running C++ in a Java application has drawbacks? What is needed: In order to connect each sub node, either through serial or dedicated USB device, this should be an option in the GUI. Naturally, if selecting this S-curve mode, it should use the S-curve math. According to the paper, they did 100 trajectory planning calculations in 1.5 milliseconds on a PC. There should be some level of time-syncing between the host and the nodes. In essence it is what Klipper does for stepper-drivers, calculating steps, times etc. but with a focus on closed loop control, which will open up the whole concept to potentially more powerful BLDCs as well. The math-concept does not mention time-stamping the commands, and each trajectory calculation does involve timing the move. When syncing the moves, the algorithm should first calculate each axis/joint for the given move, then the longest move is selected and the rest is scaled to match, using a scaling factor. The motion handling will be on the MCU. Either all the trajectory planning should be on the host-side or just the syncing and the planning then happens on the MCU with the scaled jerk, acceleration and feedrate/velocity. |
Beta Was this translation helpful? Give feedback.
-
Description
Hi!
First of, great work on UGS.
I’m new to CNC, but do have prior experience with smoothieware on a PNP.
Since I’m in the process of building a machine, the obvious closed loop question has risen. UGS support several Gcode executors and each of them has support for several drivers, so implementing closed loop in the sender_layer seems like the appropriate approach.
Imagine having a dedicated quadrature encoder “controller” with magnetic encoders on X and Y axis (possibly two on Y axis for dual stepper support). This dedicated MCU (not connected to the executing MCU) should feed sensed tool position to UGS (virtual machine) in order to compare the Gcode path, to the actual sensed path. If a deviation is recognized, it means some steps are lost, and UGS should take proper action eg. Pause the job or correct the path.
By offloading the executing MCU, having UGS close the control loop, the user would be able to visualize if the desired precision of the machine is achieved with the current settings for feeds and speeds ( aka control loop).
In a sense this feature would run parallel to the job, just observing the recorded tool path, but should be able to take action if a deviant (from the planned path) is recorded.
Does such a plug-in exist already?
Beta Was this translation helpful? Give feedback.
All reactions