Proper use of the lbr.getInverseKinematicFromFrameAndRedundancy(tarFrame) functi

  • I have a question regarding the lbr.getInverseKinematicFromFrameAndRedundancy(tarFrame) in Sunrise OS. As I understand this function Target Frame calculates the joint angles which are desired to reach the target frame.


    Trying it on the current frame works but when using the target frame the message „Redundancy information is null“ appears. Is there a certain way to retrieve the target frame with the redundancy information. Maybe someone who already used the function can give me a hint what has to be considered.

  • Hi razzo,


    thanks for your reply.


    How would you for example add the RedundancyInformation to the following frame?


    Code
    AbstractFrame offsetFrame1 = new Frame (getFrame("/TestFrame"), Transformation.ofDeg(0, 0, 2, 0, -30.00, 0));


    What we basically try to achieve is to get the current cartesian and joint position of the robot and the target position of the current motion command (in cartesian and joint values).



    Only a teached frame will have RedundancyInformation.
    Or you have to add them manually.
    Or you copy a frame with RedundancyInformation.

  • How to set status and turn

    Code
    AbstractFrame f = lbr.getCurrentCartesianPosition(lbr.getFlange());
    f.setRedundancyInformation(lbr, new StatusTurnRedundancy(0, 0));


    How to get your cartesian and joint positions

    Code
    lbr.getCurrentJointPosition();
    lbr.getCommandedJointPosition();
    lbr.getCurrentCartesianPosition(lbr.getFlange());
    lbr.getCommandedCartesianPosition(lbr.getFlange());


    Or maybe I missunderstood something? This solution should be too iisy.

  • Okay, apparently you've got to use frame.copyWithRedundancy(), but when trying out to get the joint angles for the target frame I monitored that the angles from the getInverseKinematicFromFrameAndRedundancy function differ from the actual angles displayed on the smart pad when the target frame was reached.
    The frame which I use as endpoint has been teached and is recalculated with an offset.
    For better undersanding here my code:


    package tests;


    import static com.kuka.roboticsAPI.motionModel.BasicMotions.ptp;
    import gripper.Gripper;


    import javax.inject.Inject;
    import javax.inject.Named;


    import com.kuka.roboticsAPI.applicationModel.RoboticsAPIApplication;
    import com.kuka.roboticsAPI.deviceModel.JointEnum;
    import com.kuka.roboticsAPI.deviceModel.JointPosition;
    import com.kuka.roboticsAPI.deviceModel.LBR;
    import com.kuka.roboticsAPI.geometricModel.AbstractFrame;
    import com.kuka.roboticsAPI.geometricModel.Frame;
    import com.kuka.task.ITaskLogger;


    public class MyApplication extends RoboticsAPIApplication {


    @Inject
    private ITaskLogger logger;

    @Inject
    private LBR robot;

    @Inject
    @Named("ZimmerGripper")
    private Gripper gripper;


    @Override
    public void initialize() {
    robot = getContext().getDeviceFromType(LBR.class);


    gripper.attachTo(robot.getFlange());
    }

    @Override
    public void run() {


    Frame frame;

    while(true){
    frame = getFrame(getApplicationData().getFrame("/ChocolateHandover"), 0, 0, 100, 0, 0, 0);
    showJoints(frame);
    gripper.move(ptp(frame));

    frame = getFrame(getApplicationData().getFrame("/HomePosition"), 0, 0, 100, 0, 0, 0);
    showJoints(frame);
    gripper.move(ptp(frame));
    }
    }


    public Frame getFrame(AbstractFrame frame, double x, double y, double z, double alpha, double beta, double gamma) {
    Frame newFrame = frame.copyWithRedundancy();


    newFrame.setX(newFrame.getX() + x);
    newFrame.setY(newFrame.getY() + y);
    newFrame.setZ(newFrame.getZ() + z);
    newFrame.setAlphaRad(newFrame.getAlphaRad() + alpha * Math.PI / 180);
    newFrame.setBetaRad(newFrame.getBetaRad() + beta * Math.PI / 180);
    newFrame.setGammaRad(newFrame.getBetaRad() + gamma * Math.PI / 180);


    return newFrame;
    }

    private void showJoints(Frame frame){
    JointPosition jointPosition = robot.getInverseKinematicFromFrameAndRedundancy(frame);


    double[] target = { jointPosition.get(JointEnum.J1),
    jointPosition.get(JointEnum.J2),
    jointPosition.get(JointEnum.J3),
    jointPosition.get(JointEnum.J4),
    jointPosition.get(JointEnum.J5),
    jointPosition.get(JointEnum.J6),
    jointPosition.get(JointEnum.J7) };

    String message = "Target joints:";

    for (int index = 0; index < target.length; index++) {
    message += " " + Math.toDegrees(target[index]);
    }
    logger.info(message);
    }
    }


    Do I use the copyWithRedundancy() incorrect or maybe at the wrong place?

  • I guess your problem is, that you move the robot with its gripper to a frame and not with its flange. I guess that the gripper has a geometry, so you move the TCP of your gripper to this position and not the center of the flange and this leads to a misalignment.

Advertising from our partners