It is separated in two parts: the first one deals with more hardware related issues, while the second one is more related to the software configuration.
I asume that you have the Asctec Quadrotor Pelican running with Ubuntu 10.04, have already installed ROS (this was done using ROS Fuerte, but should work with other versions), have installed the asctec_mav_framework package and have a WiFi connection with WPA2. On the other side, I asume you will be using a computer with Ubuntu and ROS as a groundstation (this was tested using Ubuntu 12.04 and ROS Fuerte), and have installed the asctec_mav_framework on this computer also.
The idea is to be able to initialize the quadrotor without using the LVDS screen (so it is ready to fly), for this the Secure Shell (SSH) protocol available in Ubuntu is used. SSH allows you to log into the quadrotor and start the asctec_mav_framework ROS package using the terminal from your groundstation. This way your quad will be able to receive commands and start/stop execution without the need of a mouse, keyboard or screen.
Atomboard-HLP Connection
The first step is to check the connection between the Atomboard and the HLP. This should be done using the cable with a "loop" on the HLP side.This should connect one of the serial ports of the Atomboard (/dev/ttyUSB0 or /dev/ttyUSB1, I suggest the first one, but in case you need to use the /dev/ttyUSB1 remember to change the configuration parameters accordingly).
WiFi Set up
It is needed that the quadrotor connects automatically to the WiFi at startup. For this, a new network manager is suggested: WPA Supplicant.To install WPA supplicant in your quadrotor:
sudo apt-get install wpasupplicant
Then uninstall other networks managers (for example WICD or NetworkManager):
sudo apt-get remove networkmanager
sudo apt-get remove wicd
The next step is to configure it to connect to your WiFi network. Run this on a terminal (assuming your wireless network is called my_wifi_network, this is known as SSID, and the password is my_password):
wpa_passphrase my_wifi_network my_password
This will show in the same terminal something like this:
network={
ssid="my_wifi_network"
#psk="my_password"
psk=5dd3c4758a980d50d133d0cd43dc6a0460211f397925522d74e9e3b622420304
}
Now, you should create a file to store this configuration information (for example in /etc/wpa_supplicant/wpa_supplicant.conf). One way to do this is in a new terminal run:
sudo gedit /etc/wpa_supplicant/wpa_supplicant.conf
This will open gedit, where you can paste the network information directly and save changes.
The next step is to open the /etc/network/interfaces file and edit the wlan0 section. Open it using any editor, for example:
sudo gedit /etc/network/interfaces
And modify the wlan0 section so it looks like this:
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
post-up /sbin/iwconfig wlan0 power off
The wpa-conf line loads the file created in the last step with the WiFi configuration. The post-up line disables power management permanently, this is done to avoid high latencies. You can check the power management status using the command:
iwconfig wlan0 |grep "Power Management"
Serial Ports Access and Grub
In case you are using Ubuntu 12.04, you need to run the following command in order to use the serial ports without root permissions (this adds the user to the dialout group): sudo adduser <username> dialout
To speed up boot and remove some i8042 related messages add the following line in the file /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="i8042.noaux=1"
And update grub:
sudo update-grub
Configure Static IP
To allow the quadrotor and the ground station to easily locate each other while using SSH it is convenient to give both a static IP and give both machines names. To give static IPs there are at least two methods:1. Using the router configuration:
You can configure your router to give an IP based on the MAC address of the device connected. Here is an example of how to do this: http://resource.dlink.com/connect/mastering-static-ip-addresses/2. Setting up each machine:
In some cases the router doesn't support static IPs by MAC, or you don't have access to them. In this section I will explain how I set up each machine to ask for a static IP address.2.1 Setting up the ground station:
Assuming you are using Ubuntu 12.04. You can click on the wireless icon and choose edit connections.
Then select the "wireless" tab, choose your connection and click Edit.
Then you should check the option "Connect automatically" and then go to the IPv4 Settings tab.
Choose "Manual" as Method. On the Addresses section, click Add. If you are on your private network, you can usually choose as address the ip 192.168.*.* (for example 192.168.1.52). The netmask usually is 255.255.255.0, and the gateway 192.168.*.1. Don't forget the DNS server address. After this reconnect to your wireless network.
To check that everything worked fine, you can run the command ifconfig on a terminal, this should print the connection information in the terminal. Check the wlan0 section and the ip next to inet addr.
2.2 Setting up the quad connection
Based on the instructions given here to set up a static IP, you should again modify the /etc/network/interfaces file so it looks like this:
auto wlan0
iface wlan0 inet static
address 192.168.0.2
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1, 192.168.0.2
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
post-up /sbin/iwconfig wlan0 power off
Notice now the static value instead of dhcp and the other parameters added (address, netmask, etc.) .
Now you should reboot, and after logging you should run the command ifconfig and check the IP is correctly set.
The checkdisk error
We are configuring our quad so it is able to boot and connect to the internet automatically, but you may encounter the following problem.
If you turn off the Atomboard and disconnect any power source from it (either battery or alternative power sources), you may find that the next time you turn it on it you encounter something along the lines of:
Checking root file system...fsck from util-linux-ng 2.16.1
humel-root: Superblock last mount time (Wed Oct 7 18:53:39 2009,
now = Sat Jan 1 00:00:14 2000) is in the future.
humel-root: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options)
This (I believe) is caused before the last mount time is stored but the internal date is reset when there is no power source, so it registers the last mount time as in the future and forces to check the disk for errors.
To avoid this, I followed the instructions found here. You must edit the /etc/e2fsck.conf file and add the following:
[problems]
# Superblock last mount time is in the future (PR_0_FUTURE_SB_LAST_MOUNT).
0x000031 = {
preen_ok = true
preen_nomessage = true
}
# Superblock last write time is in the future (PR_0_FUTURE_SB_LAST_WRITE).
0x000032 = {
preen_ok = true
preen_nomessage = true
}
This tells e2fsck that the problem can be auto-fixed without mentioning it.
The next part shows how to set up SSH communication and configure ROS to work on both machines.