-
Notifications
You must be signed in to change notification settings - Fork 38
Networking
NOTE: It is always a good idea to make a backup copy of any system files you are changing.
To make connecting to and working with the robots easy, we give each robot a static IP address.
The best way to go about this on the Nao V3.x (running modified Ubuntu) is to edit the /etc/network/interfaces
file. Open the file in your editor of choice and add the following:
# set Ethernet static IP address 192.168.0.101
auto eth0
iface eth0 inet static
address 192.168.0.101
netmask 255.255.255.0
network 192.168.0.0
On the Nao V4 (running modified Gentoo) you will have to edit the '/etc/conf.d/net' file. Open the file in your editor of choice and add the following:
# wired static IP
config_eth0="192.168.0.101 netmask 255.255.255.0"
routes_eth0="default via 192.168.0.1"
This will set the IP address of the robot to 192.168.0.101
. Each robot should have a unique address, e.g. 192.168.0.102
.
NOTE: It is possible that the Ethernet adapter on your robot has some other name than eth0. If this is the case just replace any reference to eth0 with the correct name.
You can find instructions for setting a static IP on your personal computer (make sure to pick a different IP address than what you set for the robots):
- Windows7
- MacOS
- Ubuntu: You can do the same to your
/etc/network/interfaces
file or the following commands will set a temporary static IP:
sudo /sbin/ifconfig eth0 down
sudo /sbin/ifconfig eth0 up 192.168.0.204
- Gentoo: If you are running Gentoo, you can make the same changes to your '/etc/conf.d/net' file or you can execute the same commands given for Ubuntu above.
The wireless network interface can be a little more involved and will depend on the type of network you are trying to connect to. This will go over two typical configurations you might encounter.
These examples assume the wireless network interface is named wlan0.
If you are using the Nao V3.x, setting up a static IP address for a wireless network without any required password can be done in a similar fashion as the wired interface through the /etc/network/interfaces
file. The following is what we use on our RoboCup wireless router.
# Static Wireless IP with No Password
auto wlan0
iface wlan0 inet static
address 192.168.1.101
netmask 255.255.254.0
network 192.168.1.0
gateway 192.168.1.1
up iwconfig wlan0 essid robocup
For the Nao V4, setting up a static IP address for a wireless network without a password is similar to setting up the wired interface through the '/etc/conf.d/net' file. For our RoboCup wireless router, we would use this configuration:
# wireless static IP
config_wlan0="192.168.1.101 netmask 255.255.255.0"
routes_wlan0="default via 192.168.1.1"
In past RoboCup competitions the official fields have used wireless networks with WEP keys. This is one way to configure the robot using a wpa supplicant to connect to the network.
Nao V3.x:
The /etc/network/interfaces
file should contain the following lines:
# Static wireless IP with WPA Supplicant
auto wlan0
iface wlan0 inet manual
up ifconfig wlan0 up
up wpa_supplicant -iwlan0 -Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf -B
up sleep 1 && ifconfig wlan0 192.168.26.101 netmask 255.255.0.0 && route add -net default gw 192.168.254.6
down killall wpa_supplicant
down ifconfig wlan0 down
Nao V4: Edit the '/etc/conf.d/net' file so that it contains the following lines:
# prefer wpa_supplicant over wireless-tools
modules="wpa_supplicant"
# specify which driver to use
wpa_supplicant_wlan0=""
# configure wireless IP
config_wlan0="192.168.26.101 netmask 255.255.0.0"
routes_wlan0="default via 192.168.254.6"
You will have to change the IP address (192.168.26.101) and default gateway IP (192.168.254.6) depending on the network you are connecting to.
Regardless of whether you are using the Nao V3.x or Nao V4, this configuration also requires you to create a new file /etc/wpa_supplicant/wpa_supplicant.conf
with the following contents depending on the type of security used on the network:
WEP Key:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
network={
ssid="NETWORK NAME"
key_mgmt=NONE
wep_key0=hexpasskey
}
WPA Passkey Key:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
network={
ssid="NETWORK NAME"
key_mgmt=WPA-PSK
psk="PASSKEY"
}
For the wep_key0
and psk
fields, you need quotes if the key is a string key and you should leave out the quotes when using a hex key.
If the router you are attempting to connect to does not broadcast its SSID, you must change 'ap_scan=1' to 'ap_scan=2'.
The Nao robots come with a special network manager pre-installed called connman. In order for these instructions to work you need to disable this program. If you followed the Nao setup instructions then this should have already been done.
To remove connman from starting on boot do the following:
Up to Nao V3.3 (Ubuntu based): remove the connman link from /etc/rc5.d/
$ rm -f /etc/rc5.d/S15connman
Nao V4 (Gentoo based): use rc-update to remove connman from automatic startup:
$ rc-update del connman boot