blob: 3a61b5efdfcd42924a716fac69a41857cd3e1371 [file] [log] [blame]
Het Satasiya9633d4b2020-08-16 15:31:17 -07001from gi.repository import Gtk
Ravago Jones5f787df2021-01-23 16:26:27 -08002from collections import namedtuple
John Park91e69732019-03-03 13:12:43 -08003
Het Satasiya9633d4b2020-08-16 15:31:17 -07004window = Gtk.Window()
5screen = window.get_screen()
6
7#Set screen size for rest of program.
Austin Schuhb2d77af2021-03-31 20:07:21 -07008SCREEN_SIZE = screen.get_height() / 1.5
John Park91e69732019-03-03 13:12:43 -08009
Het Satasiya9633d4b2020-08-16 15:31:17 -070010# Placeholder value
11ROBOT_SIDE_TO_BALL_CENTER = 0.15
John Park91e69732019-03-03 13:12:43 -080012BALL_RADIUS = 0.165
Het Satasiya9633d4b2020-08-16 15:31:17 -070013
14# Placeholder value
15ROBOT_SIDE_TO_HATCH_PANEL = 0.1
John Park91e69732019-03-03 13:12:43 -080016HATCH_PANEL_WIDTH = 0.4826
17
Maxwell Henderson4a18b192023-03-10 15:04:04 -080018# field_id is either just a file prefix for a .png in field_images/ or is a
19# full path preceded by // specifying a location relative to the root of the
20# repository.
Ravago Jones5f787df2021-01-23 16:26:27 -080021FieldType = namedtuple(
Ravago Jonesc26b9162021-06-30 20:12:48 -070022 'Field', ['name', 'tags', 'year', 'width', 'length', 'robot', 'field_id'])
Ravago Jones5127ccc2022-07-31 16:32:45 -070023RobotType = namedtuple("Robot", ['width', 'length'])
John Parkcf545162020-02-23 20:07:25 -080024
Ravago Jones5f787df2021-01-23 16:26:27 -080025GALACTIC_SEARCH = "Galactic Search"
26ARED = "A Red"
27BRED = "B Red"
28ABLUE = "A Blue"
29BBLUE = "B Blue"
30AUTONAV = "AutoNav"
31BOUNCE = "Bounce"
32SLALOM = "Slalom"
33BARREL = "Barrel"
34
Ravago Jones5e09c072021-03-27 13:21:03 -070035Robot2019 = RobotType(width=0.65, length=0.8)
Ravago Jones5127ccc2022-07-31 16:32:45 -070036Robot2020 = RobotType(width=0.8128, length=0.8636) # 32 in x 34 in
Ravago Jones5e09c072021-03-27 13:21:03 -070037Robot2021 = Robot2020
Henry Speiserb0703aa2022-03-14 22:19:40 -070038Robot2022 = RobotType(width=0.8763, length=0.96647)
Maxwell Henderson4a18b192023-03-10 15:04:04 -080039Robot2023 = RobotType(width=0.8763, length=0.96647)
Ravago Jones5e09c072021-03-27 13:21:03 -070040
Ravago Jones5f787df2021-01-23 16:26:27 -080041FIELDS = {
42 "2019 Field":
Ravago Jones5127ccc2022-07-31 16:32:45 -070043 FieldType("2019 Field",
44 tags=[],
45 year=2019,
46 width=8.258302,
47 length=8.258302,
48 robot=Robot2019,
49 field_id="2019"),
Ravago Jones5f787df2021-01-23 16:26:27 -080050 "2020 Field":
Ravago Jones5127ccc2022-07-31 16:32:45 -070051 FieldType("2020 Field",
52 tags=[],
53 year=2020,
54 width=15.98295,
55 length=8.21055,
56 robot=Robot2020,
57 field_id="2020"),
Ravago Jones5f787df2021-01-23 16:26:27 -080058 "2021 Galactic Search BRed":
Ravago Jones5127ccc2022-07-31 16:32:45 -070059 FieldType("2021 Galactic Search BRed",
60 tags=[GALACTIC_SEARCH, BRED],
61 year=2021,
62 width=9.144,
63 length=4.572,
64 robot=Robot2021,
65 field_id="red_b"),
Ravago Jones5f787df2021-01-23 16:26:27 -080066 "2021 Galactic Search ARed":
Ravago Jones5127ccc2022-07-31 16:32:45 -070067 FieldType("2021 Galactic Search ARed",
68 tags=[GALACTIC_SEARCH, ARED],
69 year=2021,
70 width=9.144,
71 length=4.572,
72 robot=Robot2021,
73 field_id="red_a"),
Ravago Jones5f787df2021-01-23 16:26:27 -080074 "2021 Galactic Search BBlue":
Ravago Jones5127ccc2022-07-31 16:32:45 -070075 FieldType("2021 Galactic Search BBlue",
76 tags=[GALACTIC_SEARCH, BBLUE],
77 year=2021,
78 width=9.144,
79 length=4.572,
80 robot=Robot2021,
81 field_id="blue_b"),
Ravago Jones5f787df2021-01-23 16:26:27 -080082 "2021 Galactic Search ABlue":
Ravago Jones5127ccc2022-07-31 16:32:45 -070083 FieldType("2021 Galactic Search ABlue",
84 tags=[GALACTIC_SEARCH, ABLUE],
85 year=2021,
86 width=9.144,
87 length=4.572,
88 robot=Robot2021,
89 field_id="blue_a"),
Ravago Jones5f787df2021-01-23 16:26:27 -080090 "2021 AutoNav Barrel":
Ravago Jones5127ccc2022-07-31 16:32:45 -070091 FieldType("2021 AutoNav Barrel",
92 tags=[AUTONAV, BARREL],
93 year=2021,
94 width=9.144,
95 length=4.572,
96 robot=Robot2021,
97 field_id="autonav_barrel"),
Ravago Jones5f787df2021-01-23 16:26:27 -080098 "2021 AutoNav Slalom":
Ravago Jones5127ccc2022-07-31 16:32:45 -070099 FieldType("2021 AutoNav Slalom",
100 tags=[AUTONAV, SLALOM],
101 year=2021,
102 width=9.144,
103 length=4.572,
104 robot=Robot2021,
105 field_id="autonav_slalom"),
Ravago Jones5f787df2021-01-23 16:26:27 -0800106 "2021 AutoNav Bounce":
Ravago Jones5127ccc2022-07-31 16:32:45 -0700107 FieldType("2021 AutoNav Bounce",
108 tags=[AUTONAV, BOUNCE],
109 year=2021,
110 width=9.144,
111 length=4.572,
112 robot=Robot2021,
113 field_id="autonav_bounce"),
Griffin Bui41a08f32022-02-26 16:20:29 -0800114 "2022 Field":
Ravago Jones5127ccc2022-07-31 16:32:45 -0700115 FieldType("2022 Field",
116 tags=[],
117 year=2022,
118 width=16.4592,
119 length=8.2296,
120 robot=Robot2022,
121 field_id="2022"),
Maxwell Henderson4a18b192023-03-10 15:04:04 -0800122 "2023 Field":
123 FieldType("2023 Field",
124 tags=[],
125 year=2023,
126 width=16.59255,
127 length=8.10895,
128 robot=Robot2023,
129 field_id="//third_party/y2023/field/2023.png"),
Ravago Jones5f787df2021-01-23 16:26:27 -0800130}
131
Maxwell Henderson4a18b192023-03-10 15:04:04 -0800132FIELD = FIELDS["2023 Field"]
John Parkcf545162020-02-23 20:07:25 -0800133
James Kuszmaul1c933e02020-03-07 16:17:51 -0800134
Ravago Jones09f59722021-03-03 21:11:41 -0800135def get_json_folder(field):
136 if field.year == 2020 or field.year == 2021:
137 return "y2020/actors/splines"
Griffin Bui41a08f32022-02-26 16:20:29 -0800138 elif field.year == 2022:
139 return "y2022/actors/splines"
Ravago Jones09f59722021-03-03 21:11:41 -0800140 else:
141 return "frc971/control_loops/python/spline_jsons"
142
Ravago Jones5127ccc2022-07-31 16:32:45 -0700143
John Parkcf545162020-02-23 20:07:25 -0800144def inToM(i):
James Kuszmaul1c933e02020-03-07 16:17:51 -0800145 return (i * 0.0254)