blob: e4ff6b72240bf1de0c0ca45997b1cc921855b29f [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)
Nathan Leong5d690152024-01-10 21:10:10 -080040#TODO (Nathan): Update 2024 robot dimensions when CAD is done
41Robot2024 = RobotType(width=0.9017, length=0.9525) # 35.5 in x 37.5 in
Ravago Jones5e09c072021-03-27 13:21:03 -070042
Ravago Jones5f787df2021-01-23 16:26:27 -080043FIELDS = {
44 "2019 Field":
Ravago Jones5127ccc2022-07-31 16:32:45 -070045 FieldType("2019 Field",
46 tags=[],
47 year=2019,
48 width=8.258302,
49 length=8.258302,
50 robot=Robot2019,
51 field_id="2019"),
Ravago Jones5f787df2021-01-23 16:26:27 -080052 "2020 Field":
Ravago Jones5127ccc2022-07-31 16:32:45 -070053 FieldType("2020 Field",
54 tags=[],
55 year=2020,
56 width=15.98295,
57 length=8.21055,
58 robot=Robot2020,
59 field_id="2020"),
Ravago Jones5f787df2021-01-23 16:26:27 -080060 "2021 Galactic Search BRed":
Ravago Jones5127ccc2022-07-31 16:32:45 -070061 FieldType("2021 Galactic Search BRed",
62 tags=[GALACTIC_SEARCH, BRED],
63 year=2021,
64 width=9.144,
65 length=4.572,
66 robot=Robot2021,
67 field_id="red_b"),
Ravago Jones5f787df2021-01-23 16:26:27 -080068 "2021 Galactic Search ARed":
Ravago Jones5127ccc2022-07-31 16:32:45 -070069 FieldType("2021 Galactic Search ARed",
70 tags=[GALACTIC_SEARCH, ARED],
71 year=2021,
72 width=9.144,
73 length=4.572,
74 robot=Robot2021,
75 field_id="red_a"),
Ravago Jones5f787df2021-01-23 16:26:27 -080076 "2021 Galactic Search BBlue":
Ravago Jones5127ccc2022-07-31 16:32:45 -070077 FieldType("2021 Galactic Search BBlue",
78 tags=[GALACTIC_SEARCH, BBLUE],
79 year=2021,
80 width=9.144,
81 length=4.572,
82 robot=Robot2021,
83 field_id="blue_b"),
Ravago Jones5f787df2021-01-23 16:26:27 -080084 "2021 Galactic Search ABlue":
Ravago Jones5127ccc2022-07-31 16:32:45 -070085 FieldType("2021 Galactic Search ABlue",
86 tags=[GALACTIC_SEARCH, ABLUE],
87 year=2021,
88 width=9.144,
89 length=4.572,
90 robot=Robot2021,
91 field_id="blue_a"),
Ravago Jones5f787df2021-01-23 16:26:27 -080092 "2021 AutoNav Barrel":
Ravago Jones5127ccc2022-07-31 16:32:45 -070093 FieldType("2021 AutoNav Barrel",
94 tags=[AUTONAV, BARREL],
95 year=2021,
96 width=9.144,
97 length=4.572,
98 robot=Robot2021,
99 field_id="autonav_barrel"),
Ravago Jones5f787df2021-01-23 16:26:27 -0800100 "2021 AutoNav Slalom":
Ravago Jones5127ccc2022-07-31 16:32:45 -0700101 FieldType("2021 AutoNav Slalom",
102 tags=[AUTONAV, SLALOM],
103 year=2021,
104 width=9.144,
105 length=4.572,
106 robot=Robot2021,
107 field_id="autonav_slalom"),
Ravago Jones5f787df2021-01-23 16:26:27 -0800108 "2021 AutoNav Bounce":
Ravago Jones5127ccc2022-07-31 16:32:45 -0700109 FieldType("2021 AutoNav Bounce",
110 tags=[AUTONAV, BOUNCE],
111 year=2021,
112 width=9.144,
113 length=4.572,
114 robot=Robot2021,
115 field_id="autonav_bounce"),
Griffin Bui41a08f32022-02-26 16:20:29 -0800116 "2022 Field":
Ravago Jones5127ccc2022-07-31 16:32:45 -0700117 FieldType("2022 Field",
118 tags=[],
119 year=2022,
120 width=16.4592,
121 length=8.2296,
122 robot=Robot2022,
123 field_id="2022"),
Maxwell Henderson4a18b192023-03-10 15:04:04 -0800124 "2023 Field":
125 FieldType("2023 Field",
126 tags=[],
127 year=2023,
128 width=16.59255,
129 length=8.10895,
130 robot=Robot2023,
131 field_id="//third_party/y2023/field/2023.png"),
Nathan Leong5d690152024-01-10 21:10:10 -0800132 "2024 Field":
133 FieldType("2024 Field",
134 tags=[],
135 year=2024,
136 width=16.54175,
137 length=8.21055,
138 robot=Robot2024,
139 field_id="//third_party/y2024/field/2024.png"),
Ravago Jones5f787df2021-01-23 16:26:27 -0800140}
141
Nathan Leong5d690152024-01-10 21:10:10 -0800142FIELD = FIELDS["2024 Field"]
John Parkcf545162020-02-23 20:07:25 -0800143
James Kuszmaul1c933e02020-03-07 16:17:51 -0800144
Ravago Jones09f59722021-03-03 21:11:41 -0800145def get_json_folder(field):
146 if field.year == 2020 or field.year == 2021:
147 return "y2020/actors/splines"
Griffin Bui41a08f32022-02-26 16:20:29 -0800148 elif field.year == 2022:
149 return "y2022/actors/splines"
Maxwell Hendersonf136b052023-03-10 15:09:24 -0800150 elif field.year == 2023:
151 return "y2023/autonomous/splines"
Nathan Leong5d690152024-01-10 21:10:10 -0800152 #TODO: Update 2024 spline jsons
Ravago Jones09f59722021-03-03 21:11:41 -0800153 else:
154 return "frc971/control_loops/python/spline_jsons"
155
Ravago Jones5127ccc2022-07-31 16:32:45 -0700156
John Parkcf545162020-02-23 20:07:25 -0800157def inToM(i):
James Kuszmaul1c933e02020-03-07 16:17:51 -0800158 return (i * 0.0254)