Hey everybody, I'm new to Karel and I've been looking for a good place to start, threads to read etc. I would like to be able to at some point be able to use Karel to do my robot logic in pns001, has anyone attempted/done this if so could i see some examples?
Writing to a register in karel
-
nygil -
March 8, 2024 at 4:26 PM -
Thread is Resolved
-
-
panic mode
March 8, 2024 at 4:27 PM Approved the thread. -
Hi !
Could you explain the goal you reach in your management program.
If you use PNS, then the call is made by PLC or other (so the management is there)
If you want to use Karel, then you do not need PNS and you could manage as you want.
-
First of all, if not done already, you may download the manual B-83144EN-1/01 KAREL OPERATOR'S MANUAL from myFanuc
So what would you like to achieve? Write to a register? In KAREL it's several commands for register operations. Here's some of them:
Register Operation - Read
GET_JPOS_REG
GET_POS_REG
GET_REG
Register Operation - Write
SET_JPOS_REG
SET_POS_REG
SET_REAL_REG
SET_INT_REG
-
My advice for Karel: avoid it where ever possible. Exception: You want some kind of knowledge hiding.
-
My advice for Karel: avoid it where ever possible. Exception: You want some kind of knowledge hiding.
Yes, Karel is a last option (exception Hiding things , special calculation/decision needed)
-
I avoid to use Karel all I can, but if no other option is possible, the best practice to keep a maintainable code would be to split every function you need and call it through TP.
So per example, if you need to do some calculations using "SIN" and "COS", you can create a Karel routine that accepts 2 parameters:
- ANGLE -> As float
- RESULT -> As float
Then on the karel routine you can declare first parammeter as input, second as output, and when calling the routine through TP you can use 2 registers.
As this example would be a simple function that only calls an internal Karel function, it should not need to be maintained, you can also put the original .kl file inside the MD for anyone who needs to check his contents or even recompile it.
Yeah, I know it's not the best thing of the world, but you simply cannot avoid to use Karel for some things. Per example If you need to check the reachability of a vision point provided by external vision equipment other than fanuc before performing the real motion, you need to use karel, there is not other way to do it, so on this case, just create a simple routine to do that and all should be good.