Skip to content

Commit

Permalink
everything seems fine--> talon reconfigured + sysid and logging now s…
Browse files Browse the repository at this point in the history
…upported
  • Loading branch information
michaelx0281 committed Dec 5, 2024
1 parent ebb7505 commit a751d56
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
13 changes: 7 additions & 6 deletions simgui-ds.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
"visible": true
}
},
"System Joysticks": {
"window": {
"visible": false
}
},
"keyboardJoysticks": [
{
"axisConfig": [
Expand Down Expand Up @@ -106,9 +101,15 @@
}
],
"robotJoysticks": [
{},
{
"guid": "Keyboard1"
},
{
"guid": "Keyboard0"
},
{},
{
"guid": "Keyboard2"
}
]
}
11 changes: 11 additions & 0 deletions src/main/java/org/sciborgs1155/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import static org.sciborgs1155.robot.Constants.PERIOD;
import static org.sciborgs1155.robot.drive.DriveConstants.*;

import com.ctre.phoenix6.SignalLogger;
import edu.wpi.first.wpilibj.DataLogManager;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.GenericHID.RumbleType;
Expand Down Expand Up @@ -60,6 +61,12 @@ public Robot() {
super(PERIOD.in(Seconds));
configureGameBehavior();
configureBindings();
configureLog();
}

private void configureLog() {
SignalLogger.setPath("./logs/");
SignalLogger.enableAutoLogging(true);
}

/** Configures basic behavior for different periods during the game. */
Expand Down Expand Up @@ -138,6 +145,10 @@ private void configureBindings() {
.onFalse(Commands.runOnce(() -> speedMultiplier = Constants.FULL_SPEED_MULTIPLIER));

// TODO: Add any additional bindings.
operator
.a()
.onTrue(Commands.runOnce(SignalLogger::start))
.onFalse(Commands.runOnce(SignalLogger::stop));
}

/**
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/org/sciborgs1155/robot/drive/Drive.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import static org.sciborgs1155.robot.Ports.Drive.*;
import static org.sciborgs1155.robot.drive.DriveConstants.*;

import com.ctre.phoenix6.SignalLogger;
import edu.wpi.first.math.VecBuilder;
import edu.wpi.first.math.Vector;
import edu.wpi.first.math.controller.PIDController;
Expand Down Expand Up @@ -149,7 +150,11 @@ public Drive(

translationCharacterization =
new SysIdRoutine(
new SysIdRoutine.Config(),
new SysIdRoutine.Config(
null,
Volts.of(4),
null,
(state) -> SignalLogger.writeString("translation state", state.toString())),
new SysIdRoutine.Mechanism(
volts ->
modules.forEach(
Expand All @@ -159,7 +164,11 @@ public Drive(
"translation"));
rotationalCharacterization =
new SysIdRoutine(
new SysIdRoutine.Config(),
new SysIdRoutine.Config(
null,
Volts.of(4),
null,
(state) -> SignalLogger.writeString("rotation state", state.toString())),
new SysIdRoutine.Mechanism(
volts -> {
this.frontLeft.updateInputs(
Expand Down

0 comments on commit a751d56

Please sign in to comment.