I am using Ubuntu 14.04 server version on a turtle bot which is moving around. It is connected to my network with 4 APs around. My aim is to switch between APs when the turtle bot moves around. Currently it will keeps holding on to the current AP until the signal level is super bad before it switches. I wrote a script which constantly gets the strongest AP MAC address. I was wondering whether there is a way I can force connect to an APs MAC address. A little bit of googling and all I found was the below commands which didn't work when I tried it.
iwconfig wlan0 ap MACAddress ip link set wlan0 down ip link set wlan0 up
I also found nmcli d wifi connect password iface bssid MACAddress which did help me to connect but I would like not to use password and username in the command, but use the setting in /etc/network/interfaces.Is there any other methods I can use to achieve what I need? I'm running Ubuntu 14.04.