blob: 260a6ad28ddd781140bd071dee0f2f32951955b1 [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 Hendersonf136b052023-03-10 15:09:24 -080039Robot2023 = RobotType(width=0.6061, length=0.77581)
Tushar Pankaj62742732024-02-19 21:11:30 -080040Robot2024 = RobotType(width=0.85979, length=0.9906) # 33.85 in x 39.0 in
Ravago Jones5e09c072021-03-27 13:21:03 -070041
Ravago Jones5f787df2021-01-23 16:26:27 -080042FIELDS = {
43 "2019 Field":
Ravago Jones5127ccc2022-07-31 16:32:45 -070044 FieldType("2019 Field",
45 tags=[],
46 year=2019,
47 width=8.258302,
48 length=8.258302,
49 robot=Robot2019,
50 field_id="2019"),
Ravago Jones5f787df2021-01-23 16:26:27 -080051 "2020 Field":
Ravago Jones5127ccc2022-07-31 16:32:45 -070052 FieldType("2020 Field",
53 tags=[],
54 year=2020,
55 width=15.98295,
56 length=8.21055,
57 robot=Robot2020,
58 field_id="2020"),
Ravago Jones5f787df2021-01-23 16:26:27 -080059 "2021 Galactic Search BRed":
Ravago Jones5127ccc2022-07-31 16:32:45 -070060 FieldType("2021 Galactic Search BRed",
61 tags=[GALACTIC_SEARCH, BRED],
62 year=2021,
63 width=9.144,
64 length=4.572,
65 robot=Robot2021,
66 field_id="red_b"),
Ravago Jones5f787df2021-01-23 16:26:27 -080067 "2021 Galactic Search ARed":
Ravago Jones5127ccc2022-07-31 16:32:45 -070068 FieldType("2021 Galactic Search ARed",
69 tags=[GALACTIC_SEARCH, ARED],
70 year=2021,
71 width=9.144,
72 length=4.572,
73 robot=Robot2021,
74 field_id="red_a"),
Ravago Jones5f787df2021-01-23 16:26:27 -080075 "2021 Galactic Search BBlue":
Ravago Jones5127ccc2022-07-31 16:32:45 -070076 FieldType("2021 Galactic Search BBlue",
77 tags=[GALACTIC_SEARCH, BBLUE],
78 year=2021,
79 width=9.144,
80 length=4.572,
81 robot=Robot2021,
82 field_id="blue_b"),
Ravago Jones5f787df2021-01-23 16:26:27 -080083 "2021 Galactic Search ABlue":
Ravago Jones5127ccc2022-07-31 16:32:45 -070084 FieldType("2021 Galactic Search ABlue",
85 tags=[GALACTIC_SEARCH, ABLUE],
86 year=2021,
87 width=9.144,
88 length=4.572,
89 robot=Robot2021,
90 field_id="blue_a"),
Ravago Jones5f787df2021-01-23 16:26:27 -080091 "2021 AutoNav Barrel":
Ravago Jones5127ccc2022-07-31 16:32:45 -070092 FieldType("2021 AutoNav Barrel",
93 tags=[AUTONAV, BARREL],
94 year=2021,
95 width=9.144,
96 length=4.572,
97 robot=Robot2021,
98 field_id="autonav_barrel"),
Ravago Jones5f787df2021-01-23 16:26:27 -080099 "2021 AutoNav Slalom":
Ravago Jones5127ccc2022-07-31 16:32:45 -0700100 FieldType("2021 AutoNav Slalom",
101 tags=[AUTONAV, SLALOM],
102 year=2021,
103 width=9.144,
104 length=4.572,
105 robot=Robot2021,
106 field_id="autonav_slalom"),
Ravago Jones5f787df2021-01-23 16:26:27 -0800107 "2021 AutoNav Bounce":
Ravago Jones5127ccc2022-07-31 16:32:45 -0700108 FieldType("2021 AutoNav Bounce",
109 tags=[AUTONAV, BOUNCE],
110 year=2021,
111 width=9.144,
112 length=4.572,
113 robot=Robot2021,
114 field_id="autonav_bounce"),
Griffin Bui41a08f32022-02-26 16:20:29 -0800115 "2022 Field":
Ravago Jones5127ccc2022-07-31 16:32:45 -0700116 FieldType("2022 Field",
117 tags=[],
118 year=2022,
119 width=16.4592,
120 length=8.2296,
121 robot=Robot2022,
122 field_id="2022"),
Maxwell Henderson4a18b192023-03-10 15:04:04 -0800123 "2023 Field":
124 FieldType("2023 Field",
125 tags=[],
126 year=2023,
127 width=16.59255,
128 length=8.10895,
129 robot=Robot2023,
130 field_id="//third_party/y2023/field/2023.png"),
Nathan Leong5d690152024-01-10 21:10:10 -0800131 "2024 Field":
132 FieldType("2024 Field",
133 tags=[],
134 year=2024,
135 width=16.54175,
136 length=8.21055,
137 robot=Robot2024,
138 field_id="//third_party/y2024/field/2024.png"),
Ravago Jones5f787df2021-01-23 16:26:27 -0800139}
140
Nathan Leong5d690152024-01-10 21:10:10 -0800141FIELD = FIELDS["2024 Field"]
John Parkcf545162020-02-23 20:07:25 -0800142
James Kuszmaul1c933e02020-03-07 16:17:51 -0800143
Ravago Jones09f59722021-03-03 21:11:41 -0800144def get_json_folder(field):
145 if field.year == 2020 or field.year == 2021:
146 return "y2020/actors/splines"
Griffin Bui41a08f32022-02-26 16:20:29 -0800147 elif field.year == 2022:
148 return "y2022/actors/splines"
Maxwell Hendersonf136b052023-03-10 15:09:24 -0800149 elif field.year == 2023:
150 return "y2023/autonomous/splines"
Nathan Leong5d690152024-01-10 21:10:10 -0800151 #TODO: Update 2024 spline jsons
Ravago Jones09f59722021-03-03 21:11:41 -0800152 else:
153 return "frc971/control_loops/python/spline_jsons"
154
Ravago Jones5127ccc2022-07-31 16:32:45 -0700155
John Parkcf545162020-02-23 20:07:25 -0800156def inToM(i):
James Kuszmaul1c933e02020-03-07 16:17:51 -0800157 return (i * 0.0254)