i am newbie to the forum ive been on for about 4 mobths now and find it very useful, i want to say thanks ahead for the knowledge you share, i have a question concerning KUKA KRC4 KSS01356 im actuallly new to the KUKA and was wondering if you could help me out with understanding HOW to use a DECL, Bool, variable, Real, because i have no clue what these are or where to start
new to kuka
-
Dbonds28 -
July 2, 2018 at 4:05 PM -
Thread is Resolved
-
-
to run any program, drives must be on, messages cleared, program selected and START used...
KSS01356 is "Start key required".
This is clearly stated in the message itself but more detail is also available in form of system messages manual and on-screen help (menu help/messages/system messages)
DECL keyword is used to declare variables. variables are memory locations suitable to hold specific type of information.
-
To use any of those you must be in expert mode... as far as I know there is no way to create variables (besides points that you teach) with the inline forms.
Once you start getting into "real" KRL, you have access to a lot more of the robot functionality -- just be aware that this comes at a price; KUKA is very picky about syntax and debugging can be pretty challenging.
That being said, to answer your question you use DECL to *declare* variables at the top of your src files or in your dat files. For src files, the declarations MUST be at the top of the function, before any motion commands or variable initialization or even wait commands. BOOL, REAL, INT, CHAR, etc. are all variable datatypes; just like in C or Java you have to specify the types of your variables before you use them, and then they are locked to those types of data (with some exceptions, such as setting CHARs to INTs, or implicitly converting between FRAMEs and E6POSes).
You use them like this:Code
Display MoreDEF programName() ;DECLARATION SECTION DECL INT thisIsAnInteger DECL CHAR thisIsACharacter DECL CHAR thisIsACharArray[50] ; essentially, a string (with length 50), but with very little built-in functionality... you have to implement all that yourself (take a look at SWRITE though, in the CREAD/CWRITE manual) ;INITIALIZATION SECTION thisIsAnInteger = 17 ; after this you cannot declare any more variables thisIsACharArray[] = "I am a string" thisIsACharacter = thisIsACharArray[1] ; "I", as arrays in KRL start at index 1 ;CODE SECTION ; program code goes here PTP $AXIS_ACT ; these actually won't work, just because I never set axis velocities or accelerations PTP {X 50,Y 50,Z 500} ; and I never set $TOOL or $BASE... I've done a modest amount of KRL programming and I still forget to do these like 80% of the time... END
Of course, you don't strictly need any of those sections, the only requirement is that if you have declarations, they must come before anything else. Initializations and movements and everything else can be mixed together (but often initializations are done just after the declaration section to increase readability).
Often you will see code wrapped up in FOLDs. FOLDs are used to condense code into something human readable, like this:
When reading the code on the KUKA teach pendant, rather than displaying the code it will display "foldName." Other than that, folds do nothing. They are not required, and are treated as comments when the program executes (ie. the code inside the fold will execute, and the ;FOLD and ;ENDFOLD lines are ignored).
Happy coding!
-
OH MY GOSH I AM SO THANKFUL FOR THIS
I REALLY APPRECIATE THIS..
-
How we use $AXIS_ACT and ptp {x,y,z,a,b,c,b,t} these variable.
-
If you are as new to programming as I think you are, then maybe you should get acquainted with Pascal (programing language) to learn about variables, their scope, functions (passing parameters by value or reference), logical operators and control flow. You can learn this anywhere you have a computer and not near robot (which is likely on a noisy factory floor).
Afterwards, if you haven't already, take a look at System Variables pdf.
-
How we use $AXIS_ACT and ptp {x,y,z,a,b,c,b,t} these variable.
$AXIS_ACT (and $AXIS_ACT_MES) is a read-only variable, it reports the current position of the robot axes.
CodeDECL E6AXIS MyAxisVariable MyAxisVariable=$AXIS_ACT_MES IF (MyAxisVariable.A1 < 10) AND (MyAxisVariable.A1 > 0) THEN PTP {A1 5} ENDIF
PTP commands use Structure variables of either AXIS or POS types. You can hard-code numbers inside the {}, but not variables. So:
Code
Display MoreDECL REAL rTemp DECL POS MyPos rTemp = 1.1 MyPos = {X 100,Y -100,Z 0,A 1, B 2, C 3} PTP {X 100,Y 200,Z 300, A 0,B 5,C -5,S 1,T 2} ; legal PTP {X 100} ; legal, will only change the position in X PTP {Z 100, A 5} ; legal PTP {X rTemp} ; ILLEGAL! PTP MyPos ; legal MyPos.X = rTemp ; legal PTP MyPos ; legal
-
thanks for share but what is code saying via variable and PTP commands, and some queries mentioned below....
1. what is r.Temp
2. my pos is current position.
3. why you use legal comment.
and what about step - 6, step - 8 and step 9 to 11.
please explain me.
-
DECL E6AXIS MyAxisVariable
1. why we use E with 6 axis.
2. AXIS_ACT_MES what the mean of MES.
and my other question is that if i program in my smart pad like...
PTP {X100, Y30, Z10, A0, B6, C23}
then by this single step, will robot go on this position ? like x100, y30 etc.
-
DECL E6AXIS MyAxisVariable
1. why we use E with 6 axis.
E6AXIS is a structure extending AXIS struc with 6 external axes.
2. AXIS_ACT_MES what the mean of MES.
Short for MEaSured. $Axis_act returns programmed positions of axes (as they should be on path), this variable returns them measured (as they are). The difference between them most of the time is minuscule.
and my other question is that if i program in my smart pad like...
PTP {X100, Y30, Z10, A0, B6, C23}
then by this single step, will robot go on this position ? like x100, y30 etc.
You need spaces after component names like: PTP {X 100, Y 30, Z 10, A 0, B 6, C 23}.
Also first movement in robot program cannot be ambiguous- if you are passing Cartesian position, it has to have all components, including Status and Turn (S & T); if it's an axial move, has to have all axes (A1..A6).
Lastly, grab the programing manual and start reading it, otherwise you will just be asking us to rewrite it in post format.
-
thanks for share but what is code saying via variable and PTP commands, and some queries mentioned below....
1. what is r.Temp
2. my pos is current position.
3. why you use legal comment.
and what about step - 6, step - 8 and step 9 to 11.
please explain me.
1. It's a REAL (floating point) variable.
2. What is your question?
3. I used Lega/Illegal to indicate which of the operations was legal in KRL, and which were not. The various steps were examples of different ways of using PTP commands with variables.