I'm doing a robotics project in which I have multiple raspberry pi powered robots. When they meet eachother one of them can decide to set up a wifi hotspot and the other ones should connect to it.
When a robot sets up a hotspot, the SSID will contain the number of the robot:
Every robot should scan for wifi networks every 10 seconds (
nmcli dev wifi) and when it detects a network called
robot_x it should connect to it. To make it easier for now, all the networks will have the same password.
I know how to connect to a network by defining it in the
wpa_supplicant.conf, but I don't want to define all the networks in all the robots. I could of course programatically edit the
wpa_supplicant.conf when I detect a network, but I've got a feeling there's a better way to do this.
Does anybody know how I can make this work more dynamic so that when I know which network is available (for example
robot_78) I can then connect to it using some kind of command?
All tips are welcome!