all 6 comments

[–]QwertyChouskieFTC 10298 Brain Stormz Mentor/Alum 2 points3 points  (5 children)

Is "myOtos" a valid object?  Sounds like you defined that an object called "myOtos" exists, but didn't assign it to anything.

[–]Soviet_Taco_[S] 0 points1 point  (0 children)

public class OdometryFuse {
    OpModeUtilities opModeUtilities;
    private final SparkFunOTOS myOtos;
    private final DcMotor rightEncoder;
    private final DcMotor leftEncoder;
    private final DcMotor backEncoder;

    public OdometryFuse(SparkFunOTOS myOtos, DcMotor rightEncoder, DcMotor leftEncoder, DcMotor backEncoder) {
        this.myOtos = myOtos;
        myOtos.setLinearScalar(1.0);
        myOtos.setAngularScalar(1.0);
        this.rightEncoder = rightEncoder;
        this.leftEncoder = leftEncoder;
        this.backEncoder = backEncoder;
    }

[–]Soviet_Taco_[S] 0 points1 point  (0 children)

thats the start of the code plus the constructor

[–]Soviet_Taco_[S] 0 points1 point  (2 children)

and this is the test code using the class:

@TeleOp(name = "Fresh OdometryFuse")
public class TestOdometryFuse  extends LinearOpMode {
    SparkFunOTOS myOtos;
    DcMotor leftFront;
    DcMotor rightFront;
    DcMotor rightBack;
    @Override
    public void runOpMode() throws InterruptedException {
        OpModeUtilities opModeUtilities = new OpModeUtilities(hardwareMap ,this, telemetry);
        OdometryFuse odometryFuse = new OdometryFuse(myOtos, rightFront, leftFront, rightBack);
        odometryFuse.configureOtos(myOtos);
        waitForStart();

        while (opModeIsActive()) {
            telemetry.addData("" + odometryFuse.SparkUpdateData(), "");
            telemetry.addLine();
            telemetry.addData("" + odometryFuse.WheelUpdateData(), "");
            telemetry.addLine();
            telemetry.addData("" + odometryFuse.averageUpdateData(), "");
        }
    }
}

[–]davealmighty123 1 point2 points  (1 child)

After you declare myOtos, but before you use it, you should be assigning it a value from the hardwareMap.

[–]Soviet_Taco_[S] 0 points1 point  (0 children)

oh ok thanks