Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feeder #15

Merged
merged 65 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
99853d7
Revert "create shooter branch"
Shilab66 Jan 9, 2024
3e06a12
Revert "create feeder branch"
Shilab66 Jan 9, 2024
9f55d22
Added Feeder IO File
CodingMaster121 Jan 10, 2024
2e71129
Merge branch 'feeder' of https://github.com/team4099/Crescendo-2024 i…
CodingMaster121 Jan 10, 2024
21f0652
Started IO File
SirBeans Jan 10, 2024
a1f5cc8
Finished IO File
SirBeans Jan 10, 2024
1eb31a1
Did work on IO and IONeo for shooter also changed global mainpulator …
SirBeans Jan 12, 2024
ec012fa
added feeder and wrist and did requests and started states
SirBeans Jan 13, 2024
a51f5a5
Did more targeting position state and open loop state
SirBeans Jan 14, 2024
d84ce3c
Implemeted functions from IO in IONEO
SirBeans Jan 14, 2024
4bc6dbf
Added flywheel subsystem
SirBeans Jan 15, 2024
829a075
Started flywheel PID and did feedforward
SirBeans Jan 15, 2024
c0a3c45
Fixed some issues
CodingMaster121 Jan 16, 2024
a15439d
Fixed some issues
CodingMaster121 Jan 16, 2024
5491f51
Fixed bugs and did more work on PID and feedforward for flywheel
SirBeans Jan 16, 2024
c761b7c
Fixed bugs and did more work on PID and feedforward for flywheel
SirBeans Jan 16, 2024
916fa61
Merge remote-tracking branch 'origin/shooter' into shooter
SirBeans Jan 16, 2024
6b69d80
Fixed bugs and did more work on PID and feedforward for flywheel
SirBeans Jan 16, 2024
e5df1b0
Added Feeder IO File
CodingMaster121 Jan 10, 2024
44bfc2f
create telescoping arm branch
Shilab66 Jan 8, 2024
6a4a99b
create ground intake branch
Shilab66 Jan 8, 2024
a26ab30
create feeder branch
Shilab66 Jan 8, 2024
72d1ce5
Create Feeder.kt
Shilab66 Jan 8, 2024
afeb5b0
Revert "create feeder branch"
Shilab66 Jan 9, 2024
e118fff
Added Feeder class
fyrhanish Jan 17, 2024
d29adaf
Merge branch 'feeder' of https://github.com/team4099/Crescendo-2024 i…
NeonCoal Jan 17, 2024
525a6cd
Update Shooter.kt
NeonCoal Jan 17, 2024
64ff6b3
Update Shooter.kt
NeonCoal Jan 17, 2024
f30fe02
Made feeder skeleton
Jan 17, 2024
d5e1c2a
Merge remote-tracking branch 'origin/feeder' into feeder
Jan 17, 2024
7184cdc
celsius is spelled wrong :-1:
00magikarp Jan 18, 2024
355f9bd
Removed flywheel and added PID constants
Jan 19, 2024
8ad5d8d
Merge remote-tracking branch 'origin/feeder' into feeder
Jan 19, 2024
f309b35
Completed FeederIO
Jan 21, 2024
e815efe
Completed Feeder and FeederIO
Jan 21, 2024
6dd2802
Rebased feeder
Jan 21, 2024
9ed42d4
Rebased feeder
Jan 21, 2024
44dbde2
Started IO File
SirBeans Jan 10, 2024
5f33d2c
Finished IO File
SirBeans Jan 10, 2024
c14efdd
Did work on IO and IONeo for shooter also changed global mainpulator …
SirBeans Jan 12, 2024
14b7e89
added feeder and wrist and did requests and started states
SirBeans Jan 13, 2024
3eb7677
Did more targeting position state and open loop state
SirBeans Jan 14, 2024
6810449
Implemeted functions from IO in IONEO
SirBeans Jan 14, 2024
10ddca5
Added flywheel subsystem
SirBeans Jan 15, 2024
38808e6
Started flywheel PID and did feedforward
SirBeans Jan 15, 2024
219da3f
Fixed bugs and did more work on PID and feedforward for flywheel
SirBeans Jan 16, 2024
672e61e
Fixed bugs and did more work on PID and feedforward for flywheel
SirBeans Jan 16, 2024
290e36e
Fixed bugs and did more work on PID and feedforward for flywheel
SirBeans Jan 16, 2024
dc09289
Added Feeder IO File
CodingMaster121 Jan 10, 2024
8ef2c12
create telescoping arm branch
Shilab66 Jan 8, 2024
8db051f
create ground intake branch
Shilab66 Jan 8, 2024
0c2ad52
create feeder branch
Shilab66 Jan 8, 2024
a0f1067
Create Feeder.kt
Shilab66 Jan 8, 2024
aa2c301
Revert "create feeder branch"
Shilab66 Jan 9, 2024
b1c3825
Added Feeder class
fyrhanish Jan 17, 2024
c4a0628
Made feeder skeleton
Jan 17, 2024
1f88265
Removed flywheel and added PID constants
Jan 19, 2024
e67fedc
celsius is spelled wrong :-1:
00magikarp Jan 18, 2024
b0c5157
Completed FeederIO
Jan 21, 2024
0a86d9b
Completed Feeder and FeederIO
Jan 21, 2024
3be0983
Rebased feeder
Jan 21, 2024
7128c18
Rebased feeder
Jan 21, 2024
177b056
feeder sim stuff but unfinished
NeonCoal Jan 21, 2024
d603b93
finish feeder
MatthewChoulas Jan 21, 2024
ffd7923
completed saraansh's peer review
00magikarp Jan 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,4 @@ out/

# Simulation GUI and other tools window save file
*-window.json

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ dependencies {
simulationRelease wpi.sim.enableRelease()

implementation 'org.jetbrains.kotlin:kotlin-test-junit5'
implementation 'com.github.team4099:FalconUtils:1.1.28'
implementation 'com.github.team4099:FalconUtils:1.1.29'
implementation 'org.apache.commons:commons-collections4:4.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation "io.javalin:javalin:5.3.2"
Expand Down
5 changes: 5 additions & 0 deletions simgui-ds.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,10 @@
"buttonCount": 0,
"povCount": 0
}
],
"robotJoysticks": [
{
"guid": "Keyboard0"
}
]
}
101 changes: 56 additions & 45 deletions src/main/kotlin/com/team4099/lib/phoenix6/PositionVoltage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,61 @@ import org.team4099.lib.units.perSecond
import com.ctre.phoenix6.controls.PositionVoltage as PositionVoltagePhoenix6

class PositionVoltage(
var position: Angle, // Assuming an AngularPosition type exists similar to AngularVelocity
var enableFOC: Boolean = true,
var feedforward: ElectricalPotential = 0.0.volts,
var slot: Int = 0,
var overrideBrakeDurNeutral: Boolean = false,
var limitForwardMotion: Boolean = false,
var limitReverseMotion: Boolean = false,
var velocity: AngularVelocity = 0.0.degrees.perSecond,
private var position:
Angle, // Assuming an AngularPosition type exists similar to AngularVelocity
private var enableFOC: Boolean = true,
private var feedforward: ElectricalPotential = 0.0.volts,
private var slot: Int = 0,
private var overrideBrakeDurNeutral: Boolean = false,
private var limitForwardMotion: Boolean = false,
private var limitReverseMotion: Boolean = false,
private var velocity: AngularVelocity = 0.0.degrees.perSecond,
) {

val positionVoltagePhoenix6 = PositionVoltagePhoenix6(position.inRotations, velocity.inRotationsPerSecond, enableFOC, feedforward.inVolts, slot, overrideBrakeDurNeutral, limitForwardMotion, limitReverseMotion)

fun setPosition(new_position: Angle) {
position = new_position
positionVoltagePhoenix6.Position = new_position.inRotations
}

fun setEnableFOC(new_enableFOC: Boolean) {
enableFOC = new_enableFOC
positionVoltagePhoenix6.EnableFOC = new_enableFOC
}

fun setFeedforward(new_feedforward: ElectricalPotential) {
feedforward = new_feedforward
positionVoltagePhoenix6.FeedForward = new_feedforward.inVolts
}

fun setSlot(new_slot: Int) {
slot = new_slot
positionVoltagePhoenix6.Slot = new_slot
}

fun setOverrideBrakeDurNeutral(new_override: Boolean) {
overrideBrakeDurNeutral = new_override
positionVoltagePhoenix6.OverrideBrakeDurNeutral = new_override
}

fun setLimitForwardMotion(new_limitForward: Boolean) {
limitForwardMotion = new_limitForward
positionVoltagePhoenix6.LimitForwardMotion = new_limitForward
}

fun setLimitReverseMotion(new_limitReverse: Boolean) {
limitReverseMotion = new_limitReverse
positionVoltagePhoenix6.LimitReverseMotion = new_limitReverse
}
}
val positionVoltagePhoenix6 =
PositionVoltagePhoenix6(
position.inRotations,
velocity.inRotationsPerSecond,
enableFOC,
feedforward.inVolts,
slot,
overrideBrakeDurNeutral,
limitForwardMotion,
limitReverseMotion
)

fun setPosition(new_position: Angle) {
position = new_position
positionVoltagePhoenix6.Position = new_position.inRotations
}

fun setEnableFOC(new_enableFOC: Boolean) {
enableFOC = new_enableFOC
positionVoltagePhoenix6.EnableFOC = new_enableFOC
}

fun setFeedforward(new_feedforward: ElectricalPotential) {
feedforward = new_feedforward
positionVoltagePhoenix6.FeedForward = new_feedforward.inVolts
}

fun setSlot(new_slot: Int) {
slot = new_slot
positionVoltagePhoenix6.Slot = new_slot
}

fun setOverrideBrakeDurNeutral(new_override: Boolean) {
overrideBrakeDurNeutral = new_override
positionVoltagePhoenix6.OverrideBrakeDurNeutral = new_override
}

fun setLimitForwardMotion(new_limitForward: Boolean) {
limitForwardMotion = new_limitForward
positionVoltagePhoenix6.LimitForwardMotion = new_limitForward
}

fun setLimitReverseMotion(new_limitReverse: Boolean) {
limitReverseMotion = new_limitReverse
positionVoltagePhoenix6.LimitReverseMotion = new_limitReverse
}
}
98 changes: 55 additions & 43 deletions src/main/kotlin/com/team4099/lib/phoenix6/VelocityVoltage.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.team4099.lib.phoenix6

import com.ctre.phoenix6.controls.VelocityVoltage as VelocityVoltagePhoenix6
import org.team4099.lib.units.AngularAcceleration
import org.team4099.lib.units.AngularVelocity
import org.team4099.lib.units.derived.ElectricalPotential
Expand All @@ -10,55 +9,68 @@ import org.team4099.lib.units.derived.volts
import org.team4099.lib.units.inRotationsPerSecond
import org.team4099.lib.units.inRotationsPerSecondPerSecond
import org.team4099.lib.units.perSecond
import com.ctre.phoenix6.controls.VelocityVoltage as VelocityVoltagePhoenix6

class VelocityVoltage(var velocity: AngularVelocity,
var acceleration: AngularAcceleration = 0.0.degrees.perSecond.perSecond,
var enableFOC:Boolean = true,
var feedforward: ElectricalPotential = 0.0.volts,
var slot:Int = 0,
var overrideBrakeDurNeutral: Boolean = false,
var limitForwardMotion: Boolean = false,
var limitReverseMotion: Boolean = false){
class VelocityVoltage(
private var velocity: AngularVelocity,
private var acceleration: AngularAcceleration = 0.0.degrees.perSecond.perSecond,
private var enableFOC: Boolean = true,
private var feedforward: ElectricalPotential = 0.0.volts,
private var slot: Int = 0,
private var overrideBrakeDurNeutral: Boolean = false,
private var limitForwardMotion: Boolean = false,
private var limitReverseMotion: Boolean = false
) {

val velocityVoltagePhoenix6 = VelocityVoltagePhoenix6(velocity.inRotationsPerSecond, acceleration.inRotationsPerSecondPerSecond, enableFOC, feedforward.inVolts, slot, overrideBrakeDurNeutral, limitForwardMotion, limitReverseMotion)
val velocityVoltagePhoenix6 =
VelocityVoltagePhoenix6(
velocity.inRotationsPerSecond,
acceleration.inRotationsPerSecondPerSecond,
enableFOC,
feedforward.inVolts,
slot,
overrideBrakeDurNeutral,
limitForwardMotion,
limitReverseMotion
)

fun setVelocity(new_velocity: AngularVelocity) {
velocity = new_velocity
velocityVoltagePhoenix6.Velocity = velocity.inRotationsPerSecond
}
fun setVelocity(new_velocity: AngularVelocity) {
velocity = new_velocity
velocityVoltagePhoenix6.Velocity = velocity.inRotationsPerSecond
}

fun setAcceleration(new_accel: AngularAcceleration) {
acceleration = new_accel
velocityVoltagePhoenix6.Acceleration = acceleration.inRotationsPerSecondPerSecond
}
fun setAcceleration(new_accel: AngularAcceleration) {
acceleration = new_accel
velocityVoltagePhoenix6.Acceleration = acceleration.inRotationsPerSecondPerSecond
}

fun setEnableFOC(new_enableFOC: Boolean) {
enableFOC = new_enableFOC
velocityVoltagePhoenix6.EnableFOC = new_enableFOC
}
fun setEnableFOC(new_enableFOC: Boolean) {
enableFOC = new_enableFOC
velocityVoltagePhoenix6.EnableFOC = new_enableFOC
}

fun setFeedforward(new_feedforward: ElectricalPotential) {
feedforward = new_feedforward
velocityVoltagePhoenix6.FeedForward = new_feedforward.inVolts
}
fun setFeedforward(new_feedforward: ElectricalPotential) {
feedforward = new_feedforward
velocityVoltagePhoenix6.FeedForward = new_feedforward.inVolts
}

fun setSlot(new_slot: Int) {
slot = new_slot
velocityVoltagePhoenix6.Slot = new_slot
}
fun setSlot(new_slot: Int) {
slot = new_slot
velocityVoltagePhoenix6.Slot = new_slot
}

fun setOverrideBrakeDurNeutral(new_override: Boolean) {
overrideBrakeDurNeutral = new_override
velocityVoltagePhoenix6.OverrideBrakeDurNeutral = new_override
}
fun setOverrideBrakeDurNeutral(new_override: Boolean) {
overrideBrakeDurNeutral = new_override
velocityVoltagePhoenix6.OverrideBrakeDurNeutral = new_override
}

fun setLimitForwardMotion(new_limitForward: Boolean) {
limitForwardMotion = new_limitForward
velocityVoltagePhoenix6.LimitForwardMotion = new_limitForward
}
fun setLimitForwardMotion(new_limitForward: Boolean) {
limitForwardMotion = new_limitForward
velocityVoltagePhoenix6.LimitForwardMotion = new_limitForward
}

fun setLimitReverseMotion(new_limitReverse: Boolean) {
limitReverseMotion = new_limitReverse
velocityVoltagePhoenix6.LimitReverseMotion = new_limitReverse
}
}
fun setLimitReverseMotion(new_limitReverse: Boolean) {
limitReverseMotion = new_limitReverse
velocityVoltagePhoenix6.LimitReverseMotion = new_limitReverse
}
}
12 changes: 6 additions & 6 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 = 28
const val GIT_SHA = "eca16395eb62f3d6d367479ab32e985e6472149b"
const val GIT_DATE = "2024-01-16T14:49:50Z"
const val GIT_BRANCH = "targeting-command-with-drivetrain"
const val BUILD_DATE = "2024-01-16T15:27:50Z"
const val BUILD_UNIX_TIME = 1705436870465L
const val GIT_REVISION = 102
const val GIT_SHA = "177b056f2e17e0175cc3fd37903303defea08ea0"
const val GIT_DATE = "2024-01-20T20:08:22Z"
const val GIT_BRANCH = "feeder"
const val BUILD_DATE = "2024-01-20T23:40:50Z"
const val BUILD_UNIX_TIME = 1705812050035L
const val DIRTY = 1
19 changes: 10 additions & 9 deletions src/main/kotlin/com/team4099/robot2023/RobotContainer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,31 @@ import com.team4099.robot2023.subsystems.drivetrain.drive.Drivetrain
import com.team4099.robot2023.subsystems.drivetrain.drive.DrivetrainIO
import com.team4099.robot2023.subsystems.drivetrain.drive.DrivetrainIOSim
import com.team4099.robot2023.subsystems.drivetrain.gyro.GyroIO
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.feeder.Feeder
import com.team4099.robot2023.subsystems.feeder.FeederIONeo
import com.team4099.robot2023.subsystems.feeder.FeederIOSim
import com.team4099.robot2023.subsystems.limelight.LimelightVision
import com.team4099.robot2023.subsystems.limelight.LimelightVisionIO
import com.team4099.robot2023.subsystems.superstructure.Request.DrivetrainRequest as DrivetrainRequest
import com.team4099.robot2023.subsystems.vision.Vision
import com.team4099.robot2023.subsystems.vision.camera.CameraIONorthstar
import com.team4099.robot2023.util.driver.Ryan
import edu.wpi.first.wpilibj.RobotBase
import org.team4099.lib.geometry.Pose2d
import org.team4099.lib.smoothDeadband
import org.team4099.lib.units.base.feet
import org.team4099.lib.units.derived.Angle
import org.team4099.lib.units.derived.degrees
import com.team4099.robot2023.subsystems.superstructure.Request.DrivetrainRequest as DrivetrainRequest

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

init {
if (RobotBase.isReal()) {
// Real Hardware Implementations
// drivetrain = Drivetrain(object: GyroIO {},object: DrivetrainIO {}
drivetrain = Drivetrain(object : GyroIO {}, object : DrivetrainIO {})
intake = Intake(IntakeIONEO)
vision =
Vision(
// object: CameraIO {}
Expand All @@ -48,17 +45,18 @@ object RobotContainer {
// CameraIONorthstar("backward")
)
limelight = LimelightVision(object : LimelightVisionIO {})
feeder = Feeder(FeederIONeo)
} else {
// Simulation implementations
drivetrain = Drivetrain(object : GyroIO {}, DrivetrainIOSim)
intake = Intake(IntakeIOSim)
vision =
Vision(
CameraIONorthstar("northstar_1"),
CameraIONorthstar("northstar_2"),
CameraIONorthstar("northstar_3"),
)
limelight = LimelightVision(object : LimelightVisionIO {})
feeder = Feeder(FeederIOSim)
}

vision.setDataInterfaces({ drivetrain.odometryPose }, { drivetrain.addVisionData(it) })
Expand Down Expand Up @@ -135,6 +133,9 @@ object RobotContainer {
// Constants.Universal.Substation.SINGLE_SUBSTATION
// )
// )

ControlBoard.feederShootTest.whileTrue(feeder.feederOpenLoopIntakeTestCommand())
ControlBoard.feederIntakeTest.whileTrue(feeder.feederOpenLoopShootTestCommand())
}

fun mapTestControls() {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package com.team4099.robot2023.commands.drivetrain

import com.team4099.robot2023.subsystems.drivetrain.drive.Drivetrain
import com.team4099.robot2023.subsystems.superstructure.Request.DrivetrainRequest as DrivetrainRequest
import edu.wpi.first.wpilibj2.command.Command
import org.team4099.lib.units.base.meters
import org.team4099.lib.units.derived.radians
import org.team4099.lib.units.perSecond
import com.team4099.robot2023.subsystems.superstructure.Request.DrivetrainRequest as DrivetrainRequest

class DriveBrakeModeCommand(val drivetrain: Drivetrain) : Command() {
init {
addRequirements(drivetrain)
}

override fun execute() {
drivetrain.currentRequest = DrivetrainRequest.OpenLoop(
drivetrain.currentRequest =
DrivetrainRequest.OpenLoop(
0.0.radians.perSecond, Pair(0.0.meters.perSecond, 0.0.meters.perSecond)
)
drivetrain.swerveModules.forEach() { it.setDriveBrakeMode(true) }
Expand Down
Loading
Loading