Skip to content

Commit

Permalink
Removing unnecessary manual updates
Browse files Browse the repository at this point in the history
Timer and IMUChassis don’t need you to manually update the values
anymore.
  • Loading branch information
electraminer committed Nov 5, 2016
1 parent 4df98de commit 17cc596
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion FtcAndroidLib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ android {
buildToolsVersion '24'

defaultConfig {
minSdkVersion 16
minSdkVersion 19
targetSdkVersion 19
versionCode 1
versionName "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public IMUChassis(DcMotor l, DcMotor r, BNO055IMU b){
}

//Calculation of angle units:
public void calc() {
private void calc() {
angles = imu.getAngularOrientation().toAxesReference(AxesReference.INTRINSIC).toAxesOrder(AxesOrder.ZYX);
}

Expand All @@ -45,12 +45,15 @@ public void setStandard(double angle) {

//values
public double angle() {
calc();
return -AngleUnit.DEGREES.fromUnit(angles.angleUnit, angles.firstAngle); //heading is negative because the +/- dirs were reversed
}
public double roll() {
calc();
return AngleUnit.DEGREES.fromUnit(angles.angleUnit, angles.secondAngle);
}
public double pitch() {
calc();
return AngleUnit.DEGREES.fromUnit(angles.angleUnit, angles.thirdAngle);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,17 @@
* Created by Art Schell on 3/17/2016.
*/
public class Timer extends HardwareComponent {
double systemTime = 0;
double oldT = 0;

//The timer is only updated when these are called. In this way you can pause a timer.

@Override
public void getValues() {
systemTime += System.currentTimeMillis() - oldT;
}
@Override
public void calibrate() { oldT = System.currentTimeMillis(); }

//if the timer has passed a value.

public boolean tRange (double range) {
return (systemTime > range);
return (System.currentTimeMillis() - oldT > range);
}

//resets the timer

public void resetTimer() {
systemTime = 0;
oldT = System.currentTimeMillis();
}
}

0 comments on commit 17cc596

Please sign in to comment.