Gradient information derived from the desired shape (img4.png, can be changed to any connected shape), using the code in pixe2.m.
Mobile robotics simulation toolbox in MATLAB is used to create a simulation environment, to define individual robot equations and parameters, to enable the robots with lidar like sensing capabilities. Simulations of the robots moving in a 2D environment to assemble into a structure are performed. Toolbox can be downloaded from: https://github.com/mathworks-robotics/mobile-robotics-simulation-toolbox
The code fin3.m use the gradient information and the toolbox to create the robots and simulate them. The final simulation can be seen in the file final-simulation.gif