Go to Post I personally think that everybody on the team is important. No matter what, every single student, mentor, teacher put their effort all year long to get the team going. So in my opinion, Credit goes to everyone. - Arefin Bari [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 30-07-2014, 01:22
drumtechjp drumtechjp is offline
Registered User
FRC #3015
 
Join Date: Jul 2014
Location: Spencerport, NY
Posts: 3
drumtechjp is an unknown quantity at this point
How to CALCULATE assist points

So, I realize this is well after the fact, but during the season, as we were developing a scouting database in excel, we were considering tracking each robot's individual assist locations per cycle, using a 3x3 grid as shown in the rules. A student had proposed that coding such a system would be VERY complex, given the myriad of possible outcomes. Due to circumstances of various symmetries, etc. I understand that this amount is pared significantly. Anyway, we decided on going a different route and didn't need it, but promised him that I would figure out a way to do so in the off season. I sat down last night and came up with a rather...... ugly bit of code in excel that will in fact calculate it correctly (included below), however, I was wondering if anyone else had done this, or had suggestions for a far more STREAMLINED approach.

The 3x3 grid occurs in the range C4:E6, and at the bottom of each column, as well as to the right of each row,there is a cell with a "counta" function pertaining to its respective adjacent column or row.

The code:
=IF(OR(AND(COUNTA(C4:E6)>5,(COUNTIF(C7:E7,">0")+CO UNTIF(F4:F6,">0")=6)),AND(COUNTIF(C7:E7,">0")+COUN TIF(F4:F6,">0")=6,(COUNTIF(C7:E7,"=3")+COUNTIF(F4: F6,"=3"))<>2,COUNTA(C4:E6)<>4)),30,IF(AND(COUNTIF( C7:E7,">0")+COUNTIF(F4:F6,">0")=6,COUNTA(C4:E6)=4, IFERROR(CELL("contents",INDIRECT(ADDRESS(MATCH(2,F 1:F6,0),MATCH(2,A7:E7,0)))),0)<>0),30,IF(AND(COUNT IF(C7:E7,">0")>1,COUNTIF(F4:F6,">0")>1),10,0)))


Basically, I began with scenarios to give 3 assists, then added elements to eliminate those which would incorrectly score 30 given the set parameters. I then proceeded to do the same with the 2 assist situations.

Any input would be greatly appreciated!

Last edited by drumtechjp : 30-07-2014 at 01:25.
  #2   Spotlight this post!  
Unread 30-07-2014, 01:23
drumtechjp drumtechjp is offline
Registered User
FRC #3015
 
Join Date: Jul 2014
Location: Spencerport, NY
Posts: 3
drumtechjp is an unknown quantity at this point
Re: How to CALCULATE assist points

and though I'm not sure what language the FMS is written in, if anyone has access to that methodology, that too would be interesting/ helpful!
  #3   Spotlight this post!  
Unread 30-07-2014, 01:25
SoftwareBug2.0's Avatar
SoftwareBug2.0 SoftwareBug2.0 is offline
Registered User
AKA: Eric
FRC #1425 (Error Code Xero)
Team Role: Mentor
 
Join Date: Aug 2004
Rookie Year: 2004
Location: Tigard, Oregon
Posts: 486
SoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant future
Re: How to CALCULATE assist points

Are you interested in general approaches or just better code in Excel?
  #4   Spotlight this post!  
Unread 30-07-2014, 01:29
SoftwareBug2.0's Avatar
SoftwareBug2.0 SoftwareBug2.0 is offline
Registered User
AKA: Eric
FRC #1425 (Error Code Xero)
Team Role: Mentor
 
Join Date: Aug 2004
Rookie Year: 2004
Location: Tigard, Oregon
Posts: 486
SoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant future
Re: How to CALCULATE assist points

Quote:
Originally Posted by drumtechjp View Post
and though I'm not sure what language the FMS is written in, if anyone has access to that methodology, that too would be interesting/ helpful!
I don't know how FMS did it, but here's one approach:

Code:
1) Make the power set of pairs of (robot,location with ball)
2) Filter for sets where all robots in the pairs are unique and all locations are unique
3) Find the max cardinality of the remaining sets.
  #5   Spotlight this post!  
Unread 30-07-2014, 03:10
timytamy's Avatar
timytamy timytamy is offline
Registered User
AKA: Tim
FRC #3132 (The Thunder Down Under)
Team Role: Electrical
 
Join Date: Nov 2009
Rookie Year: 2010
Location: Australia
Posts: 293
timytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant future
Re: How to CALCULATE assist points

You can abuse the fact that assists can be calculated on the diagonal of the grid, if you count the robot-zone combinations along a diagonal, you can find the number of assits for a given column arrangement. If you also swap the columns around, and take the max, you can find the total assists.

Here's a quick example in python:

Code:
#~/usr/bin/env python

import sys

def main ():
    if (len(sys.argv) < 1 + (3*3)):
        return

    grid = [[0,0,0], [0,0,0], [0,0,0]]
    for i in range(0, 3):
        for j in range(0, 3):
            grid[i][j] = int(sys.argv[1+(i*3)+j])

    print "The combination:"
    printgrid(grid)
    print "Has", calcAssists(grid), "assists"

def calcAssists (grid):
    asstCombs = [0]*(3*2*1) # 3! Combinations

    asstCombs[0] = calcDiagonal([grid[0], grid[1], grid[2]])
    asstCombs[1] = calcDiagonal([grid[0], grid[2], grid[1]])
    asstCombs[2] = calcDiagonal([grid[1], grid[0], grid[2]])
    asstCombs[3] = calcDiagonal([grid[1], grid[2], grid[0]])
    asstCombs[4] = calcDiagonal([grid[2], grid[0], grid[1]])
    asstCombs[5] = calcDiagonal([grid[2], grid[1], grid[0]])

    return max(asstCombs)

def calcDiagonal (grid):
    return (grid[0][0] + grid[1][1] + grid[2][2])

def printgrid (grid):
    for i in range(0, 3):
        print str(grid[i][0]), str(grid[i][1]), str(grid[i][2])

if __name__ == "__main__": main()
Hopefully you can adapt that to excel
__________________
Tim W
FIRST® Team 3132 - The Thunder Down Under
Sydney, Australia
Website | Facebook | Youtube

Last edited by timytamy : 30-07-2014 at 09:36.
  #6   Spotlight this post!  
Unread 05-08-2014, 23:15
drumtechjp drumtechjp is offline
Registered User
FRC #3015
 
Join Date: Jul 2014
Location: Spencerport, NY
Posts: 3
drumtechjp is an unknown quantity at this point
Re: How to CALCULATE assist points

Just curious, is there any way off actually obtaining/ accessing actual FMS source code? Also, is anyone reading this familiar with what language/ protocol it employs?
  #7   Spotlight this post!  
Unread 06-08-2014, 00:15
MrTechCenter's Avatar
MrTechCenter MrTechCenter is offline
INTENSITY
AKA: Harsharan "Harsh" Dhaliwal
FRC #2073 (Eagleforce)
Team Role: Mentor
 
Join Date: Sep 2011
Rookie Year: 2010
Location: Sacramento, CA
Posts: 559
MrTechCenter has a brilliant futureMrTechCenter has a brilliant futureMrTechCenter has a brilliant futureMrTechCenter has a brilliant futureMrTechCenter has a brilliant futureMrTechCenter has a brilliant futureMrTechCenter has a brilliant futureMrTechCenter has a brilliant futureMrTechCenter has a brilliant futureMrTechCenter has a brilliant futureMrTechCenter has a brilliant future
Re: How to CALCULATE assist points

Quote:
Originally Posted by drumtechjp View Post
Just curious, is there any way off actually obtaining/ accessing actual FMS source code? Also, is anyone reading this familiar with what language/ protocol it employs?
I think that this is something that everyone wishes was available to FRC team. Unfortunately, the source code has not been publicly released.
__________________
2011 Sacramento Regional Finalists; 2011 MadTown Throwdown VIP Excellence in Engineering Award; 2012 Sacramento Regional Innovation in Control Award; 2012 Silicon Valley Regional Judges' Award; 2012 CalGames Autonomous Challenge Award; 2012 MadTown Throwdown Finalists; 2013 P0W3RH0U53 PWNAGE Gracios Professionalism Award; 2014 Central Valley Regional Innovation in Control; 2014 Sacramento Regional Innovation in Control; 2014 Curie Division Gracious Professionalism Award; 2015 Sacramento Regional Innovation in Control
  #8   Spotlight this post!  
Unread 06-08-2014, 02:07
timytamy's Avatar
timytamy timytamy is offline
Registered User
AKA: Tim
FRC #3132 (The Thunder Down Under)
Team Role: Electrical
 
Join Date: Nov 2009
Rookie Year: 2010
Location: Australia
Posts: 293
timytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant future
Re: How to CALCULATE assist points

Quote:
Originally Posted by drumtechjp View Post
Just curious, is there any way off actually obtaining/ accessing actual FMS source code? Also, is anyone reading this familiar with what language/ protocol it employs?
There is a good write-up from 2009 here: http://www.chiefdelphi.com/media/papers/2266 however the main FMS-DS-Robot communication loop hasn't really changed so it's still relevant for at least the 2014 FMS.

However this only specifies robot control, AFAIK the scoring system in the main FMS is not accessible by teams over the network.
__________________
Tim W
FIRST® Team 3132 - The Thunder Down Under
Sydney, Australia
Website | Facebook | Youtube
  #9   Spotlight this post!  
Unread 06-08-2014, 09:45
Bryan Herbst's Avatar
Bryan Herbst Bryan Herbst is offline
Registered User
AKA: Bryan
FRC #2052 (KnightKrawler)
Team Role: Mentor
 
Join Date: Sep 2007
Rookie Year: 2007
Location: Minneapolis, Minnesota
Posts: 544
Bryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond repute
Re: How to CALCULATE assist points

Quote:
Originally Posted by drumtechjp View Post
Just curious, is there any way off actually obtaining/ accessing actual FMS source code? Also, is anyone reading this familiar with what language/ protocol it employs?
The FMS source is not available to anyone outside of FRC Engineering.

The FMS proper (i.e. the big server box) is written primarily in .NET (with an MVC front end). There are other pieces to the field electronics (such as the driver station boxes), but I'm not sure what those run.
__________________
Team 2052- Knightkrawler
Mentor and volunteer
  #10   Spotlight this post!  
Unread 06-08-2014, 11:05
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,748
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: How to CALCULATE assist points

Perhaps a better way of doing the calculation:

Quote:
=VLOOKUP(MIN(IF(COUNTA(C4:C6)>0,1,0)+IF(COUNTA(D4: D6)>0,1,0)+IF(COUNTA(E4:E6)>0,1,0), IF(COUNTA(C4:E4)>0,1,0)+IF(COUNTA(C5:E5)>0,1,0)+IF (COUNTA(C6:E6)>0,1,0)),G3:H6,2)
In this, I included the counta functions, although you could certainly utilize the ones to the side and bottom of the table you mentioned, which makes this equation even easier:

Quote:
=VLOOKUP(MIN(COUNTIF(C7:E7, ">0"), COUNTIF(F4:F6, ">0")),G3:H6,2)
Basically, we want to know how many rows and how many columns have something in them. From there, we could look at each possible combination exhaustively... but it's easier to look at the minimum of the two, as that will be the number of credited assists. Then I just created another table G3:H6 that has 0-4 in the first column and the corresponding scores in the second (0,0,10,30). Doing a vlookup on that second table lets me find the score that matches the number of assists performed and return it.

Note: Why doesn't excel have a function like Oracle's DECODE function in SQL? I so wanted to use that for this solution!

Edit: I just realized there's an edge case this doesn't handle correctly - two robots both poses in zone 1, then a third possesses in zones 2 and 3. Back to the drawing board!
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA

Last edited by Jon Stratis : 06-08-2014 at 11:14.
  #11   Spotlight this post!  
Unread 06-08-2014, 11:52
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,748
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: How to CALCULATE assist points

Ok, second try now that I had a few more free minutes...

Quote:
=VLOOKUP(MAX(COUNTA(C4,D5,E6), COUNTA(C4,E5,D6), COUNTA(D4,E5,C6), COUNTA(D4,C5,E6), COUNTA(E4,C5,D6), COUNTA(E4,D5,C6)),G3:H6,2)
Again, using the vlookup function to transition from number of assists to points. Here though, I'm simply doing a counta on each possible combination for 3 assists. By default, that also includes all possible combinations of 2 and 1 assists. By doing a max, we find the maximum possible assists that were counted.
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
  #12   Spotlight this post!  
Unread 06-08-2014, 11:57
AdamHeard's Avatar
AdamHeard AdamHeard is offline
Lead Mentor
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Atascadero
Posts: 5,505
AdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond repute
Send a message via AIM to AdamHeard
Re: How to CALCULATE assist points

Quote:
Originally Posted by Jon Stratis View Post
Ok, second try now that I had a few more free minutes...



Again, using the vlookup function to transition from number of assists to points. Here though, I'm simply doing a counta on each possible combination for 3 assists. By default, that also includes all possible combinations of 2 and 1 assists. By doing a max, we find the maximum possible assists that were counted.
Tangentially related. Index(match()) is much more efficient than vlookup, and a more robust way to link in case people insert collumns, etc... I find it more intuitive to setup as well.

The performance is far better. Not a huge issue for most excels, but a huge performance difference in google spreadsheets.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 15:05.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi