Some help needed to achieve needed functionality

More
24 May 2014 20:32 - 24 May 2014 20:34 #47283 by emcPT
In a project that I have in hands (a waterjet machine), three things are needed that I do not know if something is already made, so if you know more, please let me know:

1) Critial - For every change of direction the machine needs to slow down because of the drag on the bottom of the plate. This starts to be very important at plates ticker than 1" (25.4mm), as the cut at the bottom of the plate will be very different from its start. For example, if cutting a square, in each corner, the machine needs to slow down from the actual feedrate to another feedrate. I am not sure if this is possible with the current implementation, but the following idea came to my head: Set on the fly the permissive acceleration of the axes (this would suit perfectly) as a slow acceleration and slow deceleration is exactly what I need when the direction is changing. This value needed to be possible to change before each job, or with a code on the .ngc file

2) Important: Have the possibility to raise or lower the Z axis during the cut. This is like a THC but without the hardware. With the waterjet cutting metal, all moves slow, so it is enough to raise and lower the Z axis manually. Using the PAGE UP and PAGE DOWN keys would be perfect.

3) Less important: There is any possibility to add the run time? This is nice to see, especially in long parts.

Thank you.
Last edit: 24 May 2014 20:34 by emcPT.

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

More
25 May 2014 23:43 #47313 by ArcEye
Hi

1) Critial - For every change of direction the machine needs to slow down because of the drag on the bottom of the plate. This starts to be very important at plates ticker than 1" (25.4mm), as the cut at the bottom of the plate will be very different from its start. For example, if cutting a square, in each corner, the machine needs to slow down from the actual feedrate to another feedrate. I am not sure if this is possible with the current implementation, but the following idea came to my head: Set on the fly the permissive acceleration of the axes (this would suit perfectly) as a slow acceleration and slow deceleration is exactly what I need when the direction is changing. This value needed to be possible to change before each job, or with a code on the .ngc file


How far does using G61 or G64 without any variation from path allowed, go to solving this?
It should come to a complete stop on a 90 deg corner, how long that actually is of course, depends upon the acceleration value

The first thing that comes into my head is have a user M code which changes the acceleration
#!/bin/bash

if [ ! $# -ge 2 ]; then
  echo "Usage: M198 Pn  Qxxx - where n is axis num and xxx is accel value "
  exit 1
fi

float=$1
axis=${float/\.*}

halcmd setp stepgen.$axis.maxaccel $2

exit 0

used as M198 P0 Q55 for instance

The conversion for the axis is necessary because LCNC passes values as float with 6 decimal places and the stepgen number needs an integer.

This runs OK in a sim, except of course there are no stepgens to change, so the command is passed but errors.
I don't currently have a machine available to test it properly

regards
The following user(s) said Thank You: emcPT, jtc

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

More
26 May 2014 01:41 - 26 May 2014 01:43 #47317 by emcPT
Thank you for your reply.

The issue is not the machine that does not follow the toolpath, it does in fact, the cut is so slow that the machine as no trouble in continue in the expected path (cuts are done for example at 40mm/min +- 1.5 inches/minute). The issue are changes in direction, because the cut "drags", this is, the cut of the bottom of the plate is delayed with the cut at its top. When a change of direction occurs, the cut at the bottom gets very different than at its top.

On Staturday I was gathered with someone that have another waterjet machine and he told me that his control automatically starts to decelerate all lines (and arcs) in proportion with the change of direction of the next move. So I think it is quite reasonable to test a very slow acceleration or deceleration and see if it results on the expected cut quality.

I will test tomorrow on a real machine.
Thank you again.


About point 3, I saw the time component that may do what I want.
Last edit: 26 May 2014 01:43 by emcPT.

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

More
26 May 2014 02:16 #47318 by ArcEye

About point 3, I saw the time component that may do what I want.


You can simply log time through a script, but you presumably want to display a clock.

I have a Qt widget which does just this but not much use to you as is.
What vcp panel are you using pyVCP or gladeVcp?

regards

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

More
26 May 2014 03:34 #47320 by emcPT
I am using pyvcp.
And yes, a timer that starts at 0:00:00 when the user press cycle start and displays the actual machining time (in English I think is called a stopwatch).

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

More
26 May 2014 16:22 #47334 by ArcEye

I am using pyvcp.
And yes, a timer that starts at 0:00:00 when the user press cycle start and displays the actual machining time (in English I think is called a stopwatch).


OK, I will see if I can convert my Qt widget to python and tk, no promises though :laugh:

regards

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

More
26 May 2014 18:27 #47339 by ArcEye
I am losing my marbles I think.

There is already a timer in pyvcp_widgets, it is just not documented
I had forgotten about it.
class pyvcp_timer(Label):
    """ (indicator) shows elapsed time as HH:MM:SS
    two pins - run and reset
    time advances whenever run is true
    time holds whenever run is false
    time resets to zero on a rising edge of reset
    """
    n=0
    def __init__(self,master,pycomp,halpin=None,**kw):
        self.v = StringVar()
        Label.__init__(self,master,textvariable=self.v,**kw)
        if halpin == None:
            halpin = "timer."+str(pyvcp_timer.n)
            pyvcp_timer.n += 1
        self.halpins=[]
        c_halpin=halpin+".reset"
        pycomp.newpin(c_halpin, HAL_BIT, HAL_IN)
        self.halpins.append(c_halpin)
        c_halpin=halpin+".run"
        pycomp.newpin(c_halpin, HAL_BIT, HAL_IN)
        self.halpins.append(c_halpin)

        self.resetvalue=0
        self.runvalue=0
        # starttime is the time of the last rising edge of 'run'
        self.starttime=0
        # basetime is the sum of all prior 'run=1' periods
        self.basetime=0
        self.currtime=0
        self.v.set( "00:00:00")


    def update(self,pycomp):    
        resetvalue = pycomp[self.halpins[0]]
        runvalue = pycomp[self.halpins[1]]
        if resetvalue != self.resetvalue:
            self.resetvalue=resetvalue
            if resetvalue == 1:
                self.basetime=0
                self.starttime=time.time()
        if runvalue != self.runvalue:
            self.runvalue=runvalue
            if runvalue == 1:
                # rising edge
                self.starttime = time.time()
            else:
                # falling edge
                self.basetime += time.time() - self.starttime
        if runvalue == 1:
            total=self.basetime + time.time() - self.starttime
        else:
            total=self.basetime
        hr = int(total / 3600)
        remainder = total - hr*3600
        mn = int(remainder / 60)
        sec = int(remainder - mn*60)
        self.v.set( str( "%02d:%02d:%02d" % (hr,mn,sec) ) )

You just need to have something like this in your .xml file
<?xml version='1.0' encoding='UTF-8'?>
<pyvcp>
    <vbox>
	<label>
	    <text>"Timer:"</text>
	</label>
     
        <timer>
	</timer>
    </vbox>    
</pyvcp>

and you will get this




As you can see there are two pins, run and reset, the header of the code describes how to use them

At some point I will get around to documenting it properly

regards
Attachments:
The following user(s) said Thank You: emcPT

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

More
27 May 2014 14:41 #47382 by jtc

Hi

1) Critial - For every change of direction the machine needs to slow down because of the drag on the bottom of the plate. This starts to be very important at plates ticker than 1" (25.4mm), as the cut at the bottom of the plate will be very different from its start. For example, if cutting a square, in each corner, the machine needs to slow down from the actual feedrate to another feedrate. I am not sure if this is possible with the current implementation, but the following idea came to my head: Set on the fly the permissive acceleration of the axes (this would suit perfectly) as a slow acceleration and slow deceleration is exactly what I need when the direction is changing. This value needed to be possible to change before each job, or with a code on the .ngc file


How far does using G61 or G64 without any variation from path allowed, go to solving this?
It should come to a complete stop on a 90 deg corner, how long that actually is of course, depends upon the acceleration value

The first thing that comes into my head is have a user M code which changes the acceleration
#!/bin/bash

if [ ! $# -ge 2 ]; then
  echo "Usage: M198 Pn  Qxxx - where n is axis num and xxx is accel value "
  exit 1
fi

float=$1
axis=${float/\.*}

halcmd setp stepgen.$axis.maxaccel $2

exit 0

used as M198 P0 Q55 for instance

The conversion for the axis is necessary because LCNC passes values as float with 6 decimal places and the stepgen number needs an integer.

This runs OK in a sim, except of course there are no stepgens to change, so the command is passed but errors.
I don't currently have a machine available to test it properly

regards


Hi.

today I'm trying to implement this, so I search where the acceleration was imported on the hal file bui it isn't. We are using mesa cards, so we don't have stepgens...


any ideas how to solve this?

the time display is implemented and working :)

João

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

More
27 May 2014 15:23 #47383 by ArcEye

today I'm trying to implement this, so I search where the acceleration was imported on the hal file bui it isn't. We are using mesa cards, so we don't have stepgens...

any ideas how to solve this?


I only have stepper machines, so the stepgen solution was relevant to me.
Even though the parameter exists in the stepgens to set max accel, I think if modified, this may leave them at odds with the internal settings in Linuxcnc
Hopefully that would not be a problem, the stepgen should pretty much be the final arbiter of what figure is used.

As far as I can see, the MAX_ACCELERATION figure is read from the ini file and applied internally in emc.cc, iniaxis.cc and initraj.cc

This appears to suggest that without a coded solution, the only way to externally change max accel with servos, may be to stop and start having changed the figure in the ini file.

Hopefully PCW or Andy will jump in if they have ideas

rregards
The following user(s) said Thank You: emcPT

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

More
27 May 2014 16:37 #47386 by emcPT
If we go for a coded solution, we will have access to the MAX_ACCELERATION though a pin? That would be the most elegant and flexible solution?
As you know the code, what would be a good example that we can start from (a pin that we should analyze to get a similar functionality)? Maybe there are pins less accessible than others, and a good on that we can start from would help the implementation.
Thank you

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

Time to create page: 0.365 seconds
Powered by Kunena Forum