Pressbrake CNC Control Setup Questions

More
5 years 6 months ago #204551 by andypugh
Here is a first attempt at a press controller.

Compile / install it with
Code:
sudo halcompile --install press.comp

Once installed
Code:
man press
will show the auto-generated docs.

It takes a number of position commands on HAL pins from a GUI, and outputs a target position and velocity.
These should be the inputs to either a limit3 or simple_tp HAL component (I am not sure which will work best) to control velocity, accel and limits. Then the output of that would go to your PID.

The press component also needs to see the position feedback. Provision might have to be made for homing if your scales are not absolute.

I have assumed a three-position foot pedal with up, down and neither outputs.

Starting at the top, pressing the down switch will request a down feed. Releasing the down will set the velocity to zero.
Actuating the up switch will start a retract. releasing the up switch on a retract will stop the motion.
When the press reaches the start height the speed will be changed.
At the finish height motion will stop. Releasing the pedal _without_ actuating the up switch, then re-actuating the down switch will set a target press.0.tweak-down lower. This can be repeated indefinitely.
Code:
component press "A component to control a press-brake"; pin in float brake-pos-fb "Position feedback of the press"; pin in float top_position = 0 "Position to return to"; pin in float return_speed = 1 "Speed to return to top at"; pin in float bend_start = 0 "Point of contact with work"; pin in float start_speed = 1 "Speed to move down to initial contact"; pin in float bend_finish = 0 "Position to complete bend"; pin in float bend_speed = 1 "Speed to move at during bend"; pin in float tweak-down = 0 "Extra bend increment"; pin in float pos-tolerance = 0.05 "How close to target to be to stop"; pin out float brake-pos-cmd "Brake position command to motion"; pin out float brake-vel-cmd "Speed command to motion"; pin in float backstop-pos = 100 "Required backstop position"; pin in float backstop-fb = 100 "Backstop position feedback"; pin out float backstop-pos-cmd "Position command out to backstop"; pin in bit up "Command to move up from pedal"; pin in bit down "Command to move down from pedal"; pin in bit abort "Abort current operation and stop all motion"; pin in bit interlock = 1 "Input signal from interlocks to allow cycle"; function _; license "GPL"; author "andypugh" ;; #include "rtapi_math.h" FUNCTION(_){ static int state = 0; static double target; switch (state) { case 0: // at the top, awaiting commands if (interlock != 1){ // interlock return; // do nothing. Needs further consideration } if (fabs(backstop_pos_cmd - backstop_fb) > 4 * pos_tolerance){ // new backstop position state = 10; break; } if (down){ target = bend_start; state = 5; return; } break; case 5: // moving down to work brake_pos_cmd = target; brake_vel_cmd = start_speed; if (up){ // aborted motion target = top_position; state = 8; return; } if (! down){ // pause the downfeed brake_vel_cmd = 0; } if (fabs(brake_pos_fb - target) < pos_tolerance){ // in position target = bend_finish; state = 6; } break; case 6: // bending brake_pos_cmd = target; brake_vel_cmd = bend_speed; if (up){ // aborted motion target = top_position; state = 8; return; } if (! down){ // pedal released if (fabs(brake_pos_fb - target) < pos_tolerance){ // in position, consider tweaking state = 7; } else { // not in position, just stop brake_vel_cmd = 0; } } break; case 7: // at bottom of stroke, waiting for a tweak if (up){ // return to top target = top_position; state = 8; return; } if (down) { // give it a tweak target += tweak_down; state = 6; } break; case 8: // return to top brake_pos_cmd = target; brake_vel_cmd = return_speed; // What to do if the down switch is pressed on the retract? if (! up) { // pedal un-released brake_vel_cmd = 0; } if (fabs(brake_pos_fb - target) < pos_tolerance){ // retracted state = 0; } break; case 10: // Backstop positioning backstop_pos_cmd = backstop_pos; if (fabs(backstop_fb - backstop_pos_cmd) < pos_tolerance){ // retracted state = 0; } break; default: rtapi_print_msg(RTAPI_MSG_ERR, "Unsupported state reached in state machine"); } }

Please Log in to join the conversation.

More
5 years 6 months ago #204617 by EW_CNC

andypugh wrote:
Does that UI work? It looks like it is only partially set up, but perhaps I am missing things.

Yes, the UI works, and yes it is only partially set up. I had an electrician, friend helped me retrofit the tubing bender and we got it working and never took the time to refine it. He did the glade gui so I will still need to learn the process myself.
Thanks for the press.comp, looks good. I'm hoping to work at the project today and see if I can make any progress.

Please Log in to join the conversation.

More
5 years 6 months ago #204618 by andypugh
The backstop and the tweak were a bit of a punt, but I wanted to show how to handle a bit more complexity.

It's prpbably best to define your "wish list" early in the process, and maybe sketch out some GUI designs as you would like them, rather than how you know how to make them in Glade.

Should the bar go down to depth and stay there, or auto-retract a little once at-depth?
Pause at depth?
The state machine should probably have some timeouts and/or overload "escapes"

Please Log in to join the conversation.

More
5 years 6 months ago #204844 by andypugh
I got strangely interested in this. I have made a fairly complete press-brake config based on my old gui.

Attachment not found



Unzip the archive somewhere on your HD. Probably linuxcnc/configs/Bender
You will need to install the press.comp
Code:
cd ~/linuxcnc/configs/Bender sudo halcompile --install press.comp
You probably have to make "bender" and "pressgui" executable:
Code:
chmod x pressguichmod x bender
You can then start the demo with
Code:
./bender
The idea is that the system runs through the bend sequence in the table. If you press the "down" button in the sim-pin then the Vismach bender will run down to the start position, then slow down, then to the finish position. If you then release the down-button you have the choice of going down 0.1mm further, or pressing the up button. Once the brake is back at the top and idle the system moves on to the next row.
Things that I gave up on for the moment
1) File save / open etc.
It's mainly intended as a basic skeleton for your real machine.

Please Log in to join the conversation.

More
5 years 6 months ago #204845 by andypugh
As set up here, the ./bender command leaves an interactive hal session open in the terminal. "exit" will close that, and close the GUI, Vismach and button panel.
But I left it in so that it is easy to open a halmeter and watch things / explore the HAL pins, etc.

Please Log in to join the conversation.

More
5 years 6 months ago #204915 by andypugh
I fiddled some more. I have added a backstop and addressed the issue with there being no feedback of the active row.

I have also re-arranged the UI layout.

Re-download the ZIP file for the new version. There are also changes to the press.comp, that will need to be re-installed.

Still no file save / load though. But I am looking at it.

Please Log in to join the conversation.

More
5 years 6 months ago #204939 by andypugh
OK, and now load / save / saveas / quit work.

(re-uploaded the zip file)

I will stop now, awaiting feedback from someone who has at least used a press brake.

What would be useful? "dublicate bend" button?

Once you are going up, you can't go down again. Is that OK?

Please play with the simulator and see how it feels.

I think that there is plenty of scope for cosmetic improvement too.

Please Log in to join the conversation.

More
5 years 6 months ago #205106 by EW_CNC
OK, I got your simulator installed and working. Looks Great!

Now my next step is to get it to work with my machine. I've been trying to get the press.comp to work in axis gui, but just can't get it going. Might be with my encoder, pwm, pid settings. I'll attach my hal file. I had the ram jogging before with keyboard y jog.

How do I merge my settings with your program?
Do I use an ini file?
Where do I keep the pid settings?

Attachment not found

Attachment not found

Please Log in to join the conversation.

More
5 years 6 months ago #205115 by andypugh

flamecutter wrote: Now my next step is to get it to work with my machine. I've been trying to get the press.comp to work in axis gui, but just can't get it going.


Basically the output of the simple_tps in my config would need to go to the input of the pids in your config.

You can do away with the INI, or pass it to the HAL file in the bash script with a -i option.
linuxcnc.org/docs/2.8/html/man/man1/halcmd.1.html

If you prefer to not use the INI then you can put the PID gains in the HAL:
Code:
setp pid.0.Pgain 100
instead of
Code:
setp pid.0.Pgain [JOINT_0]PGAIN

You should remove the loadrt MOTMOD and loadrt KINS lines, and remove anything with "motion" in the name from the HAL.

Do you need homing? There isn't any homing in my config, it rather depends on an absolute encoder as things stand.
There is also nothing controlling machine on/off state or e-stop etc at the moment.

Please Log in to join the conversation.

More
5 years 6 months ago #205130 by EW_CNC

andypugh wrote: Do you need homing? There isn't any homing in my config, it rather depends on an absolute encoder as things stand.There is also nothing controlling machine on/off state or e-stop etc at the moment.

Yes, I will need machine on/offAs far as homing goes, now yet I was manuel homing with ram cylinder at top of stroke. Should I be adding a homing switch or is it possible to home off of encoder index?My encoder is an incremental linear encoder.

Please Log in to join the conversation.

Time to create page: 1.210 seconds
Powered by Kunena Forum