Scheduling Creation | Android Development
Repository
https://github.com/LakeEffectRobotics/LakeEffectScoutingServerApp
What is this
This is an app made for a FIRST robotics team.
One of the most important strategic parts of the competition is scouting. Scouting is recording data about other robots to analyse and see what robots are good at what and bad at what.
This is an app to do scouting. Recording data on paper and then putting it in a database is convoluted and wasteful, so we built an app to replace this system. 6 people use the app independently on Android > devices and record data about one robot each per game. A server app can then pull data from all the devices to combine it all in one.
New Features
- Save device name in shared preferences
- Fixed issue with names not deselecting
- If they are removed from the list while selected and were added in a previous runtime
When a name was removed while selected, it was removed from the allNames list but not the
selectedNames list.
- Made a calculatable schedule for each user
For scouting, there are 6 robots per match that need to be watched. This function needs to figure out who to switch on and off when, and which robot each person is watching (scouting). This does this by simulating someone swapping names every match like you would do on paper.
It creates a list of the on and off scouts
//scouts currently scouting or not
Scout[] scoutsOn = new Scout[6];
ArrayList<Scout> scoutsOff = new ArrayList<>();
It then finds who needs to swap with who if there is someone to swap with.
//calculate the schedule for this match
//find scouts to switch on (the scouts that have been off >= targetTimeOff)
ArrayList<Scout> scoutsToSwitchOn = new ArrayList<>();
for (int i = 0; i < scoutsOff.size(); i++) {
if (matchNum - scoutsOff.get(i).timeOff >= targetTimeOff && scoutsToSwitchOn.size() < 6) {
scoutsToSwitchOn.add(scoutsOff.get(i));
}
}
//find scouts to switch off (scouts with the highest time)
ArrayList<Scout> scoutsToSwitchOff = new ArrayList<>();
//sort by time on
for (int i = 0; i < scoutsOn.length; i++) {
//the index to add this scout when sorted
int indexToAdd = scoutsToSwitchOff.size();
for (int s = 0; s < scoutsToSwitchOff.size(); s++) {
if (matchNum - scoutsOn[i].timeOn > matchNum - scoutsToSwitchOff.get(s).timeOn) {
indexToAdd = s;
break;
}
}
//add at index
scoutsToSwitchOff.add(indexToAdd, scoutsOn[i]);
}
The second for loop sorts the scouts on by how long they have been on. This is then used to switch the people ready to switch back on with the people who have been working the longest.
Using that information, it swaps the scouts.
//swap scouts on with scouts off
for (int i = 0; i < scoutsToSwitchOn.size(); i++) {
//scout switching on and off
Scout switchingOn = scoutsToSwitchOn.get(i);
Scout switchingOff = scoutsToSwitchOff.get(i);
scoutsOn[getScout(switchingOff.id, scoutsOn)] = switchingOn;
scoutsOff.remove(switchingOn);
scoutsOff.add(switchingOff);
//update timeOff and timeOn
switchingOn.timeOn = matchNum;
switchingOff.timeOff = matchNum;
}
This is then repeated for all the matches
- Added scroll view to name selector
- Prevented crash when less than 6 scouts were selected
It is not possible to make a schedule with less than 6 scouts, a warning must be given to the user. - Removed button to set minimum version number
I made the minimum version number auto update when someone types.
This is used to make sure the bluetooth clients this app connects to are up to date to not break the system. - Added ability to change target time off in the app
- Now can add a scout starting at a match number without disrupting the currently running schedule.
- Fixed checkboxes getting reversed
- Made it save and load the match number the selected names were selected at
- Added support for scouts that join and leave the selected list multiple times throughout the day
- Made it so that you can disable and enable scouts continuously over the course of the day
- It saves the match numbers the scout starts and stops
- It will tell you if you disable a scout when no one can replace them
This is a very important feature. If someone needs to leave and do something else, you can type what match they are leaving or starting at to make that user only matter during certain matches.
(The names in the image above are customisable, I put them as numbers for testing purposes)
To do this, a history of every time a user was selected and deselected is required to be kept.
- saves history of disabling and enabling scouts in shared preferences
- Fixed issue where scout sometimes wasn't taken off
- Fixed parts of scheduling clearing eachother
- Make the switching on and off inclusive
- If you switch on at match 25, you will be on at match 25.
- If you switch off at match 30, you will be off at match 30.
- Made checkboxes set to their last checked position
This was required to make sure that when you returned, it looks exactly like when you closed the app. Before, if the scout was EVER checked off, it would start checked next time you opened the app.
Made time off be changed based on match number
- You can change the time off starting at match 5 for example, and after that point scouts will get 3 matches off instead of 2.
Renamed mislabeled variables (Changed TextView to EditText)
Pull Request
https://github.com/LakeEffectRobotics/LakeEffectScoutingServerApp/pull/17
Thank you for the contribution. Would love to see the data of Scouting, do you have the data from other robots?. A lot of work has been gone into it.
Why do you have to switch off the scouting?, can it scout all the robots together?
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]
Thanks for the review,
A human scouts the robots manually. The human inputs the data into the app and that data gets processed and sent to the server. There are 6 robots on the field at a time. One person must scout each robot. So that people aren't scouting all day, some people are switched on and off to allow them to have breaks.
Here is some sample data here
The zip file contains an all robots file which contains all the data for each robot (each robot is assigned a number). This CSV file can be opened with a spreadsheet program like excel.
Thank you for your review, @codingdefined!
So far this week you've reviewed 11 contributions. Keep up the good work!
Hi @ajayyy!
Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server
Hey, @ajayyy!
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!
Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!