Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tapsterbot control plane vs device plane errors post calibration routine #20

Open
ubatra13 opened this issue Feb 9, 2014 · 5 comments

Comments

@ubatra13
Copy link

ubatra13 commented Feb 9, 2014

Geometry showing the control plane and device plane errors are attached below.

I have two points

a. Need your suggestion on placement of device on bot, seems like calibration routine is sensitive to the placement.

b. if not, then device plane is shaped parallelogram, so looks like the error adjustment are not enough; I have to apply some kind of shear transformation to stretch the plane a bit inward or outward depending on placement of device on bot.

Can you please help and confirm my understanding please?

Here's the geometry when device is placed horizontally center and vertically top on bot plane

tapsterbot-error-1

and here's the one when device is placed horizontally center and vertically middle on bot plane

tapsterbot-error-2

@ubatra13
Copy link
Author

ubatra13 commented Feb 9, 2014

@hugs , your timely response is highly appreciated

@ubatra13
Copy link
Author

ubatra13 commented Feb 9, 2014

Well, after aligning device's browser window almost (up to a 2mm precision) horizontally center and vertically middle to bot plane, this is the most best data point I can get

tapsterbot-error-3

tapsterbot-calibration-dimentions

@ubatra13
Copy link
Author

I finally ended up with something like this for control plane to send adjusted instruction to bot

public class Transform {

public static class SHEAR { 

    public static class QUARDANT_1ST { 

        public static final float ERROR_X = 0f; 
        public static final float FACTOR_X = 0.05f; 

        public static Point apply(Point point) throws Exception { 

            float errorX = ERROR_X + SHEAR.QUARDANT_1ST.FACTOR_X * 
                    (GUI.getDevice().getIosBrowser().getSizeY()/2 - point.y); 

            point.x= point.x + (int) Math.round(errorX); 

            return point; 

        } 

    } 

    public static class QUARDANT_2ND { 

        public static float ERROR_Y = 20f; 
        public static float FACTOR_Y = 0.05f; 

        public static float ERROR_X = -25f; 
        public static float FACTOR_X = 0.05f; 

        public static Point apply(Point point) throws Exception { 

            float errorY = ERROR_Y + SHEAR.QUARDANT_2ND.FACTOR_Y * 
                    (point.y - GUI.getDevice().getIosBrowser().getSizeY()/2); 

            float errorX = ERROR_X + SHEAR.QUARDANT_2ND.FACTOR_X * 
                    (GUI.getDevice().getIosBrowser().getSizeX()/2 - point.x); 

            point.x = point.x + (int) Math.round(errorX); 
            point.y = point.y + (int) Math.round(errorY); 

            return point; 

        } 
    } 

    public static class QUARDANT_3RD { 

        public static float ERROR_Y = 50f; 
        public static float FACTOR_Y = 0.05f; 

        public static float ERROR_X = 0f; 
        public static float FACTOR_X = 0.05f; 

        public static Point apply(Point point) throws Exception { 

            float errorY = ERROR_Y + SHEAR.QUARDANT_3RD.FACTOR_X * 
                    (point.x - GUI.getDevice().getIosBrowser().getSizeX()/2); 

            float errorX = ERROR_X + SHEAR.QUARDANT_3RD.FACTOR_Y * 
                    (point.x - GUI.getDevice().getIosBrowser().getSizeX()/2); 

            System.out.println("errorY=" + errorY); 
            System.out.println("errorX=" + errorX); 

            point.y = point.y + (int) Math.round(errorY); 
            point.x = point.x + (int) Math.round(errorX); 

            return point; 

        } 
    } 

    public class QUARDANT_4TH { 
        // No error adjustment required 
    } 

} 

}

It does selective shear and a small error adjustment depending upon quadrant, however I am not convinced fully by this way, I would really appreciate if you can explain a little on the issue?

@penguinho
Copy link

👍

@ubatra13
Copy link
Author

This is the final setup that I produced by fixing my control plane aspect ratio and applying a small error correction based on the shear angle.

tapsterbot-error

Here's my little transformation program

package com.apple.ist.ets.robotics.iosd.definitions;

import java.awt.Point;

public class Bot {

private Plane plane; 

public Bot(Plane plane) { 

    this.plane = plane; 

} 

public Plane getPlane() { 

    return this.plane; 

} 

/** 
 * Selective shear angle based transformation for bot plane 
 * @author Umesh Batra 
 */ 
public static class Plane extends ShearErrors { 

    public Plane(float ERROR_X, float ERROR_Y) { 
        super(ERROR_X, ERROR_Y); 
    } 

    public Point apply(Point point) throws Exception { 

        float errorY = super.ERROR_Y; 
        float errorX = super.ERROR_X + errorX(point); 

        point.x= point.x + (int) Math.round(errorX); 
        point.y= point.y + (int) Math.round(errorY); 

        return point; 

    } 

    private float distanceX(Point p1, Point p2) { 

        float distance = p2.x - p1.x;  
        return distance; 

    } 

    private float distanceY(Point p1, Point p2) { 

        float distance = p2.y - p1.y;  
        return distance; 

    } 

    private float errorX(Point point) { 

        Point origin = new Point(0,0); 
        float distanceX = distanceX(origin, point); 
        float distanceY = distanceY(origin, point); 

     // p = b * Tan(theta) (where theta is a funtion of x) 
     // Refer to geometry in extra's folder 

        float angle = (float) (super.FACTOR * distanceX); 
        float errorX = -((float) ( 
            distanceY * Math.tan(Math.toRadians(angle))) 
        ); 

        return errorX; 

    } 

} 

/** 
 * Selective shear errors, values would differ per device, refer to diagrams 
 * @author Umesh Batra 
 */ 

public static abstract class ShearErrors { 

    private float FACTOR = 0.019f; 
    private float ERROR_X = 0f; 
    private float ERROR_Y = 15f; 

    public ShearErrors(float ERROR_X, float ERROR_Y) { 

        this.ERROR_X = ERROR_X; 

        this.ERROR_Y = ERROR_Y; 

    } 

 // Empty implementation 
    public Point apply(Point point) throws Exception { 

        return point; 

    } 

    public void setFACTOR(float fACTOR) { 
        this.FACTOR = fACTOR; 
    } 

}; 

}

Appreciate, if you can provide some inputs on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants