Skip to content

Commit

Permalink
idk what really changed
Browse files Browse the repository at this point in the history
  • Loading branch information
ss0g committed Jan 15, 2022
1 parent 01f1c2d commit 5c37552
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
17 changes: 9 additions & 8 deletions src/main/java/com/spartronics4915/frc/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,19 @@ public DeviceSpec(String nm, int id, int nbut)
}

// from atlas 2020
public static final class DriveStraightConstants
{
public static final double kP = 0; // Was 0.4
public static final double kI = 0.2;
public static final double kD = 0;
public static final double kAllowedError = 0; // In degrees
}
// public static final class DriveStraightConstants
// {
// public static final double kP = 0; // Was 0.4
// public static final double kI = 0.2;
// public static final double kD = 0;
// public static final double kAllowedError = 0; // In degrees
// }

public static final class JoystickMotorConstants
{
public static final double kMotorSpeedMultiplier = 1;
public static final double kMotorSpeedMultiplier = 0.5;
public static final double kMotorSlowSpeed = 0.3;
public static final double kJoystickDeadzone = 0.1;
public static final double kJoystickResponseCurve = 5.0/3.0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import edu.wpi.first.wpilibj2.command.CommandBase;
import edu.wpi.first.wpilibj.Joystick;

import com.spartronics4915.frc.Constants;
import com.spartronics4915.frc.Constants.*;
import com.spartronics4915.frc.subsystems.JoystickMotor;

public class JoystickMotorCommand extends CommandBase
Expand All @@ -29,7 +29,7 @@ public void execute()

if (mSlow)
{
y *= Constants.JoystickMotorConstants.kMotorSlowSpeed;
y *= JoystickMotorConstants.kMotorSlowSpeed;
}

if (mInverted)
Expand All @@ -38,8 +38,8 @@ public void execute()
}

// copied from 2020-InfiniteRecharge, no idea how it works (magic)
y = Math.copySign(Math.pow(Math.abs(y), 5.0/3.0), y); // apply response curve
mJoystickMotor.set(applyDeadzone(y, Constants.JoystickMotorConstants.kJoystickDeadzone));
y = Math.copySign(Math.pow(Math.abs(y), JoystickMotorConstants.kJoystickResponseCurve), y); // apply response curve
mJoystickMotor.set(applyDeadzone(y, JoystickMotorConstants.kJoystickDeadzone));
}

// also copied from ir2020
Expand Down

0 comments on commit 5c37552

Please sign in to comment.