Go to Post FIRST is aimed at those girls on your team. They don't know anything about mechanics, or electricity, or programming, or machining. They have no interest in it, either. They're perfect candidates for FIRST. - Madison [more]
Home
Go Back   Chief Delphi > Technical > Programming
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 19-01-2014, 22:38
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Keeping Track of Assists

Hello everyone,
I am currently working on a web app to mimic the alliance station possession and assist monitor for practice. I am having trouble thinking of a way to keep track of assists. As I have it now, most scenarios shown in this video work as they should, however some don't.
This is my current method for keeping track:


Code:
            if(robotNum == 'robot1' && zone == 'red' && !redZone && !rOneAssist) {
                $('#' + robotNum).children('.' + zone).addClass('assist');
                redZone = true;
                rOneAssist = true;
            }
            else if(robotNum == 'robot1' && zone == 'white' && !whiteZone && !rOneAssist) {
                $('#' + robotNum).children('.' + zone).addClass('assist');
                whiteZone = true;
                rOneAssist = true;
            }
            else if(robotNum == 'robot1' && zone == 'blue' && !blueZone && !rOneAssist) {
                $('#' + robotNum).children('.' + zone).addClass('assist');
                blueZone = true;
                rOneAssist = true;
            }
            else if(robotNum == 'robot2' && zone == 'blue' && !blueZone && !rTwoAssist) {
                $('#' + robotNum).children('.' + zone).addClass('assist');
                blueZone = true;
                rTwoAssist = true;
            }
            else if(robotNum == 'robot2' && zone == 'white' && !whiteZone && !rTwoAssist) {
                $('#' + robotNum).children('.' + zone).addClass('assist');
                whiteZone = true;
                rTwoAssist = true;
            }
            else if(robotNum == 'robot2' && zone == 'red' && !redZone && !rTwoAssist) {
                $('#' + robotNum).children('.' + zone).addClass('assist');
                redZone = true;
                rTwoAssist = true;
            }
            else if(robotNum == 'robot3' && zone == 'blue' && !blueZone && !rThreeAssist) {
                $('#' + robotNum).children('.' + zone).addClass('assist');
                blueZone = true;
                rThreeAssist = true;
            }
            else if(robotNum == 'robot3' && zone == 'white' && !whiteZone && !rThreeAssist) {
                $('#' + robotNum).children('.' + zone).addClass('assist');
                whiteZone = true;
                rThreeAssist = true;
            }
            else if(robotNum == 'robot3' && zone == 'red' && !redZone && !rThreeAssist) {
                $('#' + robotNum).children('.' + zone).addClass('assist');
                redZone = true;
                rThreeAssist = true;
            }
Basically, the way it works is whenever the possession of the ball changes, it checks if that zone has already had an assist, and if that robot has had an assist. The problem comes from the example at 3:10 of the video, when the awarded possession changes robots. Does anybody have a better formula for doing this?
Assists are a very confusing part of the game, which is one of the reasons why this is difficult for me to wrap my head around.
  #2   Spotlight this post!  
Unread 20-01-2014, 00:05
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: 487
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: Keeping Track of Assists

How about this:

1) Make a list of all pairs of all robot/zone combinations
2) Make all permutations of these items that are length 3 or less
3) Remove anything that uses the same robot or the same zone more than once
4) Output the max length of anything that's left
  #3   Spotlight this post!  
Unread 20-01-2014, 00:44
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Re: Keeping Track of Assists

Few questions:
1) Does the list contain only the combinations since the start of the cycle, or all possible combinations(9)?
2) Could you explain how I would then permute that list?
3) How would I use the max length to determine which robot gets the assist?

Thanks for your help!
  #4   Spotlight this post!  
Unread 20-01-2014, 00:50
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: 487
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: Keeping Track of Assists

To make the method that I mentioned more concrete, here's a C++ implementation. Note that it hasn't been optimized at all and uses C++11 features.
Attached Files
File Type: cpp assist.cpp (1.5 KB, 18 views)
  #5   Spotlight this post!  
Unread 20-01-2014, 02:05
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: 487
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: Keeping Track of Assists

Quote:
Originally Posted by ggorsuch View Post
How would I use the max length to determine which robot gets the assist?
The rules don't create an unambigous way to assign assists to robots. They just say what the allowed combinations are and that you choose the one that gives the most points.

For example, if both robot A and robot B each hold the ball but each only holds it in the white zone who should get the credit? It doesn't matter for scoring.
  #6   Spotlight this post!  
Unread 20-01-2014, 15:21
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Re: Keeping Track of Assists

I know that which robot gets the assist doesn't matter, however, I am trying the simulate the alliance monitor, which does show which robot got the assist, and where.
  #7   Spotlight this post!  
Unread 20-01-2014, 15:50
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,600
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Keeping Track of Assists

Quote:
Originally Posted by ggorsuch View Post
I know that which robot gets the assist doesn't matter, however, I am trying the simulate the alliance monitor, which does show which robot got the assist, and where.

Since FIRST doesn't release the details to make it work exactly the same as their implementation, I would try to make it the most reasonable way and not spend too much time worrying if it matches exactly.

I would re-evaluate at each possession/zone change and use whichever gives the highest score at that time. If there are multiple permutations with the same score, I would use the same combination that was used in the last evaluation.
  #8   Spotlight this post!  
Unread 20-01-2014, 21:57
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Would somebody be able to explain the permutation process?
Do I permutate each combination of robot/zone (r1red, r2white...) or each object (r1, red, r2, white...)?
  #9   Spotlight this post!  
Unread 21-01-2014, 01:10
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: 487
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: Keeping Track of Assists

Have you tried running the code? I think that if you print out the data structures as it runs it might become more clear.
  #10   Spotlight this post!  
Unread 21-01-2014, 01:17
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Re: Keeping Track of Assists

I have run the code, however I'm not exactly fluent in c++, so it is hard for me to figure out what and how to print the correct things.
  #11   Spotlight this post!  
Unread 21-01-2014, 02:21
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: 487
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: Keeping Track of Assists

Ok, try this.
Attached Files
File Type: cpp assist.cpp (2.2 KB, 3 views)
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 02:43.

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