Skip to content

Commit 0bae2b6

Browse files
committed
dirty commit 1
Signed-off-by: Dasun Abeykoon <[email protected]>
1 parent 9605637 commit 0bae2b6

File tree

10 files changed

+258
-56
lines changed

10 files changed

+258
-56
lines changed

networktables.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

simgui-ds.json

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"keyboardJoysticks": [
3+
{
4+
"axisConfig": [
5+
{
6+
"decKey": 65,
7+
"incKey": 68
8+
},
9+
{
10+
"decKey": 87,
11+
"incKey": 83
12+
},
13+
{
14+
"decKey": 69,
15+
"decayRate": 0.0,
16+
"incKey": 82,
17+
"keyRate": 0.009999999776482582
18+
}
19+
],
20+
"axisCount": 3,
21+
"buttonCount": 4,
22+
"buttonKeys": [
23+
90,
24+
88,
25+
67,
26+
86
27+
],
28+
"povConfig": [
29+
{
30+
"key0": 328,
31+
"key135": 323,
32+
"key180": 322,
33+
"key225": 321,
34+
"key270": 324,
35+
"key315": 327,
36+
"key45": 329,
37+
"key90": 326
38+
}
39+
],
40+
"povCount": 1
41+
},
42+
{
43+
"axisConfig": [
44+
{
45+
"decKey": 74,
46+
"incKey": 76
47+
},
48+
{
49+
"decKey": 73,
50+
"incKey": 75
51+
}
52+
],
53+
"axisCount": 2,
54+
"buttonCount": 4,
55+
"buttonKeys": [
56+
77,
57+
44,
58+
46,
59+
47
60+
],
61+
"povCount": 0
62+
},
63+
{
64+
"axisConfig": [
65+
{
66+
"decKey": 263,
67+
"incKey": 262
68+
},
69+
{
70+
"decKey": 265,
71+
"incKey": 264
72+
}
73+
],
74+
"axisCount": 2,
75+
"buttonCount": 6,
76+
"buttonKeys": [
77+
260,
78+
268,
79+
266,
80+
261,
81+
269,
82+
267
83+
],
84+
"povCount": 0
85+
},
86+
{
87+
"axisCount": 0,
88+
"buttonCount": 0,
89+
"povCount": 0
90+
}
91+
]
92+
}

simgui-window.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"Docking": {
3+
"Data": []
4+
},
5+
"MainWindow": {
6+
"GLOBAL": {
7+
"font": "Proggy Dotted",
8+
"fps": "120",
9+
"height": "1800",
10+
"maximized": "0",
11+
"style": "0",
12+
"userScale": "2",
13+
"width": "3200",
14+
"xpos": "532",
15+
"ypos": "100"
16+
}
17+
},
18+
"Window": {
19+
"###FMS": {
20+
"Collapsed": "0",
21+
"Pos": "12,1350",
22+
"Size": "600,248"
23+
},
24+
"###Joysticks": {
25+
"Collapsed": "0",
26+
"Pos": "632,1412",
27+
"Size": "1876,127"
28+
},
29+
"###NetworkTables": {
30+
"Collapsed": "0",
31+
"Pos": "625,692",
32+
"Size": "1875,741"
33+
},
34+
"###NetworkTables Info": {
35+
"Collapsed": "0",
36+
"Pos": "625,325",
37+
"Size": "1875,362"
38+
},
39+
"###Other Devices": {
40+
"Collapsed": "0",
41+
"Pos": "2562,50",
42+
"Size": "625,1737"
43+
},
44+
"###System Joysticks": {
45+
"Collapsed": "0",
46+
"Pos": "12,875",
47+
"Size": "435,434"
48+
},
49+
"###Timing": {
50+
"Collapsed": "0",
51+
"Pos": "12,375",
52+
"Size": "294,217"
53+
},
54+
"Debug##Default": {
55+
"Collapsed": "0",
56+
"Pos": "60,60",
57+
"Size": "400,400"
58+
},
59+
"Robot State": {
60+
"Collapsed": "0",
61+
"Pos": "5,20",
62+
"Size": "213,224"
63+
}
64+
}
65+
}

simgui.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"NTProvider": {
3+
"types": {
4+
"/FMSInfo": "FMSInfo",
5+
"/Field": "Field2d",
6+
"/SmartDashboard/Alerts": "Alerts"
7+
}
8+
},
9+
"NetworkTables": {
10+
"transitory": {
11+
"Robot": {
12+
"bin": {
13+
"hardware": {
14+
"open": true
15+
},
16+
"open": true
17+
},
18+
"open": true
19+
},
20+
"Telemetry": {
21+
"bin": {
22+
"hardware": {
23+
"open": true
24+
}
25+
},
26+
"elevator": {
27+
"open": true
28+
},
29+
"open": true
30+
}
31+
}
32+
},
33+
"NetworkTables Info": {
34+
"visible": true
35+
}
36+
}

src/main/java/org/frc6423/lib/drivers/LoggedSubsystem.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/main/java/org/frc6423/robot/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class Constants {
2121
/** Constants that affect robot behavior during runtime */
2222
public class Flags {
2323
public static final Time LOOPTIME = Seconds.of(0.02);
24+
public static final boolean debugMode = false;
2425
}
2526

2627
/** Constants representing port IDs that devices are connected to */

src/main/java/org/frc6423/robot/Robot.java

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,40 @@
88

99
import static edu.wpi.first.units.Units.Seconds;
1010

11+
import edu.wpi.first.epilogue.Epilogue;
12+
import edu.wpi.first.epilogue.Logged;
13+
import edu.wpi.first.epilogue.logging.LazyBackend;
14+
import edu.wpi.first.epilogue.logging.NTEpilogueBackend;
15+
import edu.wpi.first.epilogue.logging.errors.ErrorHandler;
16+
import edu.wpi.first.networktables.NetworkTableInstance;
1117
import edu.wpi.first.wpilibj.Alert;
1218
import edu.wpi.first.wpilibj.Alert.AlertType;
19+
import edu.wpi.first.wpilibj.DataLogManager;
1320
import edu.wpi.first.wpilibj.DriverStation;
1421
import edu.wpi.first.wpilibj.RobotController;
1522
import edu.wpi.first.wpilibj.XboxController;
1623
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
1724
import edu.wpi.first.wpilibj2.command.Command;
1825
import edu.wpi.first.wpilibj2.command.Commands;
1926
import org.frc6423.lib.drivers.CommandRobot;
20-
import org.frc6423.lib.utilities.Tracer;
21-
import org.frc6423.monologue.Logged;
22-
import org.frc6423.monologue.Monologue;
23-
import org.frc6423.monologue.Monologue.MonologueConfig;
2427
import org.frc6423.robot.Constants.Flags;
25-
import org.frc6423.robot.subsystems.trashBin.TrashBin;
26-
import org.frc6423.robot.subsystems.trashBin.TrashBinIOSim;
28+
import org.frc6423.robot.subsystems.trashBin.Elevator;
29+
import org.frc6423.robot.subsystems.trashBin.ElevatorIOSim;
2730

2831
/**
2932
* Declares the structure of the robot program (subsystems, commands, triggers, etc.).
3033
*
3134
* <p>Only scheduler calls are allowed in the {@link Robot} periodic method. Very little logic
3235
* should be defined in it.
3336
*/
34-
public class Robot extends CommandRobot implements Logged {
37+
@Logged
38+
public class Robot extends CommandRobot {
3539
// * IO INIT
3640
private final XboxController driverController = new XboxController(0);
3741
private final XboxController operatorController = new XboxController(1);
3842

3943
// * SUBSYSTEM INIT
40-
private final TrashBin bin = new TrashBin(new TrashBinIOSim());
44+
@Logged private final Elevator elevator = new Elevator(new ElevatorIOSim());
4145

4246
// * ALERT INIT
4347
private final Alert batteryBrownout = new Alert("Battery voltage output low", AlertType.kWarning);
@@ -54,31 +58,38 @@ public Robot() {
5458
// Prevent driverstation from clogging output
5559
DriverStation.silenceJoystickConnectionWarning(true);
5660

57-
// Initialize Monologue
58-
Monologue.setupMonologue(
59-
this,
60-
"/Robot",
61-
new MonologueConfig()
62-
.withAllowNonFinalLoggedFields(true)
63-
.withDatalogPrefix("Telemetry")
64-
.withLazyLogging(true)
65-
.withOptimizeBandwidth(DriverStation::isFMSAttached)
66-
.withThrowOnWarning(false));
67-
68-
// Log build data to datalog
69-
final String meta = "/BuildData/";
70-
Monologue.log(meta + "RuntimeType", getRuntimeType().toString());
71-
Monologue.log(meta + "ProjectName", BuildConstants.MAVEN_NAME);
72-
Monologue.log(meta + "Version", BuildConstants.VERSION);
73-
Monologue.log(meta + "BuildDate", BuildConstants.BUILD_DATE);
74-
Monologue.log(meta + "GitDirty", String.valueOf(BuildConstants.DIRTY));
75-
Monologue.log(meta + "GitSHA", BuildConstants.GIT_SHA);
76-
Monologue.log(meta + "GitDate", BuildConstants.GIT_DATE);
77-
Monologue.log(meta + "GitBranch", BuildConstants.GIT_BRANCH);
78-
79-
// Update and trace monologue periodically
80-
addPeriodic(
81-
() -> Tracer.traceFunc("Monologue", Monologue::updateAll), Flags.LOOPTIME.in(Seconds));
61+
// Initialize Epilogue
62+
Epilogue.configure(
63+
config -> {
64+
// Set root data path
65+
config.root = "Telemetry";
66+
67+
// Mirror NT logged data to log file
68+
DataLogManager.start();
69+
// Lazy log to NT
70+
config.backend =
71+
new LazyBackend(new NTEpilogueBackend(NetworkTableInstance.getDefault()));
72+
73+
// Log build data to datalog
74+
final String meta = "/BuildData/";
75+
config.backend.log(meta + "RuntimeType", getRuntimeType().toString());
76+
config.backend.log(meta + "ProjectName", BuildConstants.MAVEN_NAME);
77+
config.backend.log(meta + "Version", BuildConstants.VERSION);
78+
config.backend.log(meta + "BuildDate", BuildConstants.BUILD_DATE);
79+
config.backend.log(meta + "GitDirty", String.valueOf(BuildConstants.DIRTY));
80+
config.backend.log(meta + "GitSHA", BuildConstants.GIT_SHA);
81+
config.backend.log(meta + "GitDate", BuildConstants.GIT_DATE);
82+
config.backend.log(meta + "GitBranch", BuildConstants.GIT_BRANCH);
83+
84+
// crash sim on epilogue error
85+
if (isSimulation()) {
86+
config.errorHandler = ErrorHandler.crashOnError();
87+
}
88+
89+
// Log everything
90+
config.minimumImportance = Logged.Importance.DEBUG;
91+
});
92+
Epilogue.bind(this);
8293

8394
// Update drive dashboard periodically
8495
addPeriodic(this::updateDashboard, 0.02);

src/main/java/org/frc6423/robot/subsystems/trashBin/TrashBin.java renamed to src/main/java/org/frc6423/robot/subsystems/trashBin/Elevator.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66

77
package org.frc6423.robot.subsystems.trashBin;
88

9-
import org.frc6423.lib.drivers.LoggedSubsystem;
10-
import org.frc6423.monologue.Annotations.FlattenedLogged;
9+
import edu.wpi.first.epilogue.Logged;
1110

12-
public class TrashBin extends LoggedSubsystem {
13-
@FlattenedLogged private final TrashBinIO hardware;
11+
public class Elevator {
12+
@Logged private final ElevatorIO hardware;
1413

15-
public TrashBin(TrashBinIO hardware) {
14+
@Logged public double bruh = 0.0;
15+
16+
public Elevator(ElevatorIO hardware) {
1617
this.hardware = hardware;
1718
}
1819
}

src/main/java/org/frc6423/robot/subsystems/trashBin/TrashBinIO.java renamed to src/main/java/org/frc6423/robot/subsystems/trashBin/ElevatorIO.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66

77
package org.frc6423.robot.subsystems.trashBin;
88

9-
import org.frc6423.monologue.Annotations.Log;
10-
import org.frc6423.monologue.Logged;
9+
import edu.wpi.first.epilogue.Logged;
1110

12-
public interface TrashBinIO extends Logged {
13-
@Log
11+
@Logged
12+
public interface ElevatorIO {
13+
@Logged(importance = Logged.Importance.INFO)
1414
public double test();
15+
16+
@Logged(importance = Logged.Importance.INFO)
17+
public double testDos();
1518
}

src/main/java/org/frc6423/robot/subsystems/trashBin/TrashBinIOSim.java renamed to src/main/java/org/frc6423/robot/subsystems/trashBin/ElevatorIOSim.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66

77
package org.frc6423.robot.subsystems.trashBin;
88

9-
public class TrashBinIOSim implements TrashBinIO {
9+
public class ElevatorIOSim implements ElevatorIO {
1010
@Override
1111
public double test() {
1212
return 69.69;
1313
}
14+
15+
@Override
16+
public double testDos() {
17+
return 0.0;
18+
}
1419
}

0 commit comments

Comments
 (0)