Go to Post The jags are powered with magic... - Aren Siekmeier [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

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 19-04-2016, 17:02
MasterEric's Avatar
MasterEric MasterEric is offline
Bacon. 'nuff said.
AKA: Eric Myllyoja (E2)
FRC #2137 (Oxford Robocats)
Team Role: Programmer
 
Join Date: Dec 2012
Rookie Year: 2013
Location: Oxford High School
Posts: 62
MasterEric is an unknown quantity at this point
Can you programically retrieve match number?

Put this under general programming since this is somewhat of a platform-independent question, but I specifically use LabVIEW.

I was looking through the methods to retrieve information from the Driver Station, and found some cool ones to retrieve connection status, robot status, even alliance position and color (Blue 3, Red 2 etc.). These are extremely useful for the purpose of logging, knowing whether you are connected to the field, knowing which log is which, and so on.

My question is whether the current match number can be retrieved as well. I did not find a VI for it, and I couldn't open up the alliance position VIs to see how they worked (they just run a method in a DLL file somewhere). However, match number is broadcast to driver stations, as shown by this documentation page (scroll down to "Identifying Logs from Matches").

I'd love to know if anyone's done this before or can help me find a solution or workaround.
Reply With Quote
  #2   Spotlight this post!  
Unread 19-04-2016, 18:23
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,032
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Can you programically retrieve match number?

My understanding is that information isn't available to the robot. The DS knows it (it shows up in the DS logs), so in theory you might be able to hack something together to figure it out... but that sounds like a lot more effort than its worth.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #3   Spotlight this post!  
Unread 19-04-2016, 21:50
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Can you programically retrieve match number?

The DS sends a bunch of info the the dashboard. I don't think SD currently decodes it and makes it available, but the LV dashboard, top loop, makes a call to Retrieve Status Info. That VI has an output called Power and Errors. Kind of an odd combo, but anyway, in the same cluster is match info. I have never actually tested it at an event, but I suspect that the data will be in there. You could write it to your own file on the DB computer, or you can put it into Network Tables and give it to the robot.

Greg McKaskle
Reply With Quote
  #4   Spotlight this post!  
Unread 19-04-2016, 22:04
marshall's Avatar
marshall marshall is offline
My pants are louder than yours.
FRC #0900 (The Zebracorns)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2003
Location: North Carolina
Posts: 1,206
marshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond repute
Re: Can you programically retrieve match number?

Quote:
Originally Posted by Greg McKaskle View Post
The DS sends a bunch of info the the dashboard. I don't think SD currently decodes it and makes it available, but the LV dashboard, top loop, makes a call to Retrieve Status Info. That VI has an output called Power and Errors. Kind of an odd combo, but anyway, in the same cluster is match info. I have never actually tested it at an event, but I suspect that the data will be in there. You could write it to your own file on the DB computer, or you can put it into Network Tables and give it to the robot.

Greg McKaskle
Thank you for this! This really needs to be fully documented. I think we are using some of it now but I believe it isn't fully documented about how to do it.
__________________
"La mejor salsa del mundo es la hambre" - Miguel de Cervantes
"The future is unwritten" - Joe Strummer
"Simplify, then add lightness" - Colin Chapman
Reply With Quote
  #5   Spotlight this post!  
Unread 19-04-2016, 22:46
MasterEric's Avatar
MasterEric MasterEric is offline
Bacon. 'nuff said.
AKA: Eric Myllyoja (E2)
FRC #2137 (Oxford Robocats)
Team Role: Programmer
 
Join Date: Dec 2012
Rookie Year: 2013
Location: Oxford High School
Posts: 62
MasterEric is an unknown quantity at this point
Re: Can you programically retrieve match number?

Quote:
Originally Posted by Greg McKaskle View Post
The DS sends a bunch of info the the dashboard. I don't think SD currently decodes it and makes it available, but the LV dashboard, top loop, makes a call to Retrieve Status Info. That VI has an output called Power and Errors. Kind of an odd combo, but anyway, in the same cluster is match info. I have never actually tested it at an event, but I suspect that the data will be in there. You could write it to your own file on the DB computer, or you can put it into Network Tables and give it to the robot.

Greg McKaskle
I think I found it!



WPI_DashboardProcessTCPPacket.vi, in red box at bottom left is the bundle constant which stores the default values. I surrounded the Event Info box with a red rectangle for emphasis, since I assume this is where the values are.

Sadly, there are no descriptions for any of these values (Name, Type, Number, Replay), whether they are base-0 or base-1, or what they refer to (what does type mean? does replay read 1 if this match is a replay?)

Anyway, in hopes of turning this into a VI for a robot target (rather than one for the dashboard) I sleuthed through the relevant code.

Apparently this method creates a TCP connection on port 1741 (at least for me) which then listens for requests; when one is received, it is sent through a local variable to the WPI_DashboardRetrieveStatusInfo.vi, where 10,000 bytes are read, then the data is sent to be processed by WPI_DashboardProcessTCPPacket.vi. It does some weird byte stuff that I can't for the life of me interpret, then it reads it, parses it, and passes it out through Power and Errors.

Would this work if I ported it to the robot, or are these port 1741 requests only sent to the dashboard?
Reply With Quote
  #6   Spotlight this post!  
Unread 19-04-2016, 23:54
scca229 scca229 is offline
FTA acquiring knowledge
AKA: Nate
FRC #0060
Team Role: Mentor
 
Join Date: Apr 2014
Rookie Year: 2011
Location: South of Phoenix, Arizona
Posts: 201
scca229 will become famous soon enoughscca229 will become famous soon enough
Re: Can you programically retrieve match number?

Quote:
Originally Posted by MasterEric View Post
Apparently this method creates a TCP connection on port 1741 (at least for me) which then listens for requests; when one is received, it is sent through a local variable to the WPI_DashboardRetrieveStatusInfo.vi, where 10,000 bytes are read, then the data is sent to be processed by WPI_DashboardProcessTCPPacket.vi. It does some weird byte stuff that I can't for the life of me interpret, then it reads it, parses it, and passes it out through Power and Errors.

Would this work if I ported it to the robot, or are these port 1741 requests only sent to the dashboard?
The port 1741 part has me wondering if the robot would ever see it since that is not one of the ports that is white-listed through the FMS. Am I reading section 2.4 of the Game Manual correctly in this instance?
__________________
Nate
Reply With Quote
  #7   Spotlight this post!  
Unread 20-04-2016, 08:19
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Can you programically retrieve match number?

Retrieve status info already returns the data. It is wired to the named unbundler at the bottom of the loop. It unbundles the Camera IP and robot IP, but not the other fields. If you grow it, or change robot IP, you can retrieve the event info cluster.

The picture you posted is of the implementation details. That is a constant that sets the feedback node storage the first time it executes. The TCP message shows up occasionally and is held onto by the shift register so that once seen, the return value remains valid.

The new or cached value is then passed by wire, not local variable, to a loop that processes a stream of mixed info. The 10,000 bytes is a max read, by the way.

As for sending to the robot, I'd just write this info to a network table variable. There is no need to make your own TCP connection for about ten bytes of data.

Port 1741: This is communicated on a local connection between the DS and DB. It is on the same computer 99% of the time, and if you are using two computers, it doesn't go through the field either, just between your computers. So the port is unlikely to be blocked. If it is, very little of the DB works already.

The info is not documented, but not cryptic either. The name will be some characters. It is short and understandable event name, but not a complete address or anything. Type will tell you what type of match it was. Number, the match number. Replay will increment if this is a replay of a previous match. I don't want to spoil all the decoding fun...
This data shows up in the log file viewer as the Qual 3-1, for example.

And bear in mind that this wasn't well tested. I expect it to work, and it was put there for this purpose, but to my knowledge hasn't been used yet. It's just like those special feature on your robot that "work" when you talk to other teams and judges, they just haven't been tested on the field .

Greg McKaskle
Reply With Quote
Reply


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 08:29.

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