Move Trajectory planner from real time to non-real time
21 Jul 2022 06:41 - 23 Feb 2023 15:45 #247912
by troy
I'll draw a block diagram later, hope you can give more suggestions!
Replied by troy on topic Move Trajectory planner from real time to non-real time
Hi cmorley,Thank you for your question.How will you handle such things as override and spindle sync?
I'll draw a block diagram later, hope you can give more suggestions!
Last edit: 23 Feb 2023 15:45 by troy.
The following user(s) said Thank You: silopolis
Please Log in or Create an account to join the conversation.
21 Jul 2022 06:47 - 23 Feb 2023 15:46 #247913
by troy
Replied by troy on topic Move Trajectory planner from real time to non-real time
and eoffsets..
Hi skunkworks, you mean tool offsets?
Last edit: 23 Feb 2023 15:46 by troy.
Please Log in or Create an account to join the conversation.
25 Jul 2022 10:54 #248240
by rmu
Replied by rmu on topic Move Trajectory planner from real time to non-real time
eoffsets = external offsets I think, something like torch height compensation calculated from actual measured arc voltage in real time.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- rellenberg
- Offline
- Junior Member
Less
More
- Posts: 37
- Thank you received: 10
26 Jul 2022 15:30 #248339
by rellenberg
Replied by rellenberg on topic Move Trajectory planner from real time to non-real time
Trajectory planning specifically (kinematics, blending, path smoothing) doesn't have to be in realtime, but there are a few reasons it was done that way:
- Blending used to be done at runtime (before we added lookahead), so there wasn't really a need for complex lookahead / optimization. Trajectory "planning" was mostly just creating the motion structures (line, circle, tapping) and adding them to the queue.
- Motion commands other than lines / arcs can affect future motions (blend mode, spindle sync), so they have to be executed in order. Many motion commands directly act on (realtime) motion state, so it made sense to handle incoming commands in the realtime side.
- When we did add lookahead, it was easier to graft it on to the existing realtime TP (especially for me as a relative novice to LinuxCNC architecture).
- Treat "immediate" motion commands (pause, resume, config changes, etc.) the same as today (command handler in command.c)
- For actual moves and move-related commands (blending, spindle-sync), create a queue for optimization / lookahead in the user half of the user-motion interface.
- Add a motion command that pops an optimized move out of the user-space queue and sends it (fully-formed) to the motion command handler.
- Move geometry processing out of realtime TP (tpAddLine, tpAddCircle, path blending) to this new layer.
- (optional) move geometry processing out of emccanon if possible (circle / line math, naive CAM detection, etc.)
Please Log in or Create an account to join the conversation.
26 Jul 2022 15:59 #248342
by arvidb
Replied by arvidb on topic Move Trajectory planner from real time to non-real time
Would it be acceptable to pre-calculate an exact path based on maximum feed override (and other settings), and then follow this at whatever feed is set at the moment? Rather than doing real time blending/lookahead.
To me having the freedom to override feed without changing the shape of the finished part might even be preferable to always having the tightest possible corners etc. This might also allow exact calculation of remaining machining time (though this is complicated by the fact that different parts of the path will have different maximum velocities, so it's not just a simple scaling).
One issue that would need to be handled is large files - the pre-calculation of the path would have to be done in a background thread. (But this must already be the case for the preview in e.g. Axis?)
Anyway, I'm mostly wondering what you guys think about this, is there some obvious dealbreaker with doing things this way?
To me having the freedom to override feed without changing the shape of the finished part might even be preferable to always having the tightest possible corners etc. This might also allow exact calculation of remaining machining time (though this is complicated by the fact that different parts of the path will have different maximum velocities, so it's not just a simple scaling).
One issue that would need to be handled is large files - the pre-calculation of the path would have to be done in a background thread. (But this must already be the case for the preview in e.g. Axis?)
Anyway, I'm mostly wondering what you guys think about this, is there some obvious dealbreaker with doing things this way?
The following user(s) said Thank You: troy
Please Log in or Create an account to join the conversation.
- rellenberg
- Offline
- Junior Member
Less
More
- Posts: 37
- Thank you received: 10
26 Jul 2022 17:30 #248354
by rellenberg
Replied by rellenberg on topic Move Trajectory planner from real time to non-real time
That's more or less the approach the TP currently uses. Lookahead runs whenever a new G-code line is processed, and creates blends to fit the maximum velocity reachable with feed override. Lookahead establishes the limits, and the TP can run arbitrarily slower depending on feed override settings. You'd probably want a similar pattern when moving to userspace: do the hard work of finding the blend sizes and vel / accel limits in userspace, and the trajectory execution (that stays within those limits) in realtime.
The following user(s) said Thank You: arvidb
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
26 Jul 2022 19:00 #248359
by Todd Zuercher
Replied by Todd Zuercher on topic Move Trajectory planner from real time to non-real time
A funny TP blending quirk I've noticed. If for example you have a machine config with a max feed rate of F200 and you load a g-code file with a programmed feed rate of F1000 the TP will calculate the blends for the F1000 feed rate even though the actual milling will only be at F200 because of the machine's config limit. Changing the g-code's programmed feed to the machine's F200 will result in much smaller blend radii (assuming no path tolerance) than the original F1000 even though the actual feed rates performed would be the same. In other words the TP does not account for a machine's velocity limitations in it's blend calculations.
Please Log in or Create an account to join the conversation.
03 Feb 2023 16:51 #263611
by troy
I've done my job !
After over 7 months design \ development \ debugging, it works well.
The trajectory planner module has been moved to non-realtime side, after the emctaskplan module.
I can finally do a mass of calculations in the trajectory planner without affecting the real-time performance of interpolation.
Here is a 5-axis RTCP milling test vedio, the real-time interpolation cycle is 1ms, the actual measured time period is about 600-800us.
multi-axis milling test - YouTube
Note: this project is cooperate with a company, all the source code are in a server that can't access to the internet, so i can't push it to github.
I will post more details later.
Replied by troy on topic Move Trajectory planner from real time to non-real time
Hi, guyshi guys,
I wonder if it is possible for us to move the trajectory planner from real time to non real time.
1.TP is a time-consuming part,It should not be too complex, otherwise it will affect the stability of real-time cycle;
2.we can not perform complex path smoothing algorithm,such as B-spline Compression smoothing (siemens fanuc),with current structure;
If we move TP to non real time module, we can do more complex smoothing calculation.
Has anyone tried this before?
I've done my job !
After over 7 months design \ development \ debugging, it works well.
The trajectory planner module has been moved to non-realtime side, after the emctaskplan module.
I can finally do a mass of calculations in the trajectory planner without affecting the real-time performance of interpolation.
Here is a 5-axis RTCP milling test vedio, the real-time interpolation cycle is 1ms, the actual measured time period is about 600-800us.
multi-axis milling test - YouTube
Note: this project is cooperate with a company, all the source code are in a server that can't access to the internet, so i can't push it to github.
I will post more details later.
The following user(s) said Thank You: Bari
Please Log in or Create an account to join the conversation.
03 Feb 2023 19:53 #263616
by andypugh
Replied by andypugh on topic Move Trajectory planner from real time to non-real time
This sounds very interesting, I do hope that you can find a way to make it possible to merge into mainline LinuxCNC.
The following user(s) said Thank You: troy
Please Log in or Create an account to join the conversation.
06 Feb 2023 05:57 - 23 Feb 2023 15:47 #263794
by troy
you are so right, the steps you mentioned are almost the key point of the implementation.
Replied by troy on topic Move Trajectory planner from real time to non-real time
Hi Robert,Trajectory planning specifically (kinematics, blending, path smoothing) doesn't have to be in realtime, but there are a few reasons it was done that way:
- Blending used to be done at runtime (before we added lookahead), so there wasn't really a need for complex lookahead / optimization. Trajectory "planning" was mostly just creating the motion structures (line, circle, tapping) and adding them to the queue.
- Motion commands other than lines / arcs can affect future motions (blend mode, spindle sync), so they have to be executed in order. Many motion commands directly act on (realtime) motion state, so it made sense to handle incoming commands in the realtime side.
- When we did add lookahead, it was easier to graft it on to the existing realtime TP (especially for me as a relative novice to LinuxCNC architecture).
I agree that it would definitely be better to have more planning in userspace (more consistent / faster servo updates, easier to do more complex planning). I've been thinking about how to do this in manageable steps
- Treat "immediate" motion commands (pause, resume, config changes, etc.) the same as today (command handler in command.c)
- For actual moves and move-related commands (blending, spindle-sync), create a queue for optimization / lookahead in the user half of the user-motion interface.
- Add a motion command that pops an optimized move out of the user-space queue and sends it (fully-formed) to the motion command handler.
- Move geometry processing out of realtime TP (tpAddLine, tpAddCircle, path blending) to this new layer.
- (optional) move geometry processing out of emccanon if possible (circle / line math, naive CAM detection, etc.)
With a simple queue, some lookahead still has to be done in realtime with this arrangement (the TP has to be able to stop at the end of the last queued motion in case userspace stalls). A more sophisticated queue that allows shared access for both motion and userspace would make it possible to move all of the lookahead calculations out of realtime.
you are so right, the steps you mentioned are almost the key point of the implementation.
Last edit: 23 Feb 2023 15:47 by troy.
Please Log in or Create an account to join the conversation.
Time to create page: 0.108 seconds