Skip to content

Commit 9b90f94

Browse files
committed
Added in IndexStatus, its layout and its NT connections
Added in new field image for AL and cleaned up overall look of AL Added Cargo Position tracking to AL and finished the NT behind it Added in Auto Selections to AL and binded it to the DriveTime Auto Selections
1 parent b208388 commit 9b90f94

11 files changed

+196
-31
lines changed

Blue_Cargo.png

170 KB
Loading

CommandoDash.csproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11+
<None Remove="Blue_Cargo.png" />
1112
<None Remove="close.png" />
1213
<None Remove="CommandoLogov1.png" />
1314
<None Remove="CommandoLogov1_preview_rev_1.png" />
1415
<None Remove="favicon-16x16.png" />
1516
<None Remove="favicon-32x32.png" />
17+
<None Remove="FRC 2022 Offical Field.png" />
1618
<None Remove="FRC 2022 PathPlanner Field - Ideal.png" />
1719
<None Remove="FRC 2022 PathPlanner Field.png" />
1820
<None Remove="FRC 2022 PathPlanner Half-Field - Ideal.png" />
@@ -23,12 +25,16 @@
2325
<None Remove="Images\5889-Index-Robot-PNG %283%29.png" />
2426
<None Remove="Images\5889-Index-Robot-PNG.png" />
2527
<None Remove="Images\5889-Index-Robot.png" />
28+
<None Remove="Images\Blue_Cargo.png" />
29+
<None Remove="Images\FRC 2022 Offical Field.png" />
2630
<None Remove="Images\FRC 2022 PathPlanner Field.png" />
2731
<None Remove="Images\FRC 2022 PathPlanner Half-Field - Ideal.png" />
2832
<None Remove="Images\Logo_Square_WhiteBackground_CommandoRobotics.png" />
33+
<None Remove="Images\Red_Cargo.png" />
2934
<None Remove="Images\refresh_icon.png" />
3035
<None Remove="Logo_Square_DarkBackground_CommandoRobotics.png" />
3136
<None Remove="Logo_Square_WhiteBackground_CommandoRobotics.png" />
37+
<None Remove="Red_Cargo.png" />
3238
<None Remove="refresh_icon.png" />
3339
<None Remove="restore-down.png" />
3440
<None Remove="subtract.png" />
@@ -45,11 +51,13 @@
4551
</ItemGroup>
4652

4753
<ItemGroup>
54+
<Resource Include="Blue_Cargo.png" />
4855
<Resource Include="close.png" />
4956
<Resource Include="CommandoLogov1.png" />
5057
<Resource Include="CommandoLogov1_preview_rev_1.png" />
5158
<Resource Include="favicon-16x16.png" />
5259
<Resource Include="favicon-32x32.png" />
60+
<Resource Include="FRC 2022 Offical Field.png" />
5361
<Resource Include="FRC 2022 PathPlanner Field - Ideal.png" />
5462
<Resource Include="FRC 2022 PathPlanner Field.png" />
5563
<Resource Include="FRC 2022 PathPlanner Half-Field - Ideal.png" />
@@ -68,6 +76,12 @@
6876
<Content Include="Images\5889-Index-Robot.png">
6977
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
7078
</Content>
79+
<Content Include="Images\Blue_Cargo.png">
80+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
81+
</Content>
82+
<Content Include="Images\FRC 2022 Offical Field.png">
83+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
84+
</Content>
7185
<Content Include="Images\FRC 2022 PathPlanner Field.png">
7286
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
7387
</Content>
@@ -77,11 +91,15 @@
7791
<Content Include="Images\Logo_Square_WhiteBackground_CommandoRobotics.png">
7892
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
7993
</Content>
94+
<Content Include="Images\Red_Cargo.png">
95+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
96+
</Content>
8097
<Content Include="Images\refresh_icon.png">
8198
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8299
</Content>
83100
<Resource Include="Logo_Square_DarkBackground_CommandoRobotics.png" />
84101
<Resource Include="Logo_Square_WhiteBackground_CommandoRobotics.png" />
102+
<Resource Include="Red_Cargo.png" />
85103
<Resource Include="refresh_icon.png" />
86104
<Resource Include="restore-down.png" />
87105
<Resource Include="subtract.png" />

FRC 2022 Offical Field.png

402 KB
Loading

FRC 2022 PathPlanner Field.png

0 Bytes
Loading

Images/Blue_Cargo.png

170 KB
Loading

Images/FRC 2022 Offical Field.png

402 KB
Loading
0 Bytes
Loading

Images/Red_Cargo.png

150 KB
Loading

MainWindow.xaml

Lines changed: 88 additions & 31 deletions
Large diffs are not rendered by default.

MainWindow.xaml.cs

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,22 @@ public MainWindow()
127127
AddSimpleEntryListener(CommandoDashNT.GetSubTable("SensorData").GetEntry("isCentric"), new Action(() =>
128128
IsCentricSB.IsActive = CommandoDashNT.GetSubTable("SensorData").GetEntry("isCentric").GetBoolean(true)));
129129

130+
//Update Index Spot 1
131+
AddSimpleEntryListener(CommandoDashNT.GetSubTable("SensorData").GetEntry("indexSpot1HasCargo"), new Action(() => updateIndexSpot1()));
132+
133+
//Update Index Spot 2
134+
AddSimpleEntryListener(CommandoDashNT.GetSubTable("SensorData").GetEntry("indexSpot2HasCargo"), new Action(() => updateIndexSpot2()));
135+
136+
//Update Intake Spot
137+
AddSimpleEntryListener(CommandoDashNT.GetSubTable("SensorData").GetEntry("intakeSpotHasCargo"), new Action(() => updateIntakeSpot()));
138+
130139
//AutoLayouts
140+
141+
//Update Robot Field2d position
131142
AddSimpleEntryListener(ntInst.GetTable("SmartDashboard").GetSubTable("Field").GetEntry("Robot"), new Action(() => updateRobotPosition()));
132143

144+
//Update Cargo Field2d position
145+
AddSimpleEntryListener(ntInst.GetTable("SmartDashboard").GetSubTable("Field").GetEntry("SeenCargo"), new Action(() => updateCargoPosition()));
133146
}
134147

135148
public void defaultStates()
@@ -252,6 +265,18 @@ private void alliance_Update()
252265
HoundSeesTargetSB.ActiveBrush = (Brush) this.Resources["HoundRedHounding"];
253266
HoundSeesTargetSB.InactiveBrush = (Brush) this.Resources["HoundRedDefault"];
254267
HoundSeesTargetSB.BorderBrush = (Brush)this.Resources["HoundRedBorder"];
268+
269+
FieldCargo.ImageSource = new BitmapImage(new Uri("Images/Red_Cargo.png", UriKind.Relative));
270+
FieldImageScale.ScaleX = -1;
271+
FieldImageScale.ScaleY = 1;
272+
273+
IndexCargo1Image.Source = new BitmapImage(new Uri("Images/Red_Cargo.png", UriKind.Relative));
274+
IndexCargo2Image.Source = new BitmapImage(new Uri("Images/Red_Cargo.png", UriKind.Relative));
275+
IntakeCargoImage.Source = new BitmapImage(new Uri("Images/Red_Cargo.png", UriKind.Relative));
276+
277+
IndexSpot1SB.ActiveBrush = (Brush)this.Resources["IndexRedEnabled"];
278+
IndexSpot2SB.ActiveBrush = (Brush)this.Resources["IndexRedEnabled"];
279+
IntakeSpotSB.ActiveBrush = (Brush)this.Resources["IndexRedEnabled"];
255280
} else
256281
{
257282
HoundHoundingTargetSB.ActiveBrush = (Brush)this.Resources["HoundBlueHounding"];
@@ -260,6 +285,18 @@ private void alliance_Update()
260285
HoundSeesTargetSB.ActiveBrush = (Brush)this.Resources["HoundBlueHounding"];
261286
HoundSeesTargetSB.InactiveBrush = (Brush)this.Resources["HoundBlueDefault"];
262287
HoundSeesTargetSB.BorderBrush = (Brush)this.Resources["HoundBlueBorder"];
288+
289+
FieldCargo.ImageSource = new BitmapImage(new Uri("Images/Blue_Cargo.png", UriKind.Relative));
290+
FieldImageScale.ScaleX = 1;
291+
FieldImageScale.ScaleY = -1;
292+
293+
IndexCargo1Image.Source = new BitmapImage(new Uri("Images/Blue_Cargo.png", UriKind.Relative));
294+
IndexCargo2Image.Source = new BitmapImage(new Uri("Images/Blue_Cargo.png", UriKind.Relative));
295+
IntakeCargoImage.Source = new BitmapImage(new Uri("Images/Blue_Cargo.png", UriKind.Relative));
296+
297+
IndexSpot1SB.ActiveBrush = (Brush)this.Resources["IndexBlueEnabled"];
298+
IndexSpot2SB.ActiveBrush = (Brush)this.Resources["IndexBlueEnabled"];
299+
IntakeSpotSB.ActiveBrush = (Brush)this.Resources["IndexBlueEnabled"];
263300
}
264301

265302
}
@@ -343,7 +380,60 @@ private void updateRobotPosition()
343380
RobotXText.Text = Math.Round(robotXMeters,4).ToString() + "m";
344381
RobotYText.Text = Math.Round(robotYMeters,4).ToString() + "m";
345382
RobotRText.Text = Math.Round(robotRDegrees,4).ToString() + "°";
383+
}
384+
385+
private void updateCargoPosition()
386+
{
387+
Thickness cargoMargin = CargoRectangle.Margin;
388+
double cargoXMeters = ntInst.GetTable("SmartDashboard").GetSubTable("Field").GetEntry("SeenCargo").GetDoubleArray(new double[3] { 0, 0, 0 })[0];
389+
double cargoYMeters = ntInst.GetTable("SmartDashboard").GetSubTable("Field").GetEntry("SeenCargo").GetDoubleArray(new double[3] { 0, 0, 0 })[1];
390+
cargoMargin.Left = (cargoXMeters * (Field.Width / 16.4592)) - 15;
391+
cargoMargin.Top = (cargoYMeters * (Field.Height / 8.2296)) - 15;
392+
CargoRectangle.Margin = cargoMargin;
393+
394+
CargoXText.Text = Math.Round(cargoXMeters, 4).ToString() + "m";
395+
CargoYText.Text = Math.Round(cargoYMeters, 4).ToString() + "m";
396+
}
397+
398+
private void updateIndexSpot1()
399+
{
400+
Boolean spotHasCargo = CommandoDashNT.GetSubTable("SensorData").GetEntry("indexSpot1HasCargo").GetBoolean(false);
401+
if (spotHasCargo)
402+
{
403+
IndexCargo1Image.Visibility = Visibility.Visible;
404+
} else
405+
{
406+
IndexCargo1Image.Visibility = Visibility.Hidden;
407+
}
408+
IndexSpot1SB.IsActive = spotHasCargo;
409+
}
410+
411+
private void updateIndexSpot2()
412+
{
413+
Boolean spotHasCargo = CommandoDashNT.GetSubTable("SensorData").GetEntry("indexSpot2HasCargo").GetBoolean(false);
414+
if (spotHasCargo)
415+
{
416+
IndexCargo2Image.Visibility = Visibility.Visible;
417+
}
418+
else
419+
{
420+
IndexCargo2Image.Visibility = Visibility.Hidden;
421+
}
422+
IndexSpot2SB.IsActive = spotHasCargo;
423+
}
346424

425+
private void updateIntakeSpot()
426+
{
427+
Boolean spotHasCargo = CommandoDashNT.GetSubTable("SensorData").GetEntry("intakeSpotHasCargo").GetBoolean(false);
428+
if (spotHasCargo)
429+
{
430+
IntakeCargoImage.Visibility = Visibility.Visible;
431+
}
432+
else
433+
{
434+
IntakeCargoImage.Visibility = Visibility.Hidden;
435+
}
436+
IntakeSpotSB.IsActive = spotHasCargo;
347437
}
348438

349439

0 commit comments

Comments
 (0)