POW

From PaparazziUAV
Jump to: navigation, search
logo Paparazzi On the Web

POW means Paparazzi On the Web. This software package provides a web interface for Paparazzi users. The application allows to watch and pilot a drone on a web browser via Internet. Current realease is version 2.0.

Presentation

The system is mainly based on Java technology. It is divided in 3 parts : one running on the ground station, and the others on a server machine.

Pow general overview.png

Server Side

A web server does the link between Paparrazi drones and web users. Data coming from drones are just reformatted by the server and sent to the different web users. The interface that web users have on their browser is a simple html and Javascript page hosted by the server. There is also a mysql database running on the server. This database is used mainly for logging purposes. In a future version, the database will be used to replay a flight sequence.

On Paparazzi side

Paparrazi drones are connected to the server via a software bus named ivy and a java application.This application listens to messages broadcasted on the Ivy bus and send them to a server via an udp channel. The udp channel is secured with an AES encryption. An web user connected to POW can be either an administrator, a authorized user or a visitor :

  • a authorized user can watch all the drone on the map and pilot some drones.
  • a administrator user can watch all the drone on the map, pilot all the drones and manage user accounts.
  • a visitor can only watchs the drones on the map.

How to get POW source code ?

It is available on github : pow repo

  • The source for the ivy client (link between Paparazzi and Internet). You have to get those 2 files :
    • pow_ivyclient.jar
    • InstallCert.java
  • The source for the server (relay on the ground station). You have to get those 2 files :
    • pow_sql_maker.sql
    • ServletPow.war

Installation of the POW server

Setup Tomcat 6

  1. You have to install 2 package : tomcat6 and tomcat6-admin : sudo apt-get install tomcat6 tomcat6-admin
  2. Then you have to create an admin account in /etc/tomcat6/tomcat-users.xml .You just have to insert following lines :
    <role rolename="manager"/>
    <role rolename="admin"/>
    <user username="yourlogin" password="yourpassword" roles="admin,manager"/>
  3. Add or uncomment the line in /etc/tomcat6/server.xml to activate the connector that listen to apache (this will open the port 8009; change this value accordingly to your workers.properties settings):
    <Connector port="8009" redirectPort="8443" protocol="AJP/1.3" />
  4. Restart the server with sudo /etc/init.d/tomcat6 restart
  5. You can now access the 'Hello World' page : http://localhost:8080
  6. To install the server application, just open the admin page of the server : http://localhost:8080/manager. Now you just have to deploy the site which is packed into the file ServletPow.war
  7. Now you are able to access to the login page of the web site : http://localhost:8080/ServletPow

Setup Apache 2

  1. You have to install Apache2 package : sudo apt-get install apache2
  2. Now you can access to the 'Hello World' page via http://localhost

Link between Apache 2 and Tomcat 6

To link both servers, you have to setup a connector on the apache server named mod jk. It will redirect all the web request targeting our web site from the Apache server to the Tomcat server.

  1. you have to install 2 package : sudo apt-get install apache2-mpm-prefork libapache2-mod-jk
  2. In /etc/apache2/mods-available, you have to create a jk.load file if it doesn't exist with the following content :
    LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
    JkWorkersFile /etc/apache2/workers.properties
  3. In /etc/apache2, you have to create a workers.properties file if it doesn't exist with the following content :
    workers.tomcat_home=/usr/share/tomcat6
    workers.java_home=/usr/lib/jvm/java-6-sun
    ps=/
    worker.list=worker1
    worker.worker1.port=8009
    worker.worker1.host=localhost
    worker.worker1.type=ajp13
    worker.worker1.lbfactor=1
    Be sure that the path to tomcat6 and java match your installation.
  4. Now you have to activate the module and restart the Apache server :
    • sudo a2enmod jk
    • sudo /etc/init.d/apache2 restart

An other tutorial can be found here.

Enabling SSL features

To enabling SSL features you have to follow 2 steps :

  1. create a SSL certificate with the command :
    sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -out /yourSSLfolder/server.crt -keyout /yourSSLfolder/server.key
    that create to files in yourpath folder : server.crt and server.key. You will be prompt for various information but the ones that really matters is the common name (CN). Be sure that you put in common name, the domain name of your server machine as it will be access via internet (ex : yourmachine or www.pow.fr).
  2. enable the module with : sudo a2enmod ssl

Configuring the web site for Apache

So that the web site was accessible via Apache, we now have to setup a virtualhost.

  1. To do that you have to insert into a file pow_ssl.conf the following lines :
    NameVirtualHost *:443
    <VirtualHost *:443>
    ServerAdmin admin@pow.fr
    ServerName yourmachine
    LogLevel warn
    CustomLog /var/log/apache2/access.log combined
    ServerSignature On
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
    SSLCertificateFile /yourSSLfolder/server.crt
    SSLCertificateKeyFile /yourSSLfolder/server.key
    SSLCACertificatePath yourSSLfolder
    SetEnvIf User-Agent ".*MSIE.*" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
    JkExtractSSL On
    JkOptions +FlushPackets
    JkOptions +FlushHeader
    JkMount /ServletPow worker1
    JkMount /ServletPow/* worker1
    </VirtualHost>
    Be sure you set yourmachine (www.pow.fr) and yourSSLfolder parameters in accordance with your installation.
  2. Then you have to restart Apache : /sudo /etc/init.d/apache2 restart'

Setup MySQL

  1. 1nstall mysql on your server, you have to install the mysql-server package : sudo apt-get install mysql-server
    You will be prompt to enter a password for the root user.
  2. Thanks to this password you can access to the mysql_client with mysql -u root -p.
  3. Create the database for POW with the command source yourRealPath/pow_sql_maker.sql where pow_sql_maker.sql is the script which creates the database.

Now you have created a mysql user that can only access to the pow_sql database :

  • login : pow_user
  • password : pwdpow_user

Configuring the Application

When you have installed all these stuffs, your server installation is now almost complete. The web interface is designed around a Google maps V2. In order to use it in your own website you have to ask a key to Google via http://code.google.com/intl/fr/apis/maps/signup.html. The key you will get has to be inserted in the Interface.jsp code that you will find in /var/lib/tomcat6/webapps/ServletPow/Interface.jsp.
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAZYVipVs4ERk_pG9XD17RUBRdUwZHIVFpQVMTarh_2qCLzSnEFBTiIKoSzrMnmbmHfo-XJ2g7sM1QUg" type="text/javascript">
Now it's really finished !
Three accounts have been created:

  1. An ivy client account (login:admin_ivy and password:pwdadmin_ivy) to connect a Paparazzi system to the server.
  2. A web user client account (login:admin and password:pwdadmin) which has got the administrator rights. This administrator can create users via the admin page accessible on the web interface.
  3. A mysql account so that the server could access to mysql database (login:pow_user and password:pwdpow_user).

To configure the application with your own parameter you can edit the configuration file (/var/lib/tomcat6/webapps/ServletPow/conf/pow_conf.xml)

Starting the server

Now to validate your installation , restart both Tomcat and Apache.
You should now access to the web site via https://yourmachine/ServletPow and have the following page on your browser.

web user login interface

Be sure that udp ports (8535 and 8536 by default) are reachable from the internet, otherwise the Paparazzi client will not be able to send data to the server.

Installation On each Paparrazi system to connect to Internet

You need to have Paparazzi installed. That won’t be detailed here, I think you can find the instructions by yourself on this site. To Install the java programm which connects Paparazzi to the server, there are two steps to follow :

  1. Fetch the SSL certificate of the server
    • compile and launch InstallCert.java with the name of server as a parameter (ex : java InstallCert www.pow.fr).
    • That creates a file named jssecacerts that you have to copy into your jvm security folder (/usr/lib/jvm/java-6-xxx/jre/bin/security)
  2. Launch the module : you just have to start it with the command java -jar pow_ivyclient.jar.
ivy client ihm

The following fields have to be completed:

  • hostname : the name of the pow server (yourmachine or www.pow.fr)
  • login : ask the administrator of the server to have them.
  • password : ask the administrator of the server to have them.

The folowing fields are visible only if you press the More button and should normally not be changed.

  • site name : the name of the webapplication on the server (only if you change the original configuration).
  • servlet name : the name of the servlet which manage the login process (only if you change the original configuration).
  • port : a specific port to connect to the server (only if you change the original configuration).
  • protocol : a specific protocol to connect to the server (only if you change the original configuration).

The web Interface

pow interface

Some clues about how that it works

  • The application is designed around a Pushlet Framework (see http://www.pushlets.com). That allow data to be pushed by the server to all web clients without any request from web client. It based on a subscriber/publisher pattern. When a web client is connected to the server. It subscribes to a subject and then, all data related to this subject are sent directly to the user by the server (the publisher). Thus data are not to be store on the server. It's almost like streaming.
  • Inside the server we use Java Servlet Technology, that's why we use a Tomcat server.
  • On the interface you can see some of JQuery capabilities (the tabs and the sliders). To get more see http://jqueryui.com.