Scouting API Programming

Every team does their scouting differently, and i am curious what sort of solutions other teams have come up with, and what they are willing to share. VexDB has a fantastic API to pull data from, and i am currently working to utilize that. I am building my own API in VBA (through MS Excel) because it is the only executable programming language i have access to for most of the day.

I am interested to know

  1. What data sources do you use? (VexDB, Robot Events, another API)
  2. What language do you work in? (VBA, C++, Java)
  3. What program editor and executor do you use? (Excel, RobotC, Notepad++)
  4. What sorts of data do you look at? (Historical performance, YTD win %, number of events attended)

Anyone who would like to swap or discuss methods, i would love to know what is out there.

Yes, I am also interested in these methods for a project I’m working on

Who even needs to scout? We are building a neural network in Java pulling from vexdb. It looks at all of a teams matches and stats like OPR, CCWM, etc. It will then pick your best teams. (No, we don’t expect this to be at all useful or actually make valid predictions, but it’s fun anyways)

I actually want ours to move toward that. I want to develop a bunch of flags that it will calculate for every team, then rank them based on how many flags say they are a good team. I have done some stuff with this just with Indiana data, but i was only using three flags and it barely got better results than any single one of them. I think with enough flags, you could reliably predict good teams.

@Robo_Eng_13 it would be pretty easy to make a program that generates an Excel sheet with each team and their stats (OPR, DPR, etc) and color them based on of they’re good or not. For example, iirc a lower CCWM is good, but a low TRSP is bad if the team did bad. That could be pretty useful, but your events would need to be using vexvia to get this info

I may make that actually

Be careful with how much you read and write in excel sheets. I did some work with PageRank and all of the manipulations were done in sheets. I ended up with a cycle time greater than 12 hours to analyze 500 teams, and that only gave one flag. I rewrote my code to pull the data in to a spreadsheet, convert the data to objects, do all the calculations in the objects, and then write the results to the sheet. This cut cycle time down to less than 5 minutes, with only 30 seconds or so for calculations. If you are working with Excel, it is worthwhile to really use its full power in VBA.

I am starting to look at this again. I did it 5-6 years ago before VexDB was around. My first pass is will be to provide the data some of my teams use for pre-event scouting sheets. I’m hoping to have this much ready by the U.S. Open, but I’m on vacation next week so we’ll see how that goes.

So far I have a site that is pulling data directly from VexDB and starting to build out all of the scouting data for each team dynamically. The challenge here is that it means many asynchronous calls to the VexDB api which has ended up making the application a lot more complicated than I wanted. When I get back from vacation I’m going to look at pulling all the needed data to a database first so it can be more easily queried and processed.

I will be updating scouting.cornerstone.robotics.net as I make progress. Right now it is basically just a placeholder that will pull team lists for the U.S. Open and Worlds to test accessing the VexDB api.

I have also been considering the pros and cons of real time queries vs pulling data and making my own data base. I am not sure which i will go with yet. I am concerned about the initial time cost to pull the latest data from VexDB and build my own database.

Use Python.

Groovy atw

I created a scouting app which pulls data from DB at the begaining of this season. I used Java to code it. It was useful for determining your specific standing in a tournament. I pulled all sorts of data, from driver skills to awards won. I think the best feature of DB is it’s vrating and vrank. I might post my application if this pulls enough traction but it is really simple and I am pretty sure anyteam with a knowledge in programming can make one.

I use google sheets with a “IMPORTJSON” custom function. We just have to edit the web address to get the correct response. It works very well. You can PM me if you want examples.

We (1900X/W/A/R) primarily focus on scouting at a tournament itself and as such our scouting program focuses on using the live data provided by VexDB. We use a web application that I work on regularly. The primarily functionality is a scouting form to collect information about a team’s autonomous play and robot capabilities (scoring speed, near vs. far zone scoring, stars/cubes held at a time). Then, using VexDB, it can pull all of, say, 1900X’s matches and show a page listing information about all 4 teams in a match using the scouting data we collect.

The frontend is just Javascript (no framework like AngularJS or React), and the backend is a Node.js server. I also use Firebase for the database. It’s hosted on Heroku, and for local testing I use the Heroku CLI.

It’s by no means ready for any kind of public release (the database structure could handle it, but I would have to make certain changes on both the frontend and backend that just aren’t high on the priority list right now), but if you’re interested in checking it out you can PM me. The code is also public on GitHub: https://gitbub.com/wa-robotics/wa-robotics-scout

Right now, i plan to do the following development on mine.

  1. Fully build the API interface to pull the desired data from VexDB (i still have not decided if i will pull everything into a local database, then use it from there, or if i will make queries as i need them. There are tradeoffs i need to consider on both.)

  2. Generate a list of flags to calculate the overall “goodness” of a team, with at least some mathematical justification. Up to this point i have used Win %, Autonomous Win %, and PageRank, but all of them gave me about 60% to 65% prediction accuracy, and just betting on Red in the final tournament is a solid 75%. For reference, i use Qualifying matches to calculate my numbers, then Elimination matches to verify and test them.

  3. Find a solid way of combining the goodness of two teams in an alliance. I am currently doing root sum square (pythagorean theorem), but i have tried simple addition, multiplication, and some special combinations, and i have not really seen more than a 1% improvement.

  4. Comparison of two alliances. I finally found good math for this, but i will need to do some verification before i know if it will work in the field. It uses statistics for each alliance (their YTD Win % as the mean, the standard deviation of their win % as the standard deviation, then finding the probability that any random sample from one normal distribution is greater than one from another).

link text

  1. GUI that the operator can request information based on team or event, match prediction, and desired alliance partners. Editable and printable after generation to take scouting into account.

Point 1 is pretty straight forward, but i am still hoping to find more flags of a team’s goodness for point 2. I have considered the rate of change (derivative) of their YTD Win % as a way of identifying teams who were good but are not keeping up, or who had a rough start but are improving rapidly. Any suggestions here would be great.

I would like to access data from VexDB on Google Sheets, in the script editor. I am new to JavaScript and I have no experience with API interfaces. Does anyone have a sample of code I could see to try and figure it out?

I’ve done this in the past, and the critical section of code was this:


var url = "http://api.vexdb.io/v1/get_rankings?sku=" + sku + "&team=" + teams*;
var requestResult = UrlFetchApp.fetch(url).getContentText(); //get results of request
var formattedResult = JSON.parse(requestResult); //parse the request to create a JSON object
var results = formattedResult.result;

where


sku

was a variable containing the event’s SKU from RobotEvents and


teams*

was a specific team’s number (such as


1900X

).

Basically, first you’ll want to figure out what API request you need to make to VexDB. Then you use Google Apps Script’s


UrlFetchApp

to actually make the GET request to VexDB. You can get the text result of the request to VexDB using the


getContentText()

function. VexDB gives you a result in JSON. You can convert that to something you can interact with in JavaScript by passing it through that


JSON.parse(whatever you want to parse)

function. The last line isolates the important part of the JSON, which in this case is whatever is in the “result” property.

It’s a good idea to visit whatever URL you intend to make a request to before trying it in your code. That is, if you wanted to use a list of teams in your code, you should first visit the URL you think* will give you that data in your browser. That way, you a) know the URL actually works and b) can see the structure and format (as in JSON, XML, etc.) of the data.

Also, the Apps Script documentation and Google searches will take you a long way, as long as you know the basics of whatever you want to do (if you don’t, do some research into what an API request actually entails, and that will help you get started).

Finally, Apps Script has a [

](https://developers.google.com/apps-script/reference/base/logger#logdata) function that is incredibly useful for figuring out what's happening in the code.  It's something you'll definitely want to make use of as you get into Apps Script development.*

For those of you who may be developing JavaScript applications for scouting, I will point you towards the client library I developed for vexdb. It is fully featured, supporting promises, default parameter values, live updates, and caching.

I wrote something a little while ago that might work. PM me if you want the sample code.

I use VexDB and get everything via Javascript (ie, GET request using Jquery). For code editing, I prefer VS Code cause it looks nice and works pretty well. I usually get match info and events so we can plan for tournaments ahead of time.

I used Google sheets to request information from VexDB. This is the information I received:

https://docs.google.com/document/d/10h4ZYdZWjRz2tkhy6ig4Lu325W-mP-acrszEU-P2EJ8/edit?usp=sharing

I have limited knowledge of Javascript, so how would I make this an object and be able to refer to the different pieces of information?