Skip to content

Commit

Permalink
fix(hardware/gyro): implement getRate() function
Browse files Browse the repository at this point in the history
  • Loading branch information
Baconing committed Oct 14, 2024
1 parent 9669e48 commit ed1a44c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ public double getRawAngleRadians(CartesianAxis axis) {
);
}

@Override
public double getRate() {
return imu.getRate();
}

@Override
public @NotNull Translation3d getAccelerationMetersPerSecondSquared() {
return new Translation3d(imu.getAccelX(), imu.getAccelY(), imu.getAccelZ());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ public double getRawAngleRadians(@NotNull CartesianAxis axis) {
);
}

@Override
public double getRate() {
return imu.getRate();
}

@Override
public @NotNull Translation3d getAccelerationMetersPerSecondSquared() {
return new Translation3d(imu.getAccelX(), imu.getAccelY(), imu.getAccelZ());
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/net/frc5183/librobot/hardware/gyro/IMU.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ public Rotation3d getRotation3d() {
return getRotation3dRadians();
}

/**
* Returns the rotation rate of the IMU in degrees per second.
* @return the rotation rate of the IMU in degrees per second.
*/
public abstract double getRate();

/**
* Gets the acceleration from the IMU in meters per second squared.
* @return {@link Translation3d} of the acceleration from the IMU in meters per second squared.
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/frc5183/librobot/hardware/gyro/NavXIMU.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public double getRawAngleRadians(@NotNull CartesianAxis axis) {
);
}

@Override
public double getRate() {
return imu.getRate();
}

@Override
public @NotNull Translation3d getAccelerationMetersPerSecondSquared() {
return new Translation3d(
Expand Down

0 comments on commit ed1a44c

Please sign in to comment.