Skip to content

Commit

Permalink
force idle when auto aim release
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewChoulas committed Apr 12, 2024
1 parent b8a4c77 commit 38b5483
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/kotlin/com/team4099/robot2023/RobotContainer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ object RobotContainer {
drivetrain
)

superstructure.defaultCommand = superstructure.forceIdleIfAutoAimCommand()

/*
module steeing tuning
Expand Down Expand Up @@ -332,6 +334,7 @@ object RobotContainer {
{ ControlBoard.turn.smoothDeadband(Constants.Joysticks.TURN_DEADBAND) },
{ ControlBoard.slowMode },
drivetrain,
superstructure,
vision
),
superstructure.autoAimCommand()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.team4099.robot2023.config.constants.DrivetrainConstants
import com.team4099.robot2023.config.constants.FieldConstants
import com.team4099.robot2023.subsystems.drivetrain.drive.Drivetrain
import com.team4099.robot2023.subsystems.superstructure.Request
import com.team4099.robot2023.subsystems.superstructure.Superstructure
import com.team4099.robot2023.subsystems.vision.Vision
import com.team4099.robot2023.util.driver.DriverProfile
import com.team4099.robot2023.util.inverse
Expand Down Expand Up @@ -40,6 +41,7 @@ class TargetSpeakerCommand(
val turn: () -> Double,
val slowMode: () -> Boolean,
val drivetrain: Drivetrain,
val superstructure: Superstructure,
val vision: Vision
) : Command() {
private var thetaPID: PIDController<Radian, Velocity<Radian>>
Expand Down Expand Up @@ -123,6 +125,7 @@ class TargetSpeakerCommand(
}

drivetrain.defaultCommand.end(true)
superstructure.defaultCommand.end(true)
Logger.recordOutput("ActiveCommands/TargetAngleCommand", true)
Logger.recordOutput(
"Testing/CurrentDrivetrainRotation", drivetrain.odomTRobot.rotation.inDegrees
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@ object WristConstants {
val TRAP_ANGLE = 35.degrees
val INTAKE_ANGLE = (-33.75).degrees
val IDLE_ANGLE_HAS_GAMEPEICE = -34.degrees
val PASSING_SHOT_ANGLE = -20.degrees
val PASSING_SHOT_ANGLE = -34.degrees
}
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,17 @@ class Superstructure(
return returnCommand
}

fun forceIdleIfAutoAimCommand() : Command {
val returnCommand =
run {
if (currentState == SuperstructureStates.AUTO_AIM) {
currentRequest = Request.SuperstructureRequest.Idle()
}
}
returnCommand.name = "forceIdleIfAutoAim"
return returnCommand
}

fun ejectGamePieceCommand(): Command {
val returnCommand =
runOnce { currentRequest = Request.SuperstructureRequest.EjectGamePiece() }.until {
Expand Down Expand Up @@ -1027,6 +1038,8 @@ class Superstructure(
return returnCommand
}



fun climbExtendCommand(): Command {
val returnCommand =
runOnce { currentRequest = Request.SuperstructureRequest.ClimbExtend() }.until {
Expand Down

0 comments on commit 38b5483

Please sign in to comment.