Autonomous vehicle on a budget using APM:Rover (ArduRover)

There is a significant amount of innovation and product realisation around autonomous vehicles in agriculture (both aerial and ground). E.g. the Spirit autonomous tractor and Project Ursula.

It is not only the commercial world that has taken to this technology. There is a whole open source DIY community focused on building autonomous vehicles. Although not specifically aimed at agriculture, DIY Drones along with it’s partner 3D Robotics has developed hardware and software capable of controlling unmanned planes, …copters and rovers. The beauty of this is that the software is essentially free and the hardware is reasonably priced and readily available. Also, there is a community that is openly discussing and evolving the project so it is relatively easy to troubleshoot and learn a bit of what goes on behind the scenes.

A few months ago I took the plunge and ordered the hardware needed to build an autonomous vehicle. I designed and built a small rover that uses two 500W electric motors as it’s ‘powerhouse’. It works with tank style steering. It is essentially a large remote controlled car. The ArduPilot Mega (APM) sits between the remote control receiver and the motor controller (Sabertooth 2×60). The APM has an internal compass, external GPS and an external radio transmitter/receiver.

Using the Mission Planner software you can set waypoints that the rover follows. The rover’s GPS position, speed and other information can be monitored from within the Mission Planner software as the rover completes it’s mission.

I have put together a small video that shows the basic operation of the autonomous vehicle.

Autonomous Vehicle Project from bboughton on Vimeo.

The question you are probably asking is ‘Why is this significant?’ or ‘Whats the point?’. The answer is that it is part of the next step in agriculture. Queensland University of Technology (QUT) is involved in similar research. Imagine a fleet of small autonomous vehicles sent to patrol the summer fallows to keep them weed free. For me, building a simple autonomous vehicle of my own shows that the technology exists, it is not that expensive and commercially, shouldn’t be to far away.

My next steps are to use sonar sensors to implement object avoidance. Further down the track I will think about mounting a camera or some other sort of sensor to collect data.

The rover's path can be set inside the Mission Planner software.
The rover’s path can be set inside the Mission Planner software.

http://rcm-na.amazon-adsystem.com/e/cm?t=agma-20&o=1&p=8&l=as1&asins=B00ED372QU&ref=tf_til&fc1=000000&IS2=1&lt1=_blank&m=amazon&lc1=0000FF&bc1=FFFFFF&bg1=FFFFFF&f=ifr

Setting up QGIS for Precision Agriculture GIS: Free Software

QGIS rivals ArcGIS as desktop GIS software especially within Precision Agriculture. The difference is that QGIS is Open Source and therefore free to use for personal and commercial use. Open Source has many other advantages. If you are familiar with ArcGIS you should give QGIS a go.

If you run Windows I recommend installing using the OSGeo4W installer. Run the ‘Desktop Express Install’.

‘Out of the box’ QGIS is very capable. But it is not until you install a few powerful plugins that it’s real potential is revealed. So far the plugins I use on a daily basis are: SEXTANTE and Table Manager. SEXTANTE is not much good to me without SAGA. Together these make available a comprehensive list of common Vector and Raster GIS algorithms. Optionally install TauDEM and Orfeo (I have installed these but not yet used them).

Setting up SEXTANTE in QGIS 1.8 (Windows 7 & 8)

Install Sextante Plugin (In QGIS: Plugins > Fetch Python Plugins).

So SEXTANTE has access to the SAGA algorithms it needs to be downloaded and installed: SAGA.

Configure SAGA in SEXTANTE (In QGIS: Analysis > SEXTANTE options > SAGA), insert SAGA folder and check Activate box.

Similar to SAGA, download and install TauDEM 5.0.6 & MPICH2 (make sure you follow install instructions on the download page).

Configure TauDEM in SEXTANTE (In QGIS: Analysis > SEXTANTE options > TauDEM), insert MPICH2 bin directory, TauDEM command line tools folder and check Activate box.

Install Table Manager

Plugins > Fetch Python Plugins

Search for Table Manager and click Install.

With these two plugins, especially SEXTANTE, QGIS becomes extremely capable.

SEXTANTE with SAGA in QGIS 1.8

http://rcm-na.amazon-adsystem.com/e/cm?lt1=_blank&bc1=FFFFFF&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=agma-20&o=1&p=8&l=as1&m=amazon&f=ifr&ref=tf_til&asins=178216748X

My first QGIS plugin: BigButtons

I’ve recently started playing around with QGIS plugins on my Windows 8 (and 7) machines. After working through the initial process which I discussed here I had a go at making my own (very) simple plugin.

The purpose of the plugin was to allow easy access to zoom and pan functions for a touch screen laptop such as my Panasonic Toughbook.

I use the BigButton plugin in conjunction with QGIS Tracker and OpenLayers. I mounted a GPS on a quad bike with my Toughbook and went out to record a trip with live Google Maps underneath. This worked to a point.

Warning: Using these three plugins together is riddled with bugs. Just the ones I notice from 10 minutes use include:

  • BigButtons will not work properly while QGIS Tracker is Tracking GPS Location as it is programmed to keep the marker centered. Once tracking is stopped BigButtons functions as normal.
  • As the marker direction from QGIS Tracker changes in reference to the GPS bearing the Google Satellite from OpenLayers plugin will go white underneath.
  • BigButtons ‘Cycle Layer’ currently only works if you have all layers in a single group – and even then can do some strange things – needs work!

Download QGIS Plugin tested on Windows with QGIS 1.8: BigButtons-Experimental

Photo of my quick and dirty GPS setup on quad bike:

Creating Python QGIS Plugins in Windows 8

After being fresh out of Udacity CS101 – Computer Science course I wanted to put my new Python skills to use. QGIS supports plugins programmed in Python so I thought I would give that a go. What I realised is that there is a missing link between an introduction to programming and how to apply it! After several hours I was able to complete a simple plugin and get it working, with a GUI – all in Windows 8.

Here are the steps I followed:

1. Install QGIS 1.8 using OSGeo4W. Select ‘Express Desktop Install’. I installed all packages even though we won’t be using them all. It is worth having.

2. Download and Install Monkey Studio IDE.

Optional: Download QGIS APIs for auto-complete. You can add these to Monkey Studio by going to Edit > Settings. In ‘Source APIs’ select Python as language and add all the .api files. I sources these files here but stored them on my server in case the drop box goes missing.

3. The first Plugin I made was called Zoom to Point. I used instructions from a book excerpt available here. Chapter 15 – GIS Scripting, starting at page 270.

I was able to follow the instructions with the following additional tips:

  • Windows 8 QGIS plugin directory is located at

C:Users[username].qgisPythonPlugins

  • QT Designer is built into Monkey Studio. When you need to edit ui_zoomtopoint.ui launch Monkey Studio, then open this file to edit it.
  • Run the command line commands in the OSGeo4W console which should be on your desktop from Step 1. Navigate to your plugin directory e.g.

cd C:Users[username].qgisPythonPluginsZoomToPoint

pyrcc4 -o resources.py resources.qrc

pyuic4 -o ui_zoomtopoint.py ui_zoomtopoint.ui

  • On page 284-285 there is code which you will need to copy over to your zoomtopoint.py file. For me lines 41 and 42 produced an error. I was able to fix this by replacing them with:
41     x = dlg.ui.xCoord.toPlainText()
42     y = dlg.ui.yCoord.toPlainText()
  • In the file zoomtopoint.py (around line 27) I changed ‘import resources_rc’ to ‘import resources’. Otherwise I get an error in QGIS.
  • Every time you make a change to your plugin you need to restart QGIS. There is a plugin called Plugin Reloader that speeds this up allowing you to reload plugin with restarting QGIS.
  • Be very careful manually copying code. Most of my errors came from incorrectly copying code!

I hope that saves some others a few hours starting out. I have just scratched the surface and am looking forward to building some handy QGIS plugins as time allows.

Some more tips as I go:

  • For some reason if I create my Class name (ie when creating plugin template in Plugin Builder) in all lower case it does not build properly with pyuic4. If you have this same problem try using CamelCase and see if that makes a difference – it did for me.