-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added comments. Added DifferentialDriveKinematics. Added AutoLogOutpu…
…t support
- Loading branch information
1 parent
e1b86b2
commit 2b7efba
Showing
2 changed files
with
35 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,34 @@ | ||
package frc.robot.subsystems.drive; | ||
|
||
import edu.wpi.first.math.kinematics.ChassisSpeeds; | ||
import edu.wpi.first.math.kinematics.DifferentialDriveKinematics; | ||
import edu.wpi.first.math.kinematics.DifferentialDriveWheelSpeeds; | ||
import edu.wpi.first.math.util.Units; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
import org.littletonrobotics.junction.AutoLogOutput; | ||
|
||
public class DriveBase extends SubsystemBase implements Drive { | ||
protected static final DifferentialDriveKinematics kinematics = | ||
new DifferentialDriveKinematics(Units.inchesToMeters(27.0)); | ||
|
||
@AutoLogOutput protected double leftVelocityMetersPerSecond; | ||
@AutoLogOutput protected double rightVelocityMetersPerSecond; | ||
|
||
public DriveBase() {} | ||
|
||
public void runVelocity(ChassisSpeeds speeds) {} | ||
; | ||
public void runVelocity(ChassisSpeeds chassisSpeeds) { | ||
// Convert to wheel speeds | ||
DifferentialDriveWheelSpeeds wheelSpeeds = kinematics.toWheelSpeeds(chassisSpeeds); | ||
|
||
leftVelocityMetersPerSecond = wheelSpeeds.leftMetersPerSecond; | ||
rightVelocityMetersPerSecond = wheelSpeeds.rightMetersPerSecond; | ||
} | ||
|
||
public double getMaxLinearSpeed() { | ||
return 0; | ||
return 5; | ||
} | ||
|
||
public double getMaxAngularSpeed() { | ||
return 0; | ||
return 5; | ||
} | ||
} |