Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
275 changes: 0 additions & 275 deletions src/main/java/com/team5024/lib/statemachines/RobotLogger.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/java/frc/robot/subsystems/Intake.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package frc.robot.subsystems;

import com.team5024.lib.statemachines.StateMachine;
import com.team5024.lib.statemachines.StateMetadata;
import io.github.frc5024.libkontrol.StateMachine;
import io.github.frc5024.libkontrol.StateMetadata;

import edu.wpi.first.wpilibj.motorcontrol.Talon;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/subsystems/Kicker.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package frc.robot.subsystems;

import com.team5024.lib.statemachines.StateMachine;
import com.team5024.lib.statemachines.StateMetadata;
import io.github.frc5024.libkontrol.StateMachine;
import io.github.frc5024.libkontrol.StateMetadata;

import edu.wpi.first.wpilibj.motorcontrol.Talon;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/io/github/frc5024/libkontrol/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# LibKontrol

LibKontrol (The **Lib**5**K** C**ontrol** Library) is a small [state machine](https://en.wikipedia.org/wiki/Finite-state_machine) library built by [the software team of 2020](https://github.com/frc5024/InfiniteRecharge/graphs/contributors), and formalized into its own package later in 2021 by [Evan Pratten](https://ewpratten.com).

So far, this library has powered the state management of every robot built since 2019.

## A note for future users

From 2022 onwards, the team likes to copy this module around to their new repositories instead of including it as a proper Gradle dependency.

**If you are about to copy-paste this somewhere** please keep the package name the same. This means, keeping the path to this directory as `src/main/java/io/github/frc5024/libkontrol`.

## Documentation

The original tutorial document has been included in this directory for your reference. Find it at [`tutorial.md`](./tutorial.md)
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
package com.team5024.lib.statemachines;
package io.github.frc5024.libkontrol;

import java.util.function.Consumer;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class StateHandler<T> {

private T key;
private StateMachine<T> parent;
private Consumer<StateMetadata<T>> action;

/**
* Create a StateHandler for a given state
*
* @param key The key for this state (it's name)
* @param parent The state machine that owns this object
* @param action The action to be performed during this state
*/
public StateHandler(@Nonnull T key, @Nonnull StateMachine<T> parent, @Nonnull Consumer<StateMetadata<T>> action) {
this.key = key;
public StateHandler(@Nonnull StateMachine<T> parent, @Nonnull Consumer<StateMetadata<T>> action) {
this.parent = parent;
this.action = action;
}

public T getKey() {
return this.key;
}

/**
* Call the action function
*
Expand Down
Loading