Relative movement?

Started by evo85210, November 17, 2019, 09:54:09 AM

Previous topic - Next topic

evo85210

So I have a training cell KR6, which comes equip with a gripper and laser sensor. The sensor sensor can sense when something enters its sensing range and make a input become true.
So I'm wondering how to best use this sensor.

for example:
move forward 10 cm, when sensor senses an object, move gripper down to pickup the object?

but this would require if statements and relative movements.
Can this be accomplished in PRC?
....
I can understand basic KRL, but I can't write this from scratch.

Johannes @ Robots in Architecture

Hello,

For such interaction, the way to go is probably the Custom KRL component. You could make a search pattern in Grasshopper and then declare an interrupt that then calls your pick up subroutine.

That being said, in my experience Grasshopper doesn't lend itself perfectly to represent such processes, so the easiest way to go might be KRL.
If you've got an edu-cell, then chances are good that it came with teaching examples etc., that should make using your included gripper and sensor easier!

Best,
Johannes




evo85210

#2
Hi Johannes,

Thanks for the quick reply.

unfortunately the edu-cell is not new, and it seems someone has changed a few things, the one demo file i found on the machine crashes the robot when ran.
Did a quick search on google, and it seems a relative move is done by setting a new base? ie:
LIN BASE1:{POS: X 234, ....}

So I'm guessing the krl code would look something like this:


W=1
?????                                   ;some code here to set current position as new base (base1)
WHILE W==1 OR $IN[27]==FALSE            ;when scanner not detecting anything or if W equals 1
LIN BASE1:{POS: X 100}                  ;gripper move forward linearly for 10 cm
W=0                                     ;change W to 0 to exit while loop if no object is found

ENDWHILE
IF $IN[27]==FALSE                       ;when no object is found

THEN
LIN BASE1:{POS: X 0 Y 0 Z 0}            ;go back to start position, in preparation for other commands

ELSE                                    ;if object found
?????                                   ;some code here to set current position as new base (base2)
LIN BASE2:{POS: Z 25}                   ;move gripper down 2.5cm from current position (base2)
PULSE ($OUT[25], TRUE, 0.2)             ;close the grippers
LIN BASE2:{POS: Z 0}                    ;move gripper back up to position when object was detected (origin of base2)
LIN BASE1:{POS: X 0 Y 0 Z 0}            ;go back to start position, in preparation for other commands
ENDIF



assuming the above logic is correct, then my question would be how to i set my current tcp position as the new base (base2)?

Thanks,

Victor

Johannes @ Robots in Architecture

Hello Victor,

If the edu-cell is by KUKA, I would just contact your local KUKA representative and ask!
Relative movements are in relation to the current position of the robot.
So let's say that the robot is currently at {X 100, Y 0, Z 50, A 0, B 0, C 0} and you do a LIN_REL {Z -90}, then after the relative linear movement the robot will be at {X 100, Y 0, Z -40, A 0, B 0, C 0}.
We do not natively support relative movements in KUKA|prc, because if you work within a CAD environment, you should always know the absolute position.
But of course I understand that relative movements are useful in cases like yours.

The basic structure seems OK, though I haven't ever used the in-line base settings like LIN BASE1:{... Are you sure that is valid KUKA syntax? But you shouldn't need the base-setting anyway, use LIN_REL instead.
Consider putting in certain limits, so that you e.g. only do a movement in X and Y if the robot is within certain bounds.
Also, after closing or opening the gripper it might make sense to put in a WAIT SEC 1 or so, currently it's only switching the gripper on for 0.2 seconds, which might not be enough time to grasp an object reliably.

Best,
Johannes

evo85210

Understand, thanks for the feedback.

on another note, been playing around with PRC to create the base code which I'll manually edit later.

I've noticed that if I use the wait for digital input component, core will give me an error:
1. Solution exception:Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
This seems like a bug?

Johannes @ Robots in Architecture

Hello,

I haven't been able to replicate the error message, can you send me the file where it happens? Ideally just the relevant part, in case it's a large file.

Best,
Johannes


evo85210

Attached is the partial file with the error
thanks.

Johannes @ Robots in Architecture

Hello,

I've fixed it in the most recent release!
Thanks for letting me know!

Best,
Johannes