Happy new year everyone! This is the second blog post in a series on ZEBRA Dart Analysis. You can check out the first post here. This post will talk about splitting the field into useful “zones” and then grouping those zones logically. Doing this will provide us even more foundation for useful analysis in part 3.
One of the coolest visual representations of the capabilities of the ZEBRA Dart system comes in the form of heat maps. Here are some heatmaps from 2018, and below is a heatmap image from 2019:
As visual creatures, we can very quickly extract many useful insights from this picture using our knowledge of the 2019 game. For example, I can see from this that team 11 in this match likely started the match on either the red left level 2 platform or the far right edge of the level 1 platform, and ended the match on the opposite. I can tell that they played offense on the right side of the field for nearly the entire match. They primarily if not exclusively obtained game pieces from the right loading station. Most of their scoring occurred on the right rocket, with maybe one game piece scored on the left driver-station facing cargo ship hatch. It also seems like they spent more time on the opposing side of the rocket than the near side, this could be due to more attempts to score game pieces there, but it may also be at least partially due to the increased difficulty in scoring in that location relative to the near face due to visibility.
These are all great insights, but how can we get similar results analytically? The solution I have come up with is to first break the field into small bounded “zones” that each have unique meaning to us. Since zones have different meaning for red and blue robots, I have also designed “equivalent zones”, which are basically just a way to map the red side of the field to the blue side of the field. Finally, the similarities between multiple equivalent zones can be identified and used to create “zone groups”, which are broader areas that have their own meanings. These three concepts form the basis of this article. Zones and equivalent zones will remain largely static in season, so if you are getting bogged down in those sections, don’t worry, you can safely skip over them. Zone groups are the key thing I want to describe here, as I believe will be an extremely powerful tool that can be used for more detailed analysis, and will likely have use cases I can’t even foresee.
I will again be using my ZEBRA Data Parsing tool for this article, so feel free to play around with that and provide feedback to me as you see fit. I have also placed the output of that tool from Chezy Champs in a shared drive folder here. That file contains all of the data for this article.
For any robot position on the field, we would like to classify where it is. The raw position coordinates are great for things like speed analysis, but for a more intuitive description of where the robot is than coordinates, we need to get much larger. Enter zones, zones are meant to be the smallest discrete units of the field. Roughly speaking, I imagine them to be about the size of 1-4 robots. Zones should generally be not smaller than a single robot (because Dart placement and robot orientation would cause unhelpful variability for zones of this size), but also not so large that multiple different attributes of the field are unnecessarily rolled together. Using my guideline, I expect a field should be broken into approximately 50-200 zones, depending on the game. Here are the zones I sketched out for the 2019 game. The numbers inside of each zone represent a unique zone ID:
The zones are crudely drawn in the above image, so don’t look too closely at the areas between zones :). For 2020, I will elicit feedback on the zone definitions, but for 2019 I just took my best shot and am rolling with it. Most of the zones came together pretty easily. Just looking at the blue side of the field’s left side (relative to the blue drivers) I will describe my decisions:
Zones 4, 5, and 6 are the rocket scoring areas. These are the only zones I opted to use non-rectangular shapes for. 19, 20, 21, and 25 are the cargo ship scoring locations. It makes sense to have a unique zone for each scoring location even though they are pretty small. This is because at higher levels, you may be able to estimate precisely which location a robot is attempting to score, which can be synced up later with scouting data or detailed scoring breakdowns. The biggest decision for these zones was how far away from the hatch to extend them. I decided to make them one full robot length away from the hatch plus about a foot extra. This should be enough to comfortably tell that a robot is in the zone if they are touching the edge of the hatch or a few inches back, without considering robots just passing by to be in the zones.
Zones 15, 16, 22, and 23 all came together pretty clearly based on field dimensions. The reason zones 22 and 27 are separated is just so that we know if a robot is on the left or the right side of the field. We can easily combine these into a single “L3” zone group later, so don’t worry too much about the split. If these zones did not straddle an important field marking, they would be combined as they are too small alone. Similar reasoning can be used for zones 23 and 28.
Remaining Area Behind the HAB Line
Above those, we have zones 1, 2, 9, and 10. Zone 1 is 4 feet wide, which is the width of the loading station. Since the HAB Line is 8 feet from the wall, I made zone 1 also have a depth of 4 feet, splitting the 8 feet cleanly in half, and also aligning with the front edge of the depot, which is also at 4 feet from the wall. Zone 2 has the same width as zone 1 and covers the remaining area up to the HAB Line. Zones 9 and 10 I aligned with zones 1 and 2 for depth, which uses the front of the depot as a dividing line. I could have chosen to cut zone 9 in half so that one zone completely covered the depot and one covered the area between the depot and the loading station. I felt that, although the depot is a field marking, there isn’t much knowledge to be gained knowing if a robot is strictly inside of it or not. This is because there is no scoring or penalty value assigned to the “depot” in contrast to markings like the HAB Line. I could see an argument for zone 9 being two separate zones though.
Those are all of the obvious zones to me, and the rest are simply aisles and could be structured in many ways. Zones 8, 14, and 26 are very small zones between the center line and the cargo ship line as these are definite field markings that have penalty implications. Zone 7 fits comfortably between the rocket and the cargo ship line, and zone 13 is just the aisle directly in front of the cargo ship scoring locations. Zones 12 and 18 are just found by fitting in between the boundaries of adjacent zones. Zones 3, 11, 17, and 24 are the large zones directly in front of the HAB Line. These split in the y-direction simply by aligning them with adjacent zones that are already defined. One choice I made that could be questioned would be why these zones are so large. I think these zones could reasonably be split in twain by a line running about 4 feet in front of the HAB Line. If I had to redo this work, I likely would have done that, as those zones are a larger than the 4-robot guideline size I set out for myself. There’s no strictly right way to define zones, it’s a bit of an art, I’ll be sure to elicit feedback in 2020 for zone definitions to make them as effective as possible.
Some More Notes on Zones
For now, my data parser is restricted to zone definitions that are either triangles or convex quadrilaterals. It turns out that the general point-in-polygon problem is very interesting, and I’d encourage people to look into it if you like geometry. However, I have opted to only solve the above cases and not the general case for simplicity’s sake and computational time. I only saw the need for a few triangles and non-rectangles (near the rockets) this season, and I can’t really think of a need we would have had for more complicated zone shapes in prior years, so I feel comfortable with these limitations for now.
To see the exact dimensions of all of these zones, feel free to look in my workbook. I added a zone validation tool to catch some bad definitions, but it won’t catch everything. If you see that any of my zones are incorrectly defined, let me know as that would mess up any future analysis relying on them. In addition to dimensions, each zone has a zone ID and a name. Zone IDs must be unique, I use the convention of “Z###” for my zone IDs, where ### is a 1, 2, or 3 digit number. Names can be anything, but should generally describe what key attributes the zone has and where to find it on the field.
Alright, so we now can know based on a robot’s x and y coordinates which zone the robot is in. Unfortunately, that’s not enough information on it’s own to let us know what that zone means to the robot that’s in it, we also need to know which alliance the robot is on. For example, a blue robot in zone 1 above is likely loading a game piece, while a red robot in zone 1 is likely playing poor quality defense and is likely to draw a G13 foul. To account for this, we have equivalent zones. All these do is map red alliance zones to their counter-part zone on the blue alliance.
Equivalent zones have 6 attributes, I will go through each here:
Two attributes are for the affiliated red and blue alliance zones. If the field has rotational symmetry as it did for 2018 and 2019, zones on the blue side of the field on the left (relative to the blue drivers) should be paired with zones on the red side of the field on the left (relative to the red drivers), and similarly for zones to the right of the drivers. If the field has mirrored symmetry and not rotational symmetry, as in 2017, then the pairings will be different. In that case any zone on the blue side of the field that is near to the scoring table wall should be paired up with the similar zone on the red side of the field that near to the scoring table wall, and similarly for zones nearer to the audience wall.
There are two more attributes for equivalent zone IDs. These must also be unique. I follow the naming convention of “EZ###” for equivalent zone IDs, where ### is a 1, 2, or 3 digit number.
Finally, there are two different names given to each equivalent zone. One name for the zone that is on your own side of the field and one name for the zone that is on the opposing side of the field. In 2019, the red alliance essentially owned the entire half of the field near to the red alliance wall and the blue alliance essentially owned the entire half of the field near to the blue alliance wall. Due to this, I have named all of the near zones to an alliance’s drivers the “own side” zones and the far zones to the drivers the “opposing side” zones. This structure will not necessarily hold in future years though, as “ownership” of areas of the field varies with the game.
Now that we have red and blue straightened out, we can create heat-map like data from these equivalent zones. For each time-step, we can now identify which equivalent zone a robot is in. Summing over all time steps, we can identify what percentage of Chezy Champs each team was in each zone. Here are a couple of notable teams and the equivalent zones in which they spent the most time, starting with the hosts:
|Own Side Far Right HAB Line Aisle||5.97%|
|Own Side Right Loading||5.68%|
|Own Side Right Central Aisle||5.53%|
|Own Side Left Loading||4.65%|
|Own Side Right Rocket Port||4.65%|
|Own Side Far Left HAB Line Aisle||4.25%|
In the 7 matches for which we have good quality data, 254 spends a lot of time between the rockets and loading stations, as is expected. They likely spend so much time in the aisles between the HAB Line and Rocket because these are very large zones and that is the area where they likely see some of the most defense.
Next, we have 6443 in q28:
|Opposing Side Left Central Aisle||21.45%|
|Own Side Right L3 Platform Half||13.06%|
|Opposing Side Mid-Far Left HAB Line Aisle||12.13%|
|Opposing Side Far Left HAB Line Aisle||8.73%|
|Opposing Side Left Rocket DS Facing Hatch||6.00%|
6443 spends an astounding 21% of the time in their opponent’s left central aisle (zones 42 or 63 on the above zone image). They are clearly playing some heavy zone defense in this area, and reviewing the video, we find this to be indeed the case as they are defending 254 there for much of the match. Their next most popular zone is the right half of their own L3 platform, which is indeed where they sit for the last ~20 seconds of the match. Their remaining popular zones are all close by to that central aisle.
Finally, we have 1678 (10 match average):
|Own Side Far Left HAB Line Aisle||11.76%|
|Own Side Left Central Aisle||9.94%|
|Own Side Left Loading||7.76%|
|Own Side Left L3 Platform Half||6.32%|
|Own Side Left Rocket Center Facing Hatch||6.18%|
|Own Side Left Rocket Port||5.79%|
Their most common zones are all on their own left side, which means that they are very offensive, and that our sample of matches happens to skew to the ones where they are on the left side (they had 13 matches total at CC). Unlike 254, one of their top zones is the left half of the L3 platform, which probably means they more often went for a L3 climb or spent more time doing this climb than 254 did. You can see all equivalent zones for all teams in the linked drive sheet here.
Now that we can know which equivalent zone a robot is in, we can start expanding beyond single zones into zone groups. Zones and equivalent zones will generally remain fixed throughout the season, but zone groups can be easily created and changed for numerous types of data analysis. Essentially, zone groups are just a list of affiliated equivalent zones plus a name and an ID. Equivalent zones can be part of an unlimited number of zone groups, they need not be restricted to a single one. This allows us to do multi-dimensional analysis of zones. I have created 20 different zone groups to give you some idea of how they could be used, for qual 5, here is each team’s time percentage in each of my zone groups:
|On Center Line||0%||0%||0%||0%||0%||0%|
|Own Scoring Area||2%||15%||15%||33%||3%||21%|
|Opposing Scoring Area||5%||0%||0%||0%||0%||2%|
|Own Loading Area||2%||15%||15%||12%||1%||11%|
|Own Cargo Ship Scoring Area||0%||1%||1%||7%||0%||0%|
|Own Rocket Scoring Area||2%||14%||14%||26%||3%||21%|
|Opposing Rocket Scoring Area||2%||0%||0%||0%||0%||2%|
|Own HAB Platform||18%||24%||8%||5%||4%||14%|
|Behind own HAB Line||31%||44%||33%||27%||7%||39%|
|Behind opponent HAB Line||13%||0%||0%||0%||0%||0%|
|Own Non-Scoring Areas||37%||82%||85%||65%||97%||72%|
|Opposing Non-Scoring Areas||56%||0%||0%||0%||0%||5%|
|In front of own HAB Line||8%||53%||67%||72%||93%||54%|
This tells us much more clearly in which areas all of these robots spend their time.
1671 is the only dedicated defender in the match, spending well over half their time on the opposing side of the field. They spend the bulk of this 61% defense in the opponent non-scoring areas (56%). Noteworthy is that they spend 13% of the time behind the opponent’s HAB Line, which is not a great place to be as it puts them at high risk of G13 Fouls.
5199 unfortunately tips early in the match, which causes them to spend 90% of the time in the aisles, and 93% of the time in front of their own HAB Line since they can’t return for a climb. These numbers are far higher than any other team in this match.
5700 and 5940 are both red’s dedicated scorers, and they each stay nearly exclusively on the left and right sides of the field respectively. 5700 goes for a climb about 10 seconds earlier than 5940, causing their times behind the HAB Line and on the HAB Platform to be higher than 5940’s. Other than those differences, these teams would have very similar heat maps.
On the blue side, 973 plays exclusively on the left side while 2557 spends a solid majority on the right, but occasionally ventures left. 2557 also jumps onto defense for a few seconds right before 5199 tips. 973 spends 33% of their time in scoring locations compared to 11% in loading locations, this is the highest such ratio of any team in the match, and seems to indicate that loading is much faster/easier for 973 than scoring (unsurprising since 1671 blocks most of their scoring efforts but can’t really block their loading efforts). 973 is also the only team to spend a noticeable amount of time in their Cargo Ship scoring locations, in reviewing the video, this seems to be more due to defense by 1671 than spending much time scoring on the cargo ship. 973 does score one hatch on the cargo ship, but it is very quick.
Like I have said, zones and equivalent zones will be largely unchanging, but zone groups are much easier to add and edit. Feel free to define your own zone groups and analyze the results using my data parser.
In order to best analyze what a robot is doing on the field, we need to break the field into distinct units called zones. Zones will have different meanings depending on the robot’s color, so we use equivalent zones to better distinguish what meaning the zone has to the robot. Finally, we can aggregate similar equivalent zones into larger zone groups, which can tell us broadly what a robot is likely doing. Equivalent zones can be added to multiple different zone groups, allowing for multi-dimensional analysis.
Well, that’s it for part 2. Everything so far has been leading up to the final chapter in part 3. We have been laying the groundwork for what I think will be the coolest uses of the ZEBRA Data. With zone groups, we should be able to identify fun things such as autonomous routes, penalties, and types of defense.
Have a great kickoff!