Collective intelligence and autonomy of robot swarms can be improved by enabling the individual robots to become aware they are the constituent units of a larger whole and what is their role. In this study, we present an algorithm to enable positional self-awareness in a swarm of minimalistic error-prone robots which can only locally broadcast messages and estimate the distance from their neighbours. Despite being unable to measure the bearing of incoming messages, the robots running our algorithm can calculate their position within a swarm deployed in a regular formation. We show through experiments with up to 200 Kilobot robots that such positional self-awareness can be employed by the robots to create a shared coordinate system and dynamically self-assign location-dependent tasks. Our solution has fewer requirements than state-of-the-art algorithms and contains collective noise-filtering mechanisms. Therefore, it has an extended range of robotic platforms on which it can run. All robots are interchangeable, run the same code, and do not need any prior knowledge. Through our algorithm, robots reach collective synchronisation, and can autonomously become self-aware of the swarm's spatial configuration and their position within it.