Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonCoal committed Jan 16, 2024
1 parent b4edbcb commit 73f4f3e
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 8 deletions.
92 changes: 92 additions & 0 deletions simgui-ds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"keyboardJoysticks": [
{
"axisConfig": [
{
"decKey": 65,
"incKey": 68
},
{
"decKey": 87,
"incKey": 83
},
{
"decKey": 69,
"decayRate": 0.0,
"incKey": 82,
"keyRate": 0.009999999776482582
}
],
"axisCount": 3,
"buttonCount": 4,
"buttonKeys": [
90,
88,
67,
86
],
"povConfig": [
{
"key0": 328,
"key135": 323,
"key180": 322,
"key225": 321,
"key270": 324,
"key315": 327,
"key45": 329,
"key90": 326
}
],
"povCount": 1
},
{
"axisConfig": [
{
"decKey": 74,
"incKey": 76
},
{
"decKey": 73,
"incKey": 75
}
],
"axisCount": 2,
"buttonCount": 4,
"buttonKeys": [
77,
44,
46,
47
],
"povCount": 0
},
{
"axisConfig": [
{
"decKey": 263,
"incKey": 262
},
{
"decKey": 265,
"incKey": 264
}
],
"axisCount": 2,
"buttonCount": 6,
"buttonKeys": [
260,
268,
266,
261,
269,
267
],
"povCount": 0
},
{
"axisCount": 0,
"buttonCount": 0,
"povCount": 0
}
]
}
9 changes: 9 additions & 0 deletions simgui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"NTProvider": {
"types": {
"/FMSInfo": "FMSInfo",
"/Shuffleboard/Pre-match/Mode": "String Chooser",
"/SmartDashboard/AutonomousMode": "String Chooser"
}
}
}
10 changes: 5 additions & 5 deletions src/main/kotlin/com/team4099/robot2023/BuildConstants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package com.team4099.robot2023
const val MAVEN_GROUP = ""
const val MAVEN_NAME = "Crescendo-2024"
const val VERSION = "unspecified"
const val GIT_REVISION = 20
const val GIT_SHA = "4571cd4f3189ad1982f91f7dde0d0c7d7ec30341"
const val GIT_DATE = "2024-01-12T19:01:07Z"
const val GIT_REVISION = 25
const val GIT_SHA = "b4edbcbc86bce4f445e9dcbf3dc9d1361b02aca3"
const val GIT_DATE = "2024-01-15T19:28:22Z"
const val GIT_BRANCH = "intake"
const val BUILD_DATE = "2024-01-12T19:14:59Z"
const val BUILD_UNIX_TIME = 1705104899720L
const val BUILD_DATE = "2024-01-15T19:47:46Z"
const val BUILD_UNIX_TIME = 1705366066090L
const val DIRTY = 1
7 changes: 7 additions & 0 deletions src/main/kotlin/com/team4099/robot2023/RobotContainer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import com.team4099.robot2023.subsystems.drivetrain.drive.DrivetrainIOReal
import com.team4099.robot2023.subsystems.drivetrain.drive.DrivetrainIOSim
import com.team4099.robot2023.subsystems.drivetrain.gyro.GyroIO
import com.team4099.robot2023.subsystems.drivetrain.gyro.GyroIOPigeon2
import com.team4099.robot2023.subsystems.intake.Intake
import com.team4099.robot2023.subsystems.intake.IntakeIONEO
import com.team4099.robot2023.subsystems.intake.IntakeIOSim
import com.team4099.robot2023.subsystems.limelight.LimelightVision
import com.team4099.robot2023.subsystems.limelight.LimelightVisionIO
import com.team4099.robot2023.subsystems.superstructure.Request
Expand All @@ -23,6 +26,7 @@ import org.team4099.lib.units.derived.degrees

object RobotContainer {
private val drivetrain: Drivetrain
private val intake: Intake
private val vision: Vision
private val limelight: LimelightVision

Expand All @@ -31,6 +35,7 @@ object RobotContainer {
// Real Hardware Implementations
// drivetrain = Drivetrain(object: GyroIO {},object: DrivetrainIO {}
drivetrain = Drivetrain(GyroIOPigeon2, DrivetrainIOReal)
intake = Intake(IntakeIONEO)
vision =
Vision(
// object: CameraIO {}
Expand All @@ -45,6 +50,7 @@ object RobotContainer {
} else {
// Simulation implementations
drivetrain = Drivetrain(object : GyroIO {}, DrivetrainIOSim)
intake = Intake(IntakeIOSim)
vision =
Vision(
CameraIONorthstar("northstar_1"),
Expand Down Expand Up @@ -110,6 +116,7 @@ object RobotContainer {

fun mapTeleopControls() {
ControlBoard.resetGyro.whileTrue(ResetGyroYawCommand(drivetrain, toAngle = 180.degrees))
ControlBoard.groundIntakeTest.whileTrue(intake.generateIntakeTestCommand())
// ControlBoard.autoLevel.whileActiveContinuous(
// GoToAngle(drivetrain).andThen(AutoLevel(drivetrain))
// )
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/com/team4099/robot2023/config/ControlBoard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@ object ControlBoard {

// for testing
val setArmCommand = Trigger { technician.yButton }

val groundIntakeTest = Trigger { driver.aButton }
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.team4099.lib.units.base.amps
import org.team4099.lib.units.derived.volts

object IntakeConstants {
val ROLLER_INERTIA = 0.0014948033 // this one has been updated
val ROLLER_INERTIA = 0.002459315 // this one has been updated
val VOLTAGE_COMPENSATION = 12.0.volts

// TODO: Change gear ratio according to robot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import com.team4099.lib.hal.Clock
import com.team4099.robot2023.config.constants.Constants
import com.team4099.robot2023.config.constants.IntakeConstants
import com.team4099.robot2023.subsystems.superstructure.Request
import edu.wpi.first.wpilibj2.command.Command
import edu.wpi.first.wpilibj2.command.Commands.runOnce
import org.littletonrobotics.junction.Logger
import org.team4099.lib.units.base.inSeconds
import org.team4099.lib.units.derived.ElectricalPotential
Expand Down Expand Up @@ -82,6 +84,11 @@ class Intake(val io: IntakeIO) {
io.setRollerVoltage(appliedVoltage)
}

fun generateIntakeTestCommand(): Command {
val returnCommand = runOnce({ currentRequest = Request.IntakeRequest.OpenLoop(12.volts) })
return returnCommand
}

companion object {
enum class IntakeState {
UNINITIALIZED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@ import org.team4099.lib.units.derived.rotations
import org.team4099.lib.units.derived.volts
import org.team4099.lib.units.perMinute

class IntakeIOSim : IntakeIO {
object IntakeIOSim : IntakeIO {
private val rollerSim: FlywheelSim = FlywheelSim(
DCMotor.getNEO(1),
IntakeConstants.ROLLER_GEAR_RATIO,
IntakeConstants.ROLLER_INERTIA
)

private var appliedVoltage = 0.volts;
init{}

override fun updateInputs(inputs: IntakeIO.IntakeIOInputs) {

rollerSim.update(Constants.Universal.LOOP_PERIOD_TIME.inSeconds)

inputs.rollerVelocity = rollerSim.getAngularVelocityRPM().rotations.perMinute
inputs.rollerAppliedVoltage = 0.volts
inputs.rollerAppliedVoltage = appliedVoltage
inputs.rollerSupplyCurrent = 0.amps
inputs.rollerStatorCurrent = rollerSim.currentDrawAmps.amps
inputs.rollerTemp = 0.0.celsius
Expand All @@ -37,6 +38,7 @@ class IntakeIOSim : IntakeIO {
}

override fun setRollerVoltage(voltage: ElectricalPotential) {
appliedVoltage = voltage
rollerSim.setInputVoltage(
clamp(
voltage,
Expand All @@ -46,4 +48,6 @@ class IntakeIOSim : IntakeIO {
.inVolts
)
}

override fun setRollerBrakeMode(brake: Boolean) {}
}

0 comments on commit 73f4f3e

Please sign in to comment.