Real Time and Latency

More
1 year 5 months ago #328083 by ogogon
Replied by ogogon on topic Real Time and Latency

The values for step & direction are part of the ini file and can be adjusted to suit many stepper driver products.
With a 25000 ns base thread motion will be based on this.
External motion control is usually based on a 1ms update period.

Hence the reason a known & steady latency is important, regularity is an important factor, like a band if the drummer isn't regular, uhmmm like Lars from Metallica, things don't work as well as they should.
 
Regarding the step value and the ini file. Correct me if I'm wrong, but its linear value is specified there, not the execution time. (When I set up my CNC, there was no talk about time.)
When we start discussing milliseconds, it means that we have accepted as a given the position about the need for parallel execution of commands on different axes.
Maybe this is true, but I do not yet fully understand the wisdom of this idea.
Where can I see materials about this?

Please Log in or Create an account to join the conversation.

More
1 year 5 months ago #328084 by PCW
Replied by PCW on topic Real Time and Latency
LinuxCNC works identically to most CNC systems in that it outputs
a stream of joint/axis position coordinates (waypoints) at a fixed rate.

In LinuxCNC this rate is called the servo thread rate. This is typically
1 KHz in LinuxCNC but can be higher. In addition, either LinuxCNC or
downstream hardware interpolates between the position waypoints
so smooth motion is generated.

Simple LinuxCNC systems using a parallel port or GPIO do the interpolation
and step/dir generation with a second, faster real time thread, called the base thread.

More complex systems do the interpolation in external hardware or processors
(Mesa cards, Remora, RIO etc) or in the motor drive itself (EtherCAT) and typically
do not use a base thread.

 
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
1 year 5 months ago - 1 year 5 months ago #328094 by ogogon
Replied by ogogon on topic Real Time and Latency

LinuxCNC works identically to most CNC systems in that it outputs
a stream of joint/axis position coordinates (waypoints) at a fixed rate.

In LinuxCNC this rate is called the servo thread rate. This is typically
1 KHz in LinuxCNC but can be higher. In addition, either LinuxCNC or
downstream hardware interpolates between the position waypoints
so smooth motion is generated.

Simple LinuxCNC systems using a parallel port or GPIO do the interpolation
and step/dir generation with a second, faster real time thread, called the base thread.

More complex systems do the interpolation in external hardware or processors
(Mesa cards, Remora, RIO etc) or in the motor drive itself (EtherCAT) and typically
do not use a base thread.
Thank you. It seems the fog is starting to clear. However, not completely yet.

Let me formulate how I understood you. And please correct me if I understood something incorrectly.

1. We are discussing devices with a two-bit discrete interface for controlling stepper drives. (For example, I have a ChinaCNCzone 3040Z 500W machine)
2. The control station must issue step commands at a speed of 1000 Hz, in other words - 1000 steps per second. (As I understand it, not faster than this speed.) This is called the servo thread rate.
3. Since the controllers do not have intelligence (only microstep functionality), the interpolation is done by the program.
4. To perform the interpolation, a certain second thread is used, faster than the first, and having strict requirements for real time. It is called the "base thread".

Then, the specifics end and the fog begins to thicken again. Inevitably, well-founded questions arise.

1. What interpolation algorithm does the program use?
2. How is the second thread, the so-called "base thread", used in it?
3. Why is it faster than the first?
4. What is the reason for the relatively strict requirements for the base thread's real time and relative to what?
5. Where can I read something about this algorithm?

(The goat is cool!)
Last edit: 1 year 5 months ago by ogogon.

Please Log in or Create an account to join the conversation.

More
1 year 5 months ago #328096 by PCW
Replied by PCW on topic Real Time and Latency
2. The control station must issue step commands at a speed of 1000 Hz, in other words - 1000 steps per second. (As I understand it, not faster than this speed.) This is called the servo thread rate.

No, LinuxCNCs trajectory planner provides waypoints(position vectors)  at the servo thread rate.
For simple parallel port type systems these waypoints are sent to a stepgen component that runs
at a higher thread rate (the base thread) and interpolates between the waypoints. That is, the
stepgen component does the high speed step generation so as to reach the next waypoint at the next
servo thread invocation.

Please Log in or Create an account to join the conversation.

More
1 year 5 months ago #328177 by rodw
Replied by rodw on topic Real Time and Latency
Linuxcnc's waypoints are defined in device units (mm or inch)
the STEP_SCALE defines the number of steps per device unit
All of the planning and waypoints are in device units.

The base thread is used to generate the steps. Think of the thread as being an interrupt timer routine that is called (cycled) at precise intervals (frequency). The simplest step generator is a square wave where a pin is turned on for a number of cycles and then turned off for the same number of cycles. (In practice Linuxcnc's step generator is more complex than this as it includes step length and step spacing parameters). But in our simple software step generator, the maximum step rate is the frequency/2. 

A Mesa card offloads this step generation to hardware and all Linuxcnc has to do is once every servo thread cycle is to update the frequency the card is generating. In this case the base thread is not required.


 

Please Log in or Create an account to join the conversation.

Time to create page: 0.228 seconds
Powered by Kunena Forum