[DONE]Testers needed for integration of switchable kinematics

More
04 Jun 2021 23:16 #211181 by andypugh

Note that it doesn't have to be joint, world, tcp. It could also be a switch between mill and lathe kinematics that basically just swaps X and Z axis. This way you can use standard GCODE for milling and lathe work on the same machine in the same program. Im working on a sim config for just such a mill-turn setup.


I really don't see the need for that particular use-case.
I say this as someone who has a milling machine that can be configured as as vertical 4-axis. vertical 4.5-axis (manual B-axis, involving spanners[1]), horizontal mill or hobbing machine depending on which INI file I choose. I quit and restart with the INI appropriate for the job,

Now, that does not mean that I oppose the idea. It seems cost-free when it works.

But: I am wondering if there there is also a need for a new G-code?
G53 makes a move in the machine coordinate space, ignoring the WCS offsets.
I can imagine a G53.1 G-code that makes a joint-space move (hard coding X to joint 0, Y to joint 1, etc in machine coordinates)

I think that I know how to do this, but haven't got as far as trying.

What proportion of the switchkins application would be covered by this?

[1]
The following user(s) said Thank You: tommylight, Clive S, Aciera

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

More
05 Jun 2021 06:00 - 05 Jun 2021 06:01 #211195 by Aciera

I really don't see the need for that particular use-case.


While shutting down a running mill config and starting a lathe config to then load another program to work on the same part certainly works, I can definitely see the advantage of being able to switch between milling and turning operation in the same config and indeed in the same gcode.
Particularly for larger part numbers and/or multiple switches between milling and turning.


I can imagine a G53.1 G-code that makes a joint-space move


Yes I guess you could do a remap and use M428 if you wanted to use switchable kinematics.


What proportion of the switchkins application would be covered by this?


That's just plain XYZB kinematics and a nice example for it.
Last edit: 05 Jun 2021 06:01 by Aciera.

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

More
07 Jun 2021 09:36 #211411 by Aciera

What proportion of the switchkins application would be covered by this?


That's just plain XYZB kinematics and a nice example for it.


Where switching kinematics comes in handy here is when you want to jog the table to the next part beside it. I'll post a video over on the other thread when I get a chance.

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

More
18 Jun 2021 12:30 #212326 by automata
good job taking this topic forward.
Is there any ready example for polar / r-theta kinematics like:
www.hackster.io/ArduinoFT/polar-drawing-machine-f7a05c
This would be readily useful in a turn-mill type of machine with a servo spindle for face milling without an actual Y axis.
That would probably invite some more interest in this topic and maybe help get it closer to a merge into master.
-automata

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

More
19 Jun 2021 07:43 - 21 Jun 2021 04:34 #212389 by Aciera

Is there any ready example for polar / r-theta kinematics



Not that I know but I hacked up a little simulation:

user-images.githubusercontent.com/460672...63e-14642b9ee0d2.mp4

This is running regular cartesian gcode so the conversion is done in realtime. That brings up the issue of instantaneous flips of the rotary as the atan2 function output can change from positive to negative and vice versa. (Can be seen in my video at 0:10). I'm not really a programmer so maybe there are ways around that.
Note that often the gcode is preprocessed externally from cartesian to polar (the guy in your video also has external software to to that). I gather that some CAMs also offer to output GCODE on polar coordinates.

If you're interested you can experiment with this. Have a look at the 'userkins.comp' kinematic template that can be built using halcompile: linuxcnc.org/docs/html/man/man9/userkins.9.html

Forward kinematics:
            pos->tran.x = j[0]*cos(j[3]*3.14159265/180);
            pos->tran.y = j[0]*sin(j[3]*3.14159265/180);
            pos->tran.z = j[2];
	    pos->a	= 0;

Inverse kinematics
            j[0] = sqrt(pos->tran.x*pos->tran.x+pos->tran.y*pos->tran.y);
            j[2] = pos->tran.z;
	    j[3] = atan2(pos->tran.y,pos->tran.x)*180/3.14159265;


[edit]
Note: Switchable kinematics has now been integrated into master.
Last edit: 21 Jun 2021 04:34 by Aciera. Reason: Add note about integration into master

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

More
18 Oct 2021 10:54 - 18 Oct 2021 10:56 #223443 by NoJo
We have found , I believe, a problem with Switchkins.
I did post a very detailed version of this in another topic, but have deleted it due to lack of response there- I guess it was to detailed and complex to hold attention.

Here is I hope a brief  summary, and I hope the originator of Switchkins can help - I am stuck here!

On our lathe,the first C Axis angular move after a Switchkins invoked kinematic switch appears to ignore the feedrate for that move and seems to do a G00 instead of the requested G01.
 
 To narrow down the problem , via  ‘handle_kinematicsSwitch’ we switch from Trivkins to Trivkins (ie, stay with trivkins), with M66 sync, etc as in Millturn example, so no new kinematics, just trivkins as it was. 

Before the switch
 G01 C20 F800 - moves to 20deg @ feedrate
 G01 C40 F800 - moves to 40deg @ feedrate

After the switch
 G01 C20 F800 - moves to 20deg @ RAPID
 G01 C40 F800-  moves to 40deg @ feedrate

 After the switch the very first C axis rotate is always at rapid - subsequent C axis moves are @ feedrate

If directly after the switch we precede the first C axis move with a linear axis move first:
 G01 Xx.x F800  - X axis moves @ FEEDRATE
and then
 G01 C20 F800 - then the C axis turns @ feedrate.

This occurs right after the switch, even while remaining within trivkins, as though the first C rotary move has no knowledge of the feed rate yet. 


I can provide graphs, plots, code, etc as required

 
Last edit: 18 Oct 2021 10:56 by NoJo. Reason: Add last line re code, etc

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

More
21 Oct 2021 22:47 #223848 by andypugh
Probably best to submit this to the issue tracker.

github.com/LinuxCNC/linuxcnc/issues

(Just pasting the message above to there would probably suffice)

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

More
22 Oct 2021 07:23 #223886 by Aciera
Note that Nojo's report is a double post. The issue is being dealt with in his original thread:
forum.linuxcnc.org/10-advanced-configura...n-bug?start=0#223301

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

More
18 Dec 2021 04:09 #229380 by nhanpham
Hi all,

I am using switckins for my scara robot.
I'm writing a remap for G0.

I'm working in JOINT mode.
The remap was just executed when had X,Y change.
When X,Y-axis position doesn't change and Z change then the remap code doesn't work. (Z-axis didn't move to any position ).

My ini config remap:

[RS274NGC]
 PARAMETER_FILE = scara.var
    USER_M_PATH = ./mcodes
SUBROUTINE_PATH = ./remap_subs
       FEATURES = 8
          REMAP = G0.2  modalgroup=1 argspec=xyzcf  epilog=cycle_epilog python=g01testskins


My Remap:

def g01testskins(self, **words):
    pos={'x':0,'y':0,'z':0,'c':0}
    fcmd =""
    hasF = False
    try:
        cmd = {'x':"",'y':"",'z':"",'c':"",'f':""}
        typeGcode = "g0"
        for name in cmd:
            if name == "f":
                if name in words:
                    typeGcode = "g1"
                    cmd[name] = "F{} ".format(words[name])     
            elif name in words:
                pos[name] = float(words[name])
                cmd[name] = "{}{} ".format(name,words[name])
                statusKin = 1
            else: 
                pos[name]  = float(hal.get_value("axis."+name+".pos-cmd")) 
        gcodecmd="G53 %s X%.4fY%.4fZ%.4f C %.4f %s "%(typeGcode, pos ,pos ,pos ,pos, cmd["f"])
        print("M438 test ", gcodecmd , "in ",time.time())
        self.execute(gcodecmd ,lineno())
        yield interpreter.INTERP_EXECUTE_FINISH
    except Exception as e:
        self.set_errormsg(e)
        return INTERP_ERROR
    return INTERP_OK


After I got the result:

M438 test  G53 g1 X34.7745Y-77.1625Z1.5400 C -0.0020 F300.0   in  1639732421.5478294 
M438 test  G53 g1 X34.7745Y-77.1625Z5.5400 C -0.0020 F300.0   in  1639732421.5878732
M438 test  G53 g1 X34.7745Y-77.1625Z-2.0000 C -0.0020 F300.0   in  1639732421.627927
M438 test  G53 g1 X34.7745Y-77.1625Z3.4000 C -0.0020 F300.0   in  1639732421.6779833
M438 test  G53 g1 X34.7745Y-77.1625Z0.0000 C -0.0020 F300.0   in  1639732421.7280483
 


My gcode test:

;Begin
G21
G0.2 X34.7745 Y-77.1625 Z3.8100 C-0.0020 F300.0 
G0.2  X34.7745 Y-77.1625 Z1.5400 C-0.0020 F300.0
G0.2  X34.7745 Y-77.1625 Z5.5400 C-0.0020 F300.0
G0.2 X34.7745 Y-77.1625 Z-2.00 C-0.0020 F300.0
G0.2  X34.7745 Y-77.1625 Z3.400 C-0.0020 F300.0
G0.2  X34.7745 Y-77.1625 Z0.00 C-0.0020 F300.0
M30


The Z-axis didn't move to any position.

If i change the X,Y-Axis position then Gcode works OK. 

can you help me check it?
 

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

More
18 Dec 2021 11:05 #229394 by tommylight

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

Time to create page: 0.215 seconds
Powered by Kunena Forum