    public void onSensorChanged(SensorEvent arg) {
        double leftPower, rightPower;
        double accel = (arg.values[2]/50.) * 100;
        double orient = (arg.values[1]/50.) * 50;
        leftPower = accel;
        rightPower = accel;
        if(arg.values[1] > 0)
        {
            leftPower += orient;
        }
        else
        {
            rightPower -= orient;
        }
        if(leftPower > 100) leftPower = 100;
        if(leftPower < -100) leftPower = -100;
        if(rightPower > 100) rightPower = 100;
        if(rightPower < -100) rightPower = -100;
        this.tv.setText(String.format("%.2f %.2f %.2f\n%3.0f %3.0f\n%3.0f %3.0f", arg.values[0], arg.values[1], arg.values[2], accel, orient, leftPower, rightPower));
    }

    public void onSensorChanged(SensorEvent arg) {
        double leftPower, rightPower;
        double accel = (arg.values[2]/50.) * 100;
        double orient = (arg.values[1]/50.) * 50;
        leftPower = accel;
        rightPower = accel;
        if(arg.values[1] > 0)
        {
            leftPower -= orient;
        }
        else
        {
            rightPower += orient;
        }
        if(leftPower > 100) leftPower = 100;
        if(leftPower < -100) leftPower = -100;
        if(rightPower > 100) rightPower = 100;
        if(rightPower < -100) rightPower = -100;
        this.tv.setText(String.format("%.2f %.2f %.2f\n%3.0f %3.0f\n%3.0f %3.0f", arg.values[0], arg.values[1], arg.values[2], accel, orient, leftPower, rightPower));
    }
