Skip to content

Commit

Permalink
finxing things
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Duckett committed Jan 4, 2024
1 parent 54d972b commit 2d70118
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.littletonrobotics.junction.LogTable;
import org.littletonrobotics.junction.inputs.LoggableInputs;

public interface HardwareRequirments extends AutoCloseable, LoggableInputs {
public interface HardwareRequirements extends AutoCloseable, LoggableInputs {

boolean connected();

Expand Down
22 changes: 12 additions & 10 deletions src/main/java/frc/lib/hardware/Motors/Motor.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj.RobotBase;
import edu.wpi.first.wpilibj.simulation.FlywheelSim;
import frc.lib.hardware.HardwareRequirments;
import frc.lib.hardware.HardwareRequirements;
import frc.lib.hardware.Motors.MotorControlers.MotorController;
import frc.lib.hardware.Motors.MotorControlers.Talon_SRX;
import frc.lib.hardware.Motors.PID.EncoderConfigs;
Expand All @@ -16,7 +16,7 @@
import frc.robot.Robot;
import org.littletonrobotics.junction.LogTable;

public class Motor implements HardwareRequirments {
public class Motor implements HardwareRequirements {
// Enums --------------
public enum Type {
CIM(DCMotor.getFalcon500(1)),
Expand Down Expand Up @@ -174,8 +174,10 @@ public double getPositoin() {
if (RobotBase.isReal()) {
return mEncoder.getPositoin();
} else {
if (simVelocity) return mSimPositionMeters;
else return mSimPositionRad;
if (simVelocity)
return mSimPositionMeters;
else
return mSimPositionRad;
}
}

Expand Down Expand Up @@ -223,10 +225,8 @@ private void logSim(LogTable table) {

mSim.update(Robot.defaultPeriodSecs);

mSimPositionRad =
mSimPositionRad + (mSim.getAngularVelocityRadPerSec() * Robot.defaultPeriodSecs);
mSimPositionMeters +=
(mSim.getAngularVelocityRadPerSec() * Robot.defaultPeriodSecs) * Units.inchesToMeters(2);
mSimPositionRad = mSimPositionRad + (mSim.getAngularVelocityRadPerSec() * Robot.defaultPeriodSecs);
mSimPositionMeters += (mSim.getAngularVelocityRadPerSec() * Robot.defaultPeriodSecs) * Units.inchesToMeters(2);
mSimVelocityDeg = mSim.getAngularVelocityRadPerSec();
mSimVelocityMeters = mSim.getAngularVelocityRadPerSec() * Units.inchesToMeters(2);
// --------------------------------------------------------
Expand All @@ -245,8 +245,10 @@ private void logSim(LogTable table) {

@Override
public boolean connected() {
if (!mController.connected()) return false;
if (hasEncoder) return mEncoder.connected();
if (!mController.connected())
return false;
if (hasEncoder)
return mEncoder.connected();
return true;
}
}
4 changes: 2 additions & 2 deletions src/main/java/frc/lib/hardware/Motors/Motor2.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj.RobotBase;
import edu.wpi.first.wpilibj.simulation.FlywheelSim;
import frc.lib.hardware.HardwareRequirments;
import frc.lib.hardware.HardwareRequirements;
import frc.lib.hardware.Motors.MotorControlers.MotorController;
import frc.lib.hardware.Motors.MotorControlers.Talon_SRX;
import frc.lib.hardware.Motors.PID.EncoderConfigs;
Expand All @@ -16,7 +16,7 @@
import frc.robot.Robot;
import org.littletonrobotics.junction.LogTable;

public class Motor2 implements HardwareRequirments {
public class Motor2 implements HardwareRequirements {
// Enums --------------
public enum Type {
CIM(DCMotor.getFalcon500(1)),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package frc.lib.hardware.Motors.MotorControlers;

import frc.lib.hardware.HardwareRequirments;
import frc.lib.hardware.HardwareRequirements;

public interface MotorController extends HardwareRequirments {
public interface MotorController extends HardwareRequirements {

MotorController config(int canID);

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/lib/hardware/sensor/encoders/Encoder.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package frc.lib.hardware.sensor.encoders;

import frc.lib.hardware.HardwareRequirments;
import frc.lib.hardware.HardwareRequirements;

public interface Encoder extends HardwareRequirments {
public interface Encoder extends HardwareRequirements {

Encoder config();

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/frc/lib/hardware/sensor/imu/IMU.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Rotation3d;
import frc.lib.hardware.HardwareRequirments;
import frc.lib.hardware.HardwareRequirements;
import org.littletonrobotics.junction.LogTable;

public interface IMU extends HardwareRequirments {
public interface IMU extends HardwareRequirements {

Rotation2d getPitch();

Expand Down Expand Up @@ -41,5 +41,6 @@ default void toLog(LogTable table) {
}

@Override
default void fromLog(LogTable table) {}
default void fromLog(LogTable table) {
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package frc.lib.hardware.sensor.proximitySwitch;

import edu.wpi.first.wpilibj2.command.button.Trigger;
import frc.lib.hardware.HardwareRequirments;
import frc.lib.hardware.HardwareRequirements;

public interface ProximitySwitch extends HardwareRequirments {
public interface ProximitySwitch extends HardwareRequirements {
/**
* @return true if open false if closed
*/
Expand Down

0 comments on commit 2d70118

Please sign in to comment.