Teaching Frames inside programs

In many applications, a robot should approach the same Frame multiple times and maybe also from different starting points. As illustrated in Section 2.3.5, the robot may choose different axis configurations each time this Frame is approached, depending on the concrete starting point. This especially applies to LWRs, as their elbow position may vary even for path motions.

To avoid that hint joints have to be specified each time a Frame is approached again, those hint joints can be stored as TeachingInfo in the Frame itself in the following way:

In cases where the current position of a robot should be memorized in a program to be approached again later, the DeviceInterfaces PtpInterface, LinInterface and MotionInterface provide a method touchup(). This method creates a new temporary Frame that stores the current position of the robot’s default MCP relative to its base Frame. The newly created Frame is furthermore augmented by the current robot’s joint positions as TeachingInfo for the robot and its MCP. The overload touchup(Frame mcp) can be used to do the same for the supplied MCP instead of the robot’s default one.

Here is another Democode using the LWR:

public void demo_TeachingFrames() throws RoboticsException { 
    // Generate an Interface, as usual 
    // let the robot drive to a location first, to avoid singularity problems 
    PtpInterface left = lwrLeft.use(PtpInterface.class); 
    RtActivity leftOne = left.ptp(new double[] { -1.5, 0.8, 0, -1.5, 0, 
        0.8, 0 }); 
    // Create the Frame you want the Device to memorize 
    // and just to be sure, take a snapshot... 
    // Remember that we use the FingerCenter of the left arm as our 
    // MotionCenterFrame. 
    Frame finger = wsgLeft.getFingerCenter(); 
    Frame fingerFixed = finger.snapshot(World.getOrigin()); 
    // Now that we have a Frame, we need to link the Joints 
    // of the robot to it. The best way to do this 
    // is the .getJointAngles()-Method 
    // It reads the current state of each Joint the Device has, 
    // and returns an Array that is ready to use for the next step 
    double[] memoryJoints = lwrLeft.getJointAngles(); 
    // Take your Frame and link it to a Device, a Frame (most of the time itself) 
    // and an Array that contains the position of the Joints (the one we created) 
    fingerFixed.addTeachingInfo(lwrLeft, finger, memoryJoints); 
    // Now we are ready to test it 
    // Let the Robot drive around a bit 
    RtActivity leftTwo = left.ptp(new double[] {-0.5,0.8,0,-1.5,0,-0.5,-1}); 
    // And then create a RtActivity with our Frame. 
    // It will drive to the memorized position and will 
    // use the Array to adopt the exact same posture we saved 
    RtActivity reEnter = left.ptp(fingerFixed); 
    // Once such a point is memorized, the robot 
    // is even able to drive to the Frame 
    // from its Home-Position without causing 
    // a Singularity 
    RtActivity reEnterSecondTime = left.ptp(fingerFixed); 
    // repeat 
    RtActivity leftThree = left.ptp(new double[] {-2,-0.4,0,1,0.5,-0.5,-1}); 
    RtActivity reEnterThirdTime = left.ptp(fingerFixed); 
    RtActivity leftFour = left.ptp(new double[] {-2.5,1,0,0,0,0.8,0}); 
    RtActivity reEnterFourthTime = left.ptp(fingerFixed);