This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60b3c19
commit d7ff7c1
Showing
3 changed files
with
78 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.frcteam3636.frc2024.subsystems.arm | ||
|
||
object Arm { | ||
} |
72 changes: 72 additions & 0 deletions
72
src/main/java/com/frcteam3636/frc2024/subsystems/arm/ArmIO.kt
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.frcteam3636.frc2024.subsystems.arm | ||
import edu.wpi.first.math.geometry.Rotation2d | ||
import org.littletonrobotics.junction.LogTable | ||
import org.littletonrobotics.junction.inputs.LoggableInputs | ||
import com.frcteam3636.frc2024.CANSparkFlex | ||
import com.frcteam3636.frc2024.CTREMotorControllerId | ||
import com.frcteam3636.frc2024.REVMotorControllerId | ||
import com.frcteam3636.frc2024.TalonFX | ||
import com.revrobotics.CANSparkLowLevel | ||
import edu.wpi.first.networktables.NetworkTableInstance | ||
import edu.wpi.first.units.Angle | ||
import edu.wpi.first.units.Measure | ||
import edu.wpi.first.units.Units.Radians | ||
import edu.wpi.first.wpilibj.DigitalInput | ||
import edu.wpi.first.wpilibj.DutyCycleEncoder | ||
|
||
interface ArmIO{ | ||
class ArmInputs : LoggableInputs { | ||
var rightPosition = Radians.zero() | ||
var leftPosition = Radians.zero() | ||
|
||
var rightCurrent: Double = 0.0 | ||
var leftCurrent: Double = 0.0 | ||
|
||
var rightVelocity: Double = 0.0 | ||
var leftVelocity: Double = 0.0 | ||
|
||
override fun toLog(table: LogTable) { | ||
table.put("Right Arm Motor Position", rightPosition) | ||
table.put("Left Arm Motor Position", leftPosition) | ||
|
||
table.put("Right Arm Motor Current", rightCurrent) | ||
table.put("Left Arm Motor Current", leftCurrent) | ||
|
||
table.put("Right Arm Motor Velocity", rightVelocity) | ||
table.put("Left Arm Motor Velocity", leftVelocity) | ||
} | ||
|
||
override fun fromLog(table: LogTable) { | ||
rightPosition = table.get("Right Arm Motor Position", rightPosition) | ||
leftPosition = table.get("Left Arm Motor Position", leftPosition) | ||
|
||
rightCurrent = table.get("Right Arm Motor Current", rightCurrent) | ||
leftCurrent = table.get("Left Arm Motor Current", leftCurrent) | ||
|
||
rightVelocity = table.get("Right Arm Motor Velocity", rightVelocity) | ||
leftVelocity = table.get("Left Arm Motor Velocity", leftVelocity) | ||
} | ||
} | ||
|
||
fun updateInputs(inputs: ArmInputs) | ||
|
||
fun setPosition(position: Measure<Angle>) | ||
} | ||
|
||
class ArmIOReal: ArmIO{ | ||
|
||
private val leftMotor = TalonFX(CTREMotorControllerId.LeftArmMotor) | ||
|
||
private val rightMotor = TalonFX(CTREMotorControllerId.RightArmMotor) | ||
|
||
private val absoluteEncoder = DutyCycleEncoder(DigitalInput(7)) | ||
|
||
override fun updateInputs(inputs: ArmIO.ArmInputs) { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun setPosition(position: Measure<Angle>) { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
} |