Formations
In this session we will introduce one of the tools available for use with drone exams, specifically 2D and 3D formations.
Last updated
In this session we will introduce one of the tools available for use with drone exams, specifically 2D and 3D formations.
Last updated
For both spectacle and engineering, geometric shapes have multiple applications and a unique beauty. In the Swarm in Blocks folder, which can be found on the team's GitHub, you can find a file written in Python called formation.py
, in which all the functions for each 2D formation and some basic 3D ones are written, all those presented in the list below:
Line
Circle
Full square
Empty square
Triangle
Cube
Pyramid
Sphere
The formation file is responsible for calculating the position that each Clover should be, to store all this, an array was created, which will be the return of the function, for this, the group used the Numpy library. The array contains the corresponding coordinates of each drone.
In this example, we create a Numpy empty array, so that later the function enters a loop where some calculations can be done to assign the value of each coordinate. After that, this value is passed to a list that will be finally concatenated, generating an array of four columns and N rows, the fourth column is a necessary parameter for transformations.
The swarm.py
class file is responsible for receiving and applying all the other scripts. The function below is responsible for collecting the parameters passed in the menu and calling the function from the formation file. After receiving the array it translates the coordinates, so that the center of the formation becomes the point (0,0) on the map.
In the menu that appears after calling this node, you can choose which formation you want by entering the size of the geometric shape. The next command would be Apply to start positioning the drones, or Plot to preview the chosen formation.
You can use this tool in two ways: the first would be to make the drones appear already in the desired formation, just by providing the TakeoffAll
command in the menu. Like below:
This second command should be done in a second terminal, you can choose the flight modes and then choose whether the simulation is already running or not. This way is also using the command below, because it also shows the options of formations that can be chosen. After that and supplying the side, the next command in the menu would be ap, or plt, or plt3d.