Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
working on it
Browse files Browse the repository at this point in the history
  • Loading branch information
Taimorioka committed Nov 8, 2024
1 parent 35c3bf4 commit c36ed95
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 7 deletions.
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/java
{
"name": "Java",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/java:1-17-bookworm",

"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "none",
"installMaven": "false",
"installGradle": "true"
},
"ghcr.io/devcontainers-extra/features/kotlin-sdkman:2": {}
}

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,37 @@ package com.frcteam3636.frc2024.subsystems.indexer
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.REVMotorControllerId
import com.revrobotics.CANSparkLowLevel
import kotlin.doubleArrayOf
import edu.wpi.first.wpilibj.util.Color
import edu.wpi.first.wpilibj.


interface IndexerIO{
class IndexerInputs : LoggableInputs {
var indexerVelocity = Rotation2d()
var indexerCurrent: Double = 0.0
var isSpinningBalloon: Boolean = false
var hasBalloon: Boolean = false
var balloonColor = null
var balloonColor: Color = Color.kblack

override fun toLog(table: LogTable?) {
table?.put("Indexer Wheel Velocity", indexerVelocity)
table?.put("Indexer Wheel Current", indexerCurrent)
table?.put("Is spinning", isSpinningBalloon)
table?.put("Has balloon", hasBalloon)
table?.put("Balloon Color", balloonColor)
table?.put("Balloon Color", doubleArrayOf(balloonColor.red, balloonColor.green, balloonColor.blue))
}

override fun fromLog(table: LogTable) {
indexerVelocity = table.get("Indexer Velocity", indexerVelocity)!![0]
indexerCurrent = table.get("Indexer Wheel Current", indexerCurrent)
isSpinningBalloon = table.get("Is spinning", isSpinningBalloon)
hasBalloon = table.get("Has balloon", hasBalloon)
balloonColor = table.get("Balloon Color", balloonColor)
val balloonColorArray: DoubleArray = table.get("Balloon Color", doubleArrayOf(balloonColor.red, balloonColor.green, balloonColor.blue))
balloonColor = Color(balloonColorArray[0], balloonColorArray[1], balloonColorArray[2])
}
}
fun updateInputs(inputs: IndexerInputs)
Expand All @@ -41,22 +49,24 @@ class IndexerIOReal: IndexerIO{
CANSparkLowLevel.MotorType.kBrushless
)

private var colorSensor: DigitalInput = DigitalInput(COLOR_SENSOR_PORT)
private val colorSensorDistance = NetworkTables.getEntry("/proximity1")

private val colorSensorColor = NetworkTables.getEntry("/rawcolor1")

override fun updateInputs(inputs: IndexerIO.IndexerInputs) {
inputs.indexerVelocity = Rotation2d(indexerWheel.encoder.velocity)
inputs.indexerCurrent = indexerWheel.outputCurrent
inputs.isSpinningBalloon = colorSensor.get()
inputs.hasBalloon = colorSensor.get()
inputs.balloonColor = colorSensor.get()
inputs.hasBalloon = colorSensorDistance.getValue() > 1000
inputs.balloonColor = colorSensorColor.getValue()
}

override fun setSpinSpeed(speed: Double) {
indexerWheel.set(speed)
}

internal companion object Constants {
const val COLOR_SENSOR_PORT = 0
const val COLOR_SENSOR_PORT = i2cPort
const val RED_BALLOON_COLOR = (255, 0, 0)
const val BLUE_BALLOON_COLOR = (0, 0, 255)
}
Expand Down

0 comments on commit c36ed95

Please sign in to comment.