Thursday, September 29, 2016

Setting up a Drone Programming Environment using DroneKit on Ubuntu 16.04

This guide describes how to setup an environment for programming drones using DroneKit. The main requirement is an Ubuntu 16.04 box. Using this environment will allow testing of code before they are run on an actual drone. To run the code on a drone, simply update the connection parameters.

The procedure will require four terminals which will be used for different purposes. In the steps that follow, SRG-Bots is the working directory.

Terminal Zero - Used for installing the required packages 

$cd ~/Downloads
$wget  http://firmware.eu.ardupilot.org/Tools/APMPlanner/apm_planner2_2.0.23_ubuntu_xenial64.deb
$sudo dpkg -i apm_planner*.deb
$sudo apt-get -f install
$sudo dpkg -i apm_planner*.deb
$sudo apt-get install python-pip
$pip install virtualenv
$mkdir SRG-Bots
$cd SRG-Bots
$virtualenv dronekit_env
$source dronekit_env/bin/activate
$pip install dronekit dronekit-sitl mavproxy

 
Terminal One -  and running the simulator

$cd SRG-Bots
$source dronekit_env/bin/activate
$dronekit-sitl copter

In case the initialization is taking too long, you can reset the simulation.
$dronekit-sitl--reset


Terminal Two - Used to allow multiple connections on the drone

$cd SRG-Bots
$source dronekit_env/bin/activate 
$mavproxy.py --master tcp:127.0.0.1:5760 --sitl 127.0.0.1:5501 --out 127.0.0.1:14550 --out 127.0.0.1:14551

Terminal Three - Used to run APM Planner


$apmplanner2

Go to the menu, then select Communications -> Add Link -> UDP. Set the UDP Port field to 14550. Connection to the copter will be established.

Terminal Four - Used to run programs

$cd SRG-Bots
$source dronekit_env/bin/activate
$wget https://github.com/dronekit/dronekit-python/raw/master/examples/simple_goto/simple_goto.py
$python simple_goto.py --connect "udp:127.0.0.1:14551"

You can observe the behavior of the drone on the APM Planner as the code gets executed.


Monday, August 29, 2016

Drone 101

We have been lucky to be awarded with some funds to buy some drone kits. Since July, I spent my weekends playing around with the Erle-Copter assigned to me which I named Red-SRG-Bot. This kit is powered by Linux and therefore opens up a lot of possibilities programmatically. I have a presentation that documents my activities in this area and another for an extension work. Below is a video of one of our outdoor flight tests.

Monday, August 1, 2016

Writing the abstract for systems(or applications) papers

(Last update: 8 June 2024)

Writing an abstract for systems papers is easy if you know what to put in it. Begin the abstract with "This paper presents the design, implementation, and evaluation of ..", then add the following.

1. Catchy title for the system. (acronym, one word)
2. General description of the system and how it addresses a problem in a particular area. (two sentences)
3. Features/contributions that are unique or novel on the system. (three or more sentences)
4. Performance evaluation results. (two sentences)

Here's an example from this paper:
--------------
This paper presents the design and implementation of MemPipe, a dynamic shared memory management system for high performance network I/O among virtual machines (VMs) located on the same host. MemPipe delivers efficient inter-VM communication with three unique features. First, MemPipe employs an inter-VM shared memory pipe to enable high throughput data delivery for both TCP and UDP workloads among co-located VMs. Second, instead of static allocation of shared memories, MemPipe manages its shared memory pipes through a demand driven and proportional memory allocation mechanism, which can dynamically enlarge or shrink the shared memory pipes based on the demand of the workloads in each VM. Third but not the least, MemPipe employs a number of optimizations, such as time-window based streaming partitions and socket buffer redirection, to further optimize its performance. Extensive experiments show that MemPipe improves the throughput of conventional (native) inter VM communication by up to 45 times, reduces the latency by up to 62%, and achieves up to 91% shared memory utilization.
--------------

The goal of the abstract is to help the readers decide whether to continue reading the rest of the paper or not. Do your readers a favor by not wasting their time. Present what you have upfront in the abstract.

Sunday, July 31, 2016

Zotero+WebDAV

I use Zotero to keep track of papers I (need to) read and recently I ran out of space in the Zotero servers because of attachments. Luckily, Zotero allows you to sync attachments using WebDAV. All I need is to setup WebDAV on my group's server. Space problem solved!

Apache config directive:

    Alias /zotero /zotero
    <Location /zotero>
        Options Indexes
        DAV On
        AuthType Basic
        AuthName "zotero"
        AuthUserFile /etc/apache2/webdav.password
        Require valid-user
    </Location>

Graduate Study: Full-Time vs Part-Time

A lot of students ask me which is better, full-time or part-time graduate study. Full-time study would mean that the student will take courses and write a thesis without other 'work' commitments. Part-time study on the other hand allows the student to have other 'work', such as being an instructor, in addition to taking courses and writing a thesis. I have done both, my MS was part-time and, currently, my PhD in full-time.

Part Time

Advantages
  • The student earns while studying because he/she is employed.
  • The student can improve on his/her teaching skills.
  • Student may be given reduced teaching load.

Disadvantage
  • Difficult to focus on research because of teaching-related activities such as grading and meetings.
Full Time

Advantages
  • Can focus more on research and hopefully finish on time.
  • Can earn additional income if student is on study leave with pay.
  • Increased opportunity to travel because of more free time.

Disadvantages
  • Dependent on scholarship for financial support.
  • Limited opportunity to practice teaching.

Essentially, it all depends on the student. Even if a student is doing the study part-time but has good time management skills, it is possible to finish on time.

Monday, June 27, 2016

Preventing memory over commit in linux

Some programs for HPC (such as plink) tries to eat as much memory as it can using the brk() system call. In order to prevent your system from crashing due to this, set the following kernel parameters as shown:

#echo "2" > /proc/sys/vm/overcommit_memory
#echo "75" > /proc/sys/vm/overcommit_ratio

Further Reading