Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
818588b
switching to logged chooser
jheidegger Jul 10, 2023
868afa2
verifying in simulation
jheidegger Jul 10, 2023
4e44b33
logging commands and using withName decoration for clarity of inline …
jheidegger Jul 10, 2023
c203578
initial removal of commands
jheidegger Jul 20, 2023
0642c87
drivetrain modifications
jheidegger Jul 20, 2023
965a1a6
superstructure cleaning
jheidegger Jul 20, 2023
305b019
fixing swervedrive scaling error
jheidegger Jul 20, 2023
c09eaf4
removing smells
jheidegger Jul 20, 2023
63b3f56
Merge branch 'autonselectionfix' into only_composition_cleaning
jheidegger Jul 20, 2023
885a1c0
drivetrain refactor to more of a statemachine like
jheidegger Jul 20, 2023
5c324cb
photon sim initial
jheidegger Aug 6, 2023
efaec35
cleaned for release
jheidegger Aug 6, 2023
2d1cba2
solve multi tag pnp
jheidegger Aug 7, 2023
f6874ae
changed to poseEstimator
jheidegger Aug 8, 2023
cd5d00d
refined Optional
jheidegger Aug 8, 2023
4414acd
kalman filter and odometry noise
jheidegger Aug 8, 2023
0956693
moving into simIO noise
jheidegger Aug 8, 2023
ad92e82
Moving sim into a seperate class to isolate
jheidegger Aug 8, 2023
e17df85
testing autos
jheidegger Aug 8, 2023
c946c5b
fixed auto drive bug
jheidegger Aug 9, 2023
3d0319e
Merge branch 'composition_rewrite_experimental' into photon_sim
jheidegger Aug 9, 2023
63664cc
making vision work on red and blue
jheidegger Aug 9, 2023
69f301e
moving true sim odom to seperate class
jheidegger Aug 11, 2023
4ff2d21
fixing runtime bug
jheidegger Aug 11, 2023
8e416c8
updating simulated gyro value to true pose
jheidegger Aug 11, 2023
90d74b0
setting up for multiple cameras
jheidegger Aug 11, 2023
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
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ plugins {
id "com.peterabeles.gversion" version "1.10"
id "com.diffplug.spotless" version "6.12.0"
}
repositories {
mavenLocal()
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
5 changes: 2 additions & 3 deletions simgui-ds.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,11 @@
}
],
"robotJoysticks": [
{},
{
"guid": "Keyboard1"
"guid": "Keyboard0"
},
{
"guid": "Keyboard0"
"guid": "Keyboard1"
}
]
}
27 changes: 17 additions & 10 deletions simgui-window.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
"MainWindow": {
"GLOBAL": {
"fps": "120",
"height": "720",
"height": "736",
"maximized": "0",
"style": "0",
"userScale": "2",
"width": "1280",
"xpos": "537",
"ypos": "110"
"width": "1440",
"xpos": "233",
"ypos": "830"
}
},
"Table": {
"0x542B5671,2": {
"Column 0 Width": "169",
"Column 1 Width": "156",
"RefScale": "13"
}
},
"Window": {
Expand All @@ -22,22 +29,22 @@
},
"###Joysticks": {
"Collapsed": "0",
"Pos": "250,465",
"Pos": "43,465",
"Size": "796,155"
},
"###NetworkTables": {
"Collapsed": "0",
"Pos": "250,277",
"Size": "750,185"
"Pos": "327,29",
"Size": "475,435"
},
"###Other Devices": {
"Collapsed": "0",
"Pos": "1025,20",
"Pos": "145,13",
"Size": "250,695"
},
"###System Joysticks": {
"Collapsed": "0",
"Pos": "5,350",
"Pos": "20,319",
"Size": "192,218"
},
"###Timing": {
Expand All @@ -47,7 +54,7 @@
},
"Debug##Default": {
"Collapsed": "0",
"Pos": "60,60",
"Pos": "43,60",
"Size": "400,400"
},
"Robot State": {
Expand Down
40 changes: 39 additions & 1 deletion simgui.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@
"types": {
"/AdvantageKit/RealOutputs/Arm/mech2d": "Mechanism2d",
"/FMSInfo": "FMSInfo",
"/LiveWindow/PhotonVisionSystem": "Subsystem",
"/LiveWindow/Ungrouped/DigitalInput[0]": "Digital Input",
"/LiveWindow/Ungrouped/DigitalInput[1]": "Digital Input",
"/LiveWindow/Ungrouped/DigitalInput[2]": "Digital Input",
"/LiveWindow/Ungrouped/DigitalInput[3]": "Digital Input",
"/LiveWindow/Ungrouped/DigitalInput[4]": "Digital Input",
"/LiveWindow/Ungrouped/PIDController[10]": "PIDController",
"/LiveWindow/Ungrouped/PIDController[11]": "PIDController",
"/LiveWindow/Ungrouped/PIDController[12]": "PIDController",
"/LiveWindow/Ungrouped/PIDController[13]": "PIDController",
"/LiveWindow/Ungrouped/PIDController[14]": "PIDController",
"/LiveWindow/Ungrouped/PIDController[15]": "PIDController",
"/LiveWindow/Ungrouped/PIDController[16]": "PIDController",
"/LiveWindow/Ungrouped/PIDController[17]": "PIDController",
"/LiveWindow/Ungrouped/PIDController[1]": "PIDController",
"/LiveWindow/Ungrouped/PIDController[2]": "PIDController",
"/LiveWindow/Ungrouped/PIDController[3]": "PIDController",
Expand All @@ -29,9 +36,40 @@
"/LiveWindow/Ungrouped/PIDController[8]": "PIDController",
"/LiveWindow/Ungrouped/PIDController[9]": "PIDController",
"/LiveWindow/Ungrouped/navX-Sensor[4]": "Gyro",
"/SmartDashboard/AutoSelector": "String Chooser",
"/SmartDashboard/Auton Choice": "String Chooser",
"/SmartDashboard/Field": "Field2d",
"/SmartDashboard/Scheduler": "Scheduler"
"/SmartDashboard/Scheduler": "Scheduler",
"/SmartDashboard/VisionSystemSim-photonvision/Sim Field": "Field2d",
"/SmartDashboard/photonvision Sim Field": "Field2d"
}
},
"NetworkTables": {
"Persistent Values": {
"open": false
},
"transitory": {
"SmartDashboard": {
"Auton Choice": {
"open": true
},
"open": true
},
"northstar": {
"calibration": {
"open": true
},
"open": true
},
"photonvision": {
"camera1": {
"open": true
},
"open": true,
"photonvision": {
"open": true
}
}
}
}
}
35 changes: 34 additions & 1 deletion src/main/java/team3176/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

package team3176.robot;

import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;

import org.littletonrobotics.junction.LogFileUtil;
import org.littletonrobotics.junction.LoggedRobot;
import org.littletonrobotics.junction.Logger;
Expand All @@ -17,6 +21,7 @@
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import team3176.robot.Constants.RobotType;
import team3176.robot.subsystems.drivetrain.Drivetrain;
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.cscore.UsbCamera;

Expand Down Expand Up @@ -82,6 +87,7 @@ public void robotInit() {
case REPLAY:
String path = LogFileUtil.findReplayLog();
logger.setReplaySource(new WPILOGReader(path));
logger.addDataReceiver(new NT4Publisher());
logger.addDataReceiver(new WPILOGWriter(LogFileUtil.addPathSuffix(path, "_sim")));
break;
}
Expand All @@ -104,6 +110,32 @@ public void robotInit() {
fisheyeThread.start();
}

Map<String, Integer> commandCounts = new HashMap<>();
BiConsumer<Command, Boolean> logCommandFunction =
(Command command, Boolean active) -> {
String name = command.getName();
int count = commandCounts.getOrDefault(name, 0) + (active ? 1 : -1);
commandCounts.put(name, count);
Logger.getInstance()
.recordOutput(
"CommandsUnique/" + name + "_" + Integer.toHexString(command.hashCode()), active);
Logger.getInstance().recordOutput("CommandsAll/" + name, count > 0);
};
CommandScheduler.getInstance()
.onCommandInitialize(
(Command command) -> {
logCommandFunction.accept(command, true);
});
CommandScheduler.getInstance()
.onCommandFinish(
(Command command) -> {
logCommandFunction.accept(command, false);
});
CommandScheduler.getInstance()
.onCommandInterrupt(
(Command command) -> {
logCommandFunction.accept(command, false);
});

}

Expand Down Expand Up @@ -131,7 +163,8 @@ public void disabledInit() {

@Override
public void disabledPeriodic() {
//nan
robotContainer.checkAutonomousSelection();
robotContainer.checkAllaince();
}

/** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */
Expand Down
Loading