Axis stop/reverse based on loadcell feedback?
- dberndt
- Offline
- Senior Member
Less
More
- Posts: 48
- Thank you received: 1
17 Jan 2023 18:36 #262259
by dberndt
Axis stop/reverse based on loadcell feedback? was created by dberndt
Hello All,
I'm looking to be able to stop/reverse/continue to the next g-code based on a crossing an arbitrary load on a load cell. To keep it simple, this only needs to be done on G1 moves of 1 axis. If the loadcell never exceeds its predetermined value the code should continue running normally, if it does exceed it's value then ending the current g1 and moving onto the next gcode entry would be ideal.
I've had a few ideas about this but none seem really perfect.
-plumb the loadcell into HAL and when the maximum value is exceeded disable one of the motion.enable related pins. This isn't really what I want, as I'd prefer to move on to the rest of the program and not just sort of hang the machine there.
-write a subroutine that does the linear move in very small increments, measures, moves more, measures, stops when appropriate. I don't love this idea because I'd like to have a consistent feed rate. I also don't know what I don't know here. Lack of experience with subroutines. Can I actually evaluate an input value against some hal components, stash the result in a parameter and run the subroutine referencing that parameter/variable and have every loop of the subroutine get the new parameter/value? I assume so.
-Some sort of HAL component hack I haven't thought of yet?
-Insert an additional term into the axis's position calculations and when the maximum loadcell value is exceeded make the delta between axis current position and commanded position 0 using the extra term. This sounds somewhat interesting, but I can't imagine the motion/trajectory planner will take super kindly to suddenly arriving at it's destination unexpectedly, and then that change being un-done as soon as the axis reverses on the next move.
-A custom HAL component that does ?
I'd love to hear any thoughts on how I might go about implementing such an idea.
I'm looking to be able to stop/reverse/continue to the next g-code based on a crossing an arbitrary load on a load cell. To keep it simple, this only needs to be done on G1 moves of 1 axis. If the loadcell never exceeds its predetermined value the code should continue running normally, if it does exceed it's value then ending the current g1 and moving onto the next gcode entry would be ideal.
I've had a few ideas about this but none seem really perfect.
-plumb the loadcell into HAL and when the maximum value is exceeded disable one of the motion.enable related pins. This isn't really what I want, as I'd prefer to move on to the rest of the program and not just sort of hang the machine there.
-write a subroutine that does the linear move in very small increments, measures, moves more, measures, stops when appropriate. I don't love this idea because I'd like to have a consistent feed rate. I also don't know what I don't know here. Lack of experience with subroutines. Can I actually evaluate an input value against some hal components, stash the result in a parameter and run the subroutine referencing that parameter/variable and have every loop of the subroutine get the new parameter/value? I assume so.
-Some sort of HAL component hack I haven't thought of yet?
-Insert an additional term into the axis's position calculations and when the maximum loadcell value is exceeded make the delta between axis current position and commanded position 0 using the extra term. This sounds somewhat interesting, but I can't imagine the motion/trajectory planner will take super kindly to suddenly arriving at it's destination unexpectedly, and then that change being un-done as soon as the axis reverses on the next move.
-A custom HAL component that does ?
I'd love to hear any thoughts on how I might go about implementing such an idea.
Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
Less
More
- Posts: 1831
- Thank you received: 740
17 Jan 2023 19:04 #262260
by spumco
Replied by spumco on topic Axis stop/reverse based on loadcell feedback?
Don't know your application, but check out motion.adaptive-feed and the discussion under M-Codes (specifically M52)
Adaptive-feedrate sounds like it might be applicable to your situation along with some clever sub-routines and program jumps.
Adaptive-feedrate sounds like it might be applicable to your situation along with some clever sub-routines and program jumps.
Please Log in or Create an account to join the conversation.
- PCW
- Offline
- Moderator
Less
More
- Posts: 17945
- Thank you received: 4814
17 Jan 2023 20:29 #262268
by PCW
Replied by PCW on topic Axis stop/reverse based on loadcell feedback?
How about doing the force limited move using external offsets?
Please Log in or Create an account to join the conversation.
- dberndt
- Offline
- Senior Member
Less
More
- Posts: 48
- Thank you received: 1
17 Jan 2023 21:30 #262275
by dberndt
Replied by dberndt on topic Axis stop/reverse based on loadcell feedback?
I wasn't familiar with external offsets but a quick read through of the docs shows promise. So far this looks like the best choice.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23162
- Thank you received: 4860
23 Jan 2023 17:47 #262752
by andypugh
Replied by andypugh on topic Axis stop/reverse based on loadcell feedback?
I think that to do what you describe you would need to automate an abort, followed by a run-from-line.
You can abort from a realtime HAL component, but would need to pass a signal to a userspace component to do the run-from-line.
I think that the realtime part could just monitor motion.program-line and then put that line number on a HAL pin before triggering an abort.
The userspace program could monitor this pin, and if it becomes non-zero do a run-from-line at +1
You can abort from a realtime HAL component, but would need to pass a signal to a userspace component to do the run-from-line.
I think that the realtime part could just monitor motion.program-line and then put that line number on a HAL pin before triggering an abort.
The userspace program could monitor this pin, and if it becomes non-zero do a run-from-line at +1
Please Log in or Create an account to join the conversation.
Time to create page: 0.132 seconds