Qwip

From PaparazziUAV
Jump to navigation Jump to search

QWIP, a Quick Web Interface for Paparazzi

Introduction

The qwip software is a simple collection of software that presents a basic ground station interface in a web browser.

Various groundstation elements

  1. Position on map (googlemaps api)
  2. Battery level
  3. flight time
  4. RC status
  5. datalink settings

Modes

It can operate in two modes :

  1. boa and qwip run on Lisa/Overo (primary motivation for this project)
    1. In this configuration the qwip "server" sw running on overo communicates with the stm32 autopilot.
  2. boa and qwip run on PC groundstation
    1. Here the qwip software attaches to the ivy bus to get aircraft info\

In either case, the "server" software places data in a shared memory area for a boa cgi program ("update_qwip") to access. The cgi program is accessed by the browser javascript code.

Remote ground stations

Finally, the qwip "server" can communicate with remote ground stations (paparazzi ocaml-based servers) to become aware of additional aircraft and display them to the browser user.

Quickstart

PC-based installation and usage

  1. sudo apt-get install libevent-dev
  2. install boa and enable configuration in boa.conf (cgi, etc)
  3. place qwip sw in /var/www or use links, etc (mindful of permissions)
  4. take a look at makefile and edit hardcoded paths to point to the right places
  5. take a look at source and make sure hardcoded aircraft names/paths available

Compile and Run server

build pc_gs_server

paul@paul-Inspiron-1210:/var/www$ make server/pc_gs_server
cc -Wall -std=gnu99 -I/home/paul/paparazzi -I/home/paul/paparazzi/sw/include `pkg-config glib-2.0 --cflags`  -DDISABLE_SPI_LINK -DFMS_PERIODIC_FREQ=512 server/gs_server.c server/gs_shm.c server/qwip_gs_link.c server/qwip_settings.c /home/paul/paparazzi/sw/airborne/fms/fms_spi_link.c /home/paul/paparazzi/sw/airborne/fms/fms_periodic.c /home/paul/paparazzi/sw/airborne/math/pprz_geodetic_double.c -o server/pc_gs_server -lm -levent  `pkg-config glib-2.0 --libs` `pcre-config --libs`
server/gs_server.c: In function ‘main_init’:
server/gs_server.c:77: warning: passing argument 1 of ‘g_strlcpy’ from incompatible pointer type
/usr/include/glib-2.0/glib/gstrfuncs.h:109: note: expected ‘gchar *’ but argument is of type ‘char (*)[128]’
server/gs_server.c:85: warning: passing argument 1 of ‘strcpy’ from incompatible pointer type
/usr/include/string.h:128: note: expected ‘char * restrict’ but argument is of type ‘char (*)[128]’

build ivy_gs_gateway

paul@paul-Inspiron-1210:/var/www$ make server/ivy_gs_gateway
gcc -Wall -std=gnu99 -I/home/paul/paparazzi -I/home/paul/paparazzi/sw/include `pkg-config glib-2.0 --cflags` server/ivy_gs_gateway.c server/gs_shm.c /home/paul/paparazzi/sw/airborne/math/pprz_geodetic_double.c -o server/ivy_gs_gateway `pkg-config glib-2.0 --libs` `pcre-config --libs` -lglibivy -lm
paul@paul-Inspiron-1210:/var/www$ cd server/
  1. run pc_gs_server
cd server
paul@paul-Inspiron-1210:/var/www/server$ ./pc_gs_server 
Starting initialization
fms_periodic : hs sched_setscheduler failed : Operation not permitted (1)
gs server listening on port 4343
fms_periodic : hs sched_setscheduler failed : Operation not permitted (1)
Entering mainloop
  1. If you need to kill off the shared memory area
run ipcs to find it
look for a line with 0x2b at the start (this is the shared mem key in hex)
0x0000002b 37453850   root       777        7116936    0      
kill it with "sudo ipcrm -m 37453850"


Testing CGI


paul@paul-Inspiron-1210:/var/www/cgi-bin$ export QUERY_STRING="req=fleet"
paul@paul-Inspiron-1210:/var/www/cgi-bin$ ./update_qwip
Content-type: application/xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<content>
  <time_running>1396 s</time_running>
  <aircrafts>
    <aircraft name="Microjet"/>
  </aircrafts>
</content>

paul@paul-Inspiron-1210:/var/www/cgi-bin$ export QUERY_STRING="req=flight_param"

paul@paul-Inspiron-1210:/var/www/cgi-bin$ ./update_qwip
Content-type: application/xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<content>
  <time_running>0 s</time_running>
  <cpu_time>0.0 s</cpu_time>
  <supply>0.0 V</supply>
  <radio_control>ok</radio_control>
  <latitude>0.0000000</latitude>
  <longitude>0.0000000</longitude>
</content>

Testing with browser

  1. open a browser and point it to "localhost"

(see image at top)

check boa logs for errors and access

tail -f /var/log/boa/access.log
tail -f /var/log/boa/error.log

127.0.0.1 - - [08/Feb/2011:23:38:46 +0000] "GET /cgi-bin/update_qwip?req=fleet HTTP/1.1" 404 0 "http://localhost/" "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Ubuntu/10.10 Chromium/9.0.597.84 Chrome/9.0.597.84 Safari/534.13"