I just use the force condition code provide by the manual. But it seems to provide an external force that can meet the force condition. We want the peg to search a pin. Let the peg move in Axis -Z in a loop but the displacement is bigger and bigger. Once it touches the pin, the arm should be reverse the moving direction. But when we use the code you provide, the arm just stuck the pin strictly and doesn`t move or react, even doesn`t show any error. But when we use our hands to provides an external force, it works correctly. I think we need to use another code. Could someone please help us? Thanks first!
KUKA iiwa R820 auto search the pin program
-
Alanmin -
March 18, 2017 at 3:20 PM -
Thread is marked as Resolved.
-
-
Can you post you code?
-
private void moveSeparation(){
getLogger().info("moveSeparation");
ForceComponentCondition conditionnegativeZ=new ForceComponentCondition(iiwa14_1.getFlange(),CoordinateAxis.Z,-10,3000);
ForceComponentCondition conditionpositiveZ=new ForceComponentCondition(iiwa14_1.getFlange(),CoordinateAxis.Z,-3000,10);
ForceComponentCondition conditionnegativeX=new ForceComponentCondition(iiwa14_1.getFlange(),CoordinateAxis.X,-10,3000);
ForceComponentCondition conditionpositiveX=new ForceComponentCondition(iiwa14_1.getFlange(),CoordinateAxis.X,-3000,10);
ForceComponentCondition conditionnegativeY=new ForceComponentCondition(iiwa14_1.getFlange(),CoordinateAxis.Y,-10,3000);
ForceComponentCondition conditionpositiveY=new ForceComponentCondition(iiwa14_1.getFlange(),CoordinateAxis.Y,-3000,10);
moveStart();
int A=0,B=0;
for (int C=150;C<600;C=C+25){
MotionBatch Separation= new MotionBatch(lin(getFrame("/start")).setCartVelocity(100),linRel(A,0,0).setCartVelocity(100),
linRel(0,B,0).setCartVelocity(100),
linRel(0, 0, C).setCartVelocity(100)).breakWhen(conditionnegativeZ).
breakWhen(conditionpositiveZ).breakWhen(conditionnegativeX).
breakWhen(conditionpositiveX).breakWhen(conditionnegativeY).
breakWhen(conditionpositiveY);
IMotionContainer motion;
motion = nase.move(Separation);
if (motion.hasFired(conditionnegativeZ)) {
//Reaction to force Condition
if(C>300){
//move to the finished position while it clips the shaft.
movePart();
break;
}
else {
B=B-25;
C=150;
//detect the collision and change the position along y axis}
}
}
if (motion.hasFired(conditionpositiveZ)) {
//Reaction to force Condition
if(C>300){
//move to the finished position while it clips the shaft.
movePart();
break;
}
else {
B=B+25;
C=150;
}
}
if (motion.hasFired(conditionnegativeX)){
if(C>300){
//move to the finished position while it clips the shaft.
movePart();
break;
}
else {
A=A-25;
C=150;
}
}
if (motion.hasFired(conditionpositiveX)){
if(C>300){
//move to the finished position while it clips the shaft.
movePart();
break;
}
else {
A=A+25;
C=150;
}
}
if (motion.hasFired(conditionnegativeY)){
if(C>300){
//move to the finished position while it clips the shaft.
movePart();
break;
}
else {
B=B-25;
C=150;
}
}
if (motion.hasFired(conditionpositiveY)){
if(C>300){
//move to the finished position while it clips the shaft.
movePart();
break;
}
else {
B=B+25;
C=150;
}
}
}
} -
Thank you for fast reply Kiiwa, I have post my code. And it seems need to provide an external force that can trigger the force condition. But the pin can`t give a force. So once the arm end touches some part of the pin. The force condition can`t be triggered and the arm runs until stick pin and doesn`t move. But even it stick, no error shows.