Skip to content

Commit a3f2bee

Browse files
committed
quick dirty
Signed-off-by: Dasun Abeykoon <[email protected]>
1 parent 38bc9d7 commit a3f2bee

File tree

8 files changed

+450
-8
lines changed

8 files changed

+450
-8
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: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+
"robotJoysticks": [
93+
{
94+
"guid": "Keyboard0"
95+
}
96+
]
97+
}

simgui-window.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"Docking": {
3+
"Data": [
4+
"DockNode ID=0x00000001 Pos=2512,50 Size=599,1808 Selected=0x19DC5F98"
5+
]
6+
},
7+
"MainWindow": {
8+
"GLOBAL": {
9+
"font": "Proggy Dotted",
10+
"fps": "120",
11+
"height": "1984",
12+
"maximized": "1",
13+
"style": "0",
14+
"userScale": "2",
15+
"width": "3840",
16+
"xpos": "0",
17+
"ypos": "56"
18+
}
19+
},
20+
"Window": {
21+
"###/SmartDashboard/Alerts": {
22+
"Collapsed": "0",
23+
"Pos": "479,53",
24+
"Size": "462,150"
25+
},
26+
"###/SmartDashboard/Elevator Visualizer": {
27+
"Collapsed": "0",
28+
"Pos": "661,127",
29+
"Size": "656,1586"
30+
},
31+
"###/SmartDashboard/GlobalVisualizer": {
32+
"Collapsed": "0",
33+
"DockId": "0x00000001,1",
34+
"Pos": "2512,50",
35+
"Size": "599,1808"
36+
},
37+
"###FMS": {
38+
"Collapsed": "0",
39+
"Pos": "12,1350",
40+
"Size": "368,364"
41+
},
42+
"###Joysticks": {
43+
"Collapsed": "0",
44+
"Pos": "627,1432",
45+
"Size": "1876,296"
46+
},
47+
"###NetworkTables": {
48+
"Collapsed": "0",
49+
"Pos": "634,692",
50+
"Size": "1875,655"
51+
},
52+
"###NetworkTables Info": {
53+
"Collapsed": "0",
54+
"Pos": "625,325",
55+
"Size": "1875,362"
56+
},
57+
"###Other Devices": {
58+
"Collapsed": "0",
59+
"DockId": "0x00000001,0",
60+
"Pos": "2512,50",
61+
"Size": "599,1808"
62+
},
63+
"###System Joysticks": {
64+
"Collapsed": "0",
65+
"Pos": "12,875",
66+
"Size": "435,434"
67+
},
68+
"###Timing": {
69+
"Collapsed": "0",
70+
"Pos": "2103,-161",
71+
"Size": "294,217"
72+
},
73+
"Debug##Default": {
74+
"Collapsed": "0",
75+
"Pos": "60,60",
76+
"Size": "400,400"
77+
},
78+
"Robot State": {
79+
"Collapsed": "0",
80+
"Pos": "39,70",
81+
"Size": "213,224"
82+
}
83+
}
84+
}

simgui.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"NTProvider": {
3+
"types": {
4+
"/FMSInfo": "FMSInfo",
5+
"/SmartDashboard/Alerts": "Alerts",
6+
"/SmartDashboard/Elevator Visualizer": "Mechanism2d",
7+
"/SmartDashboard/GlobalVisualizer": "Mechanism2d",
8+
"/SmartDashboard/ProfiledPIDController[1]": "ProfiledPIDController",
9+
"/SmartDashboard/ProfiledPIDController[2]": "ProfiledPIDController"
10+
},
11+
"windows": {
12+
"/SmartDashboard/Alerts": {
13+
"window": {
14+
"visible": true
15+
}
16+
},
17+
"/SmartDashboard/GlobalVisualizer": {
18+
"window": {
19+
"visible": true
20+
}
21+
}
22+
}
23+
},
24+
"NetworkTables": {
25+
"transitory": {
26+
"SmartDashboard": {
27+
"ProfiledPIDController[2]": {
28+
"open": true
29+
},
30+
"open": true
31+
},
32+
"Telemetry": {
33+
"elevator": {
34+
"Elevator Hardware Loggables": {
35+
"open": true
36+
},
37+
"open": true
38+
},
39+
"open": true
40+
}
41+
}
42+
},
43+
"NetworkTables Info": {
44+
"visible": true
45+
}
46+
}

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

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77
package org.frc6423.robot;
88

9+
import static edu.wpi.first.units.Units.Centimeters;
910
import static edu.wpi.first.units.Units.Seconds;
1011

1112
import edu.wpi.first.epilogue.Epilogue;
1213
import edu.wpi.first.epilogue.Logged;
14+
import edu.wpi.first.epilogue.Logged.Importance;
1315
import edu.wpi.first.epilogue.logging.LazyBackend;
1416
import edu.wpi.first.epilogue.logging.NTEpilogueBackend;
1517
import edu.wpi.first.epilogue.logging.errors.ErrorHandler;
@@ -25,6 +27,11 @@
2527
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
2628
import org.frc6423.lib.drivers.CommandRobot;
2729
import org.frc6423.robot.Constants.Flags;
30+
import org.frc6423.robot.subsystems.superstructure.Visualizer;
31+
import org.frc6423.robot.subsystems.superstructure.arm.Arm;
32+
import org.frc6423.robot.subsystems.superstructure.arm.Arm.ArmAngle;
33+
import org.frc6423.robot.subsystems.superstructure.elevator.Elevator;
34+
import org.frc6423.robot.subsystems.superstructure.elevator.Elevator.ElevatorExtension;
2835

2936
/**
3037
* Declares the structure of the robot program (subsystems, commands, triggers, etc.).
@@ -39,7 +46,12 @@ public class Robot extends CommandRobot {
3946
private final CommandXboxController operatorController = new CommandXboxController(1);
4047

4148
// * SUBSYSTEM INIT
42-
/** Init subsytems here */
49+
private final Visualizer visualizer = Visualizer.getInstance();
50+
51+
@Logged(importance = Importance.INFO)
52+
private final Elevator elevator = Elevator.create();
53+
54+
private final Arm arm = Arm.create();
4355

4456
// * ALERT INIT
4557
private final Alert batteryBrownout = new Alert("Battery voltage output low", AlertType.kWarning);
@@ -92,6 +104,15 @@ public Robot() {
92104
// Update drive dashboard periodically
93105
addPeriodic(this::updateDashboard, 0.02);
94106

107+
addPeriodic(
108+
() -> {
109+
/** Set visualizer poses */
110+
visualizer.setCarriageHeight(elevator.getCarriageHeight().in(Centimeters));
111+
visualizer.setStageHeight(elevator.getStageHeight().in(Centimeters));
112+
visualizer.setArmAngle(arm.getRotation2d());
113+
},
114+
0.02);
115+
95116
configureGameBehavior();
96117
configureBindings();
97118
}
@@ -111,10 +132,24 @@ private void updateDashboard() {
111132
}
112133

113134
/** Configure behavior during different match sections */
114-
private void configureGameBehavior() {}
135+
private void configureGameBehavior() {
136+
elevator.setDefaultCommand(elevator.runExtension(ElevatorExtension.STOWED));
137+
arm.setDefaultCommand(arm.runAngle(ArmAngle.STOWED));
138+
}
115139

116140
/** Configure all Driver & Operator controller bindings */
117-
private void configureBindings() {}
141+
private void configureBindings() {
142+
driverController
143+
.b()
144+
.whileTrue(
145+
elevator
146+
.runExtension(ElevatorExtension.INTAKING)
147+
.alongWith(arm.runAngle(ArmAngle.INTAKING)));
148+
driverController
149+
.a()
150+
.whileTrue(
151+
elevator.runExtension(ElevatorExtension.L4).alongWith(arm.runAngle(ArmAngle.L4)));
152+
}
118153

119154
@Override
120155
protected Command getAutonCommand() {

0 commit comments

Comments
 (0)