Connect the RoboMaster to the server - HU-ICT-LAB/RobotWars GitHub Wiki

Purpose of this article

Explaining the technology, our decisions and giving some examples of how to use it.

The connection

Before we can send files or scripts to the RoboMaster we need to establish a connection between the RoboMaster and the server. At first we've looked at websockets, this was going to be a good option but we actually wanted to use ROS2 since we are using that on our robomasters. We quickly found out that it's doable but it also is very hard to get working and it even is hard to startup. Mainly the last point will be a problem because following students working on this project will not have our knowledge of the project. To make it easy for them the project needs to be easy to setup and that's not the case with the ROS2 connection between the server and robomaster.

Now we're back at the beginning with websockets. We've made and used some demo's of this but the code was getting quite hard to read so we started looking further. We are using an flask api for the connection between the frontend and server so we thought; why not try to use the same technology for the connection between the server and robomasters.

To get a good idea of this idea: We would have the server, robomaster with a jetson brain and the database. To be able to let the AI Robomasters play autonomously it would need to have an policy file, the jetson would make a request to the database and retreive the policy file it needs. To be able to get information from the robomaster we would make requests from the server to the jetson's api. If this idea is fully worked out it would be very loose coupled.

Implementation

Like discussed before we're running an api on every jetson of every robomaster, the server can send requests to each and every robomaster to retrieve any information or perform actions on the jetson. The jetson can send information to the database and it can retrieve policies when it needs a new one.

visually explained connection between server and robomaster

Sources

Aymeric Augustin and contributors. (2021). websockets. Websockets. Retrieved 5 November 2021, from https://websockets.readthedocs.io/en/stable/

Related Issues

Issues: #60