RoboTeam Interface
The interface is the webpage displaying our robots and the field. Additionally, for easy testing, we can draw objects onto the field. For example, the places we would like to intercept the ball or places we could pass to. To see some examples for how to draw, look at the end of the Play.cpp file. The function rtt::ai::gui::Out::draw is what you are looking for. Important is to make sure your drawing has a unique label and it is in the correct category. In the interface, under the tab 'UI settings' you can change which drawings should be drawn.
On the branch feature/metrics a new tab has been added called “Performance” where some stats describing the performance of the team are shown, such as ratio of offensive/defensive plays, passing accuracy, etc. Some extra information is also displayed for debugging. At the bottom of the tab, there is a button that allows to generate a report with the most descriptive metrics shown on the tab. The uncomfortable thing is that for that button to work there is a python code that must be run in another terminal. It is located at roboteam_interface/src/modules/components/panels, and it is called generate_pdf.py. It basically starts a Python server that reads the content of the performance tap and cast it to a pdf template. Regarding this tap there are two straight lines of improvement:
- Inserting the python server code (generate_pdf.py) in the docker setup, in such a way that the server is started along with the rest of the code.
- Improving the computation of the passing accuracy. The most complicated point for this is to know when a pass has been completed or when it has been unsucessful. It is certainly difficult to compute this metric due to the way roles are currently assigned as the play evolves. A better logic or maybe some new auxiliar role would get this working.
- All the computation of the metrics takes time, and it makes the interface less responsive. Some optimization could be done for this, basically on the frequency with which the metrics are recomputed.
On the file performance-widget.vue the computation of all the metrics is implemented. The most poorly performing computation is the passing accuracy, which is condensed in the method passing_accuracy_block(). Basically, we consider two possible scenarios when we have the ball (offensive play is on): there is a pass being performed or not. If there is no pass occurring, we are constantly looking for a passer (we should do this with a high frequency). If a pass has been sent to a receiver, the logic to determine if it is succesful or not is run. All this logic is a bunch of methods to ID the passer and receiver, compute their distances to the ball etc. Those submethods work well, but probably they could be assembled in a smarter way.