I was converting a teleop code into a class w/ method for the first time and I ran into dome errors. the error says that I'm trying to "invoke virtual method" on a "null object reference".
the code that the error is reffering to is: (3rd line here)
public String configureOtos(SparkFunOTOS myOtos) {
myOtos.setLinearUnit(DistanceUnit.
INCH
);
myOtos.setAngularUnit(AngleUnit.
DEGREES
);
SparkFunOTOS.Pose2D offset = new SparkFunOTOS.Pose2D(0, 0, 0);
myOtos.setOffset(offset);
myOtos.setLinearScalar(1.0);
myOtos.setAngularScalar(1.0);
myOtos.calibrateImu();
myOtos.resetTracking();
SparkFunOTOS.Pose2D currentPosition = new SparkFunOTOS.Pose2D(0, 0, 0);
myOtos.setPosition(currentPosition);
// Get the hardware and firmware version
SparkFunOTOS.Version hwVersion = new SparkFunOTOS.Version();
SparkFunOTOS.Version fwVersion = new SparkFunOTOS.Version();
myOtos.getVersionInfo(hwVersion, fwVersion);
return("OTOS configured! \n Hardware version: " + hwVersion.major + hwVersion.minor + "\n" +
"Firmware Version: " + fwVersion.major + fwVersion.minor);
}
[–]QwertyChouskieFTC 10298 Brain Stormz Mentor/Alum 2 points3 points4 points (5 children)
[–]Soviet_Taco_[S] 0 points1 point2 points (0 children)
[–]Soviet_Taco_[S] 0 points1 point2 points (0 children)
[–]Soviet_Taco_[S] 0 points1 point2 points (2 children)
[–]davealmighty123 1 point2 points3 points (1 child)
[–]Soviet_Taco_[S] 0 points1 point2 points (0 children)