GCS

GCS
__TOC__
Ground Control Station
__TOC__	
!New: There is a new GCS available at https://github.com/Fabien-B/PprzGCS!
= Introduction =
The versatile Paparazzi Ground Control Station is an operator control unit ground control software for unmanned aircraft. It allows to visualize and control an unmanned aircraft during development and operation, both indoors and outdoors. With a flexible software architecture it supports multiple UA types/autopilot projects. The purpose of the Ground Control Station is real-time monitoring of an UA.
= Features = 
The Paparazzi GroundControlStation is a feature-rich application with fully customizable views, each containing a collection of the most useful interface components for a particular purpose.
* Simultaneous flying multi UAS support
* Multi-system support (multiple procotols, multiple autopilots/projects) by writing a IVY Plugin
* 2D Map capable of displaying Google Satellite, OpenStreetMaps Images and Microsoft Satellite Maps
* Mission planning 
* Realtime movable waypoints
* Realtime flightplan adjustments if needed
* System status overview
* Realtime Airframe in Air tuning and calibration
* Supports rotary and fixed-wing e.g. Airplanes, helicopters, coaxial and quadrotors
* Definable Hotkeys for quick simple in the field control
* Voice status output
* Full freely configurable GUI layout
= Configuration Options =
The GCS is highly configurable and modules can be added, removed, or resized as needed. In addition to this the GCS has many command line options which can be used when launching the GCS
See the GCS configuration page for details.
= Simulation of Flightplan =
Your flight plans can, and should, always be tested prior to a real autonomous flight. Testing end adjusting is possible from within the same GCS. See the simulation page for details.
= Options =
== Strips ==
Each A/C has an associated strip that displays information about the A/C and provides buttons for common commands. The strip has the following layout by default. Paparazzi GCS is very flexible and the strip can have more or less buttons according to your configuration.
=== Displayed information ===
* Left: Flight information
* Center: Navigation information
* Right: Navigation control
* Bottom: Custom navigation and setting buttons
=== Actions ===
Every change in the waypoints (position or/and altitude) must be confirmed with the dialog box that appears after the move. A modified waypoint remains animated on the map and the GCS continues to re-send the move request until confirmation is received from the aircraft.
When clicked, the Mark button places a mark on the map at the A/C position. A snapshot from the video plugin is associated to this mark and can be viewed by moving the mouse over the mark. A click on the mark opens a dialog box allowing to delete the mark.
A click on the colored bar at the top selects the corresponding A/C in the Notebook.
== Map ==
=== Display ===
The map display contains the following information:
* The A/C track: it can be erased via the Clear track option from the A/C menu.
* The A/C label (in clear blue near the A/C) contains the name of the A/C (Plaster), it's altitude (218 m) and it's ground speed (11.99 m/s). This option default is off. It can be activated with the A/C label option from the A/C menu.
* The carrot (the orange triangle). This is the point the A/C is following during autonomous navigation.
* The waypoints defined in the flight plan (blue diamonds).
* The intended trajectory is shown as a green line, in this example a circle around waypoint 2.
* The default background is black. Maps can be loaded to provide navigation reference.
* The camera footprint (the grey polygon) is representative of the swath of land currently seen by the onboard camera. This option default is off. It can be activated with the Cam footprint option from the A/C menu. see also Pan_Tilt_Camera
* The WGS84 coordinates of the mouse cursor are displayed at the top right hand corner (43.462019 1.270474).
* A UTM kilometric grid can be added to the background via the UTM grid option from the Nav menu.
* The height Above Ground Level (AGL) displays the ground altitude of the mouse near the geographic position in the top right hand corner. The SRTM option must be enabled in the Nav menu and the height data must be downloaded as described here. If SRTM data is not enabled and downloaded, the height above mean sea level MSL will be displayed instead.
=== Navigation ===
You can pan/zoom the map using the following:
* Pan with the blue arrows on the map or use the arrow keys on the keyboard
* zoom in/out with the mouse scroll wheel, the page up/page down buttons or the small up/down buttons at the top right hand corner where the zoom factor is displayed
* fit the map to the window, in order to see all the waypoints and A/C, with the f key or the Fit option from the Nav menu;
* center the map on an A/C with the Center A/C option from the corresponding A/C menu.
=== Map Photo Tiles ===
The default black background can be automatically filled with calibrated satellite photo tiles from Openstreetmaps, Google Maps or MS Maps. Note: If you download too much map data from Google into the GCS you may be blocked for downloading further map data for 24 hours. With OpenStreetmaps data and MS data there is no such limitation.
See the Maps page for more info.
=== Waypoint Editing ===
The properties of any waypoint in the currently loaded flight plan can be modified by two methods:
* Drag and drop the waypoints to a new location (a confirmation dialog will appear).
* A single left click on a waypoint opens a dialog box where you can edit the waypoint's coordinates and altitude.
Waypoint edits are sent to the aircraft immediately upon confirmation in the dialog box. The GCS will re-send the data and the waypoint will animate until the aircraft confirms receipt of the move request. New waypoints cannot be added during flight.
See the Flight plans and Flight Plan Editor pages for more information on waypoints.
== Notebook ==
The notebook frame contains one page for each running aircraft. Each aircraft page is itself divided into subpages displaying telemetry data and giving access to the autopilot tuning parameters.
Note that the colored tabs at the top of this section allow the user to select among multiple aircraft.
=== Flight Plan ===
The full tree of the flight plan is given in this page. The current block and the current stage are highlighted. A double-click on a block allows the operator to immediately switch navigation to this block.
See the Flight plans and Flight Plan Editor pages for more information on flight plans.
=== Settings ===
The setting page allows the operator to change variable values during flight. The layout of the page is generated from the dl_settings section of the settings.xml file, one tab is associated to every section and sub-section.
On each line is displayed (from left to right), the name of the variable, its current value (periodically sent by the A/C), a slider or radio buttons for user input, and commit/undo buttons. Also note, clicking on the current value will send a request to obtain the current value from the aircraft.
See the Telemetry page for more information on settings.
The save button of this tab opens the following popup which proposes to the user to save the current values in the airframe file (according to the param attribute in the setttings configuration file). The values of the checked rows will be saved in the airframe file (or any other file) for further use. Units (e.g. deg or rad) are taken into account. It is recommended to backup the airframe file before overwriting it with this utility (even if time-stamped copy of the airframe file is actually automatically done).
Symetrically, the Upload button of this dialog button will send all the checked values of the airframe file to the live aircraft.
=== PFD ===
The Primary Flight Display contains an artificial horizon and two scales displaying the current ground speed (left side) and the altitude (right side). Minimum and maximum speeds are shown under and above the speed scale. A click on the scale resets these values to the current speed value.
=== GPS, Infrared, Wind ===
The GPS page gives the list of satellites tracked by the receiver and their respective signal strengths in dB.
(35 is low, 45 is excellent) and if they are used to compute the fix (green: used, red:not used). This page may help to tune the position of the receiver on the aircraft relatively to other components (e.g. datalink and video transmitters).
The Infrared page is only used for aircraft not equipped with the vertical infrared sensor. This page reports the required pre-flight calibration value as well as the evolution of the in-flight calibration correction factor (from hybridization with the GPS information).
The Misc page displays the estimated wind velocity computed by the ground station during flight and relayed back to the aircraft. Wind velocity is estimated by vector addition of the GPS-measured ground speed in many different directions during level flight. This computation may soon be performed by the autopilot instead of the ground station.
== Video Plugin ==
The -mplayer option of GCS allows the user to display a video stream in this window. The video window can also be exchanged with the map by clicking anywhere inside the frame or from the menu.
Use the following line in your control panel to enable the video window.
 (paparazzi folder path)/sw/ground_segment/cockpit/gcs -mplayer rtsp://localhost:7070/video -layout appropriate_layout.xml
Note that a plugin widget must be specified in the used layout:
 <widget size="300" name="plugin"/> 
A useful example of how to configure the GCS to show video from a USB DVB-T tuner with composite input follows:
If you have an Avermedia DVB-T usb tuner like the Aver-Tv Hybrid Volar HX (Avermedia finally released Ubuntu Linux drivers)
then in order to use the usb tuner as video input to the GCS you have to complete the following steps:
First download and install the drivers and check that the Usb tuner works well by connecting a video signal to the composite input
and then opening a console window and typing: 
mplayer tv:// -tv driver=v4l2:width=320:height=240:norm=NTSC:input=1:device=/dev/video1:noaudio
Remember to change the "device=/dev/video1" in the above line with whatever your new usb tuner is registered with (if needed).
Type "dmesg" in a console immediately after you connect the usb tuner and you should see a line stating the video device your usb tuner got registered with.
If it says video0 change "device=/dev/video1" with "device=/dev/video0"
Mine is registered as "video1" because "video0" is the built in laptop camera.
If everything is ok then a blue or similar LED on the usb tuner dongle should light up indicating that the tuner driver is loaded
and you should be able to watch the video on the pc screen (no audio yet).
Now close the console and remove the Usb tuner as it is time to configure the control_panel.xml file by editing the GCS command line.
Locate the line in the "control_panel.xml" file, usually located in "/Your Paparazzi directory/conf/" (mine is in "/paparazzi/conf/"),
that starts with "<program name="GCS" command="sw/ground_segment/cockpit/gcs......".
For example let's say that the complete line looks like this: 
 <program name="GCS" command="sw/ground_segment/cockpit/gcs -layout horizontal.xml"> 
Now add the below line at the end (before the quotes) of the original line:
-mplayer 'tv:// -tv driver=v4l2:width=320:height=240:norm=NTSC:input=1:device=/dev/video1:alsa:adevice=hw.2,0:amode=1:audiorate=48000:forceaudio:volume=100:immediatemode=0'
The original line should look now like this:
<program name="GCS" command="sw/ground_segment/cockpit/gcs -layout horizontal.xml -mplayer 
'tv:// -tv driver=v4l2:width=320:height=240:norm=NTSC:input=1:device=/dev/video1:alsa:adevice=hw.2,0:amode=1:audiorate=48000:forceaudio:volume=100:immediatemode=0'"> 
The above line is one complete and uninterrupted line but it is just too long to show it in one line here.
Please remember to change the "NTSC" with "PAL" if you do not use the NTSC video system (if your airborne camera is PAL for example). 
This will load the mplayer, select the composite video input of the tuner and enable the sound input.
Read the mplayer documentation so you can tweak the resolution etc. later to suit your particular setup.
The resolution above is set to 320x240 here but you can set it to 640x480 by replacing the numbers in the command line above.
Finally you have to add the plugin widget to your GCS layout configuration file.
If you noticed the GCS command line in the "control_panel.xml" file, it has a part that reads "-layout horizontal.xml" 
so our layout configuration file is the "horizontal.xml" which is located always in "/Your Paparazzi directory/conf/gcs/" 
(mine is in "/paparazzi/conf/gcs/").
Open the file and add or uncomment the below line (in "horizontal.xml" the plugin widget is there but commented out):
<widget NAME="plugin" SIZE="300"/> 
Now the file should look like this:
 <rows>
 <widget size="500" name="map2d"/>
 <columns>
 <rows size="375">
 <widget size="200" name="strips"/>
 </rows>
 <widget size="400" name="aircraft"/>
 <widget name="alarms"/> 
 <widget NAME="plugin" SIZE="300"/> 
 </columns>
 </rows>
That's it, Enjoy!
Tested in Ubuntu 10.04 LTS but probably the same method should work fine on different versions too.
See this screen capture as an example of the resulting GCS (Y-UAV).
The -plugin option is another way to use the plugin widget: the X subwindow id is given to the provided command:
 (paparazzi folder path)/sw/ground_segment/cockpit/gcs -plugin "mplayer video_stream -wid " -layout appropriate_layout.xml
 (paparazzi folder path)/sw/ground_segment/cockpit/gcs -plugin "cvlc video_stream --drawable-xid=" -layout appropriate_layout.xml
The --vout-event=3 option can be used for vlc to disable mouse and keyboard events handling
== Altitude graph widget ==
An altitude graph can be displayed in the GCS by adding the widget altgraph in the layout configuration (See the GCS configuration page). An example is provided in conf/gcs/alt.xml. To use this layout add -layout alt.xml to the /conf/control_panel.xml file. This type of layout is more suited to a multi UAV set up. The Papget ruler is a much less intrusive and better tool when you are only flying a single aircraft.
==Papgets==
Graphical objects can be added to 2D maps: text, rule, gauge, buttons, .... These objects are named papgets. The following snapshot
shows an example with buttons (left side), gauges (lower left corner), text (upper right corner) and ruler (right side). This example
has been produced with a layout file provided in the distribution:
 .../gcs -layout papgets.xml 
===Telemetry data report===
The easiest way to create a papget displaying telemetry data is to drag&drop a message field from the Messages window onto the 2D map of the GCS. The default rendering is then a string of text. Clicking on it allows the user to change its type (currently text, ruler or gauge) and some of its attributes (color, size, range for a gauge, format for a text ...). A papget can be moved by simply dragging it.
Papgets can be saved in the layout of the GCS (from the Nav menu). The description is saved in an XML file (in conf/gcs/ folder) which can be manually edited:
 <papget type="message_field" display="gauge" x="47" y="414">
 <property name="field" value="BAT:voltage"/>
 <property name="scale" value="0.1"/>
 <property name="min" value="0."/>
 <property name="max" value="15."/>
 <property name="size" value="50."/>
 <property name="text" value="Bat(V)"/>
 </papget>
The file is used later by giving it to the gcs process:
 .../gcs -layout my_fancy_papgets.xml
===Buttons===
In the same way, user buttons from the strip can be dragged&dropped on the 2D map. However, they currently cannot be directly edited, and
attributes changes have to be done in the XML file. Two types of button are provided to jump to a block or to set a value:
 <papget type="goto_block" display="button" x="10" y="300">
 <property name="block_name" value="Standby"/>
 <property name="icon" value="home.png"/>
 </papget>
 <papget type="variable_setting" display="button" x="10" y="250">
 <property name="variable" value="launch"/>
 <property name="value" value="1."/>
 <property name="icon" value="launch.png"/>
 </papget>
===Video on Papget===
A video stream can be rendered in a video_plugin papget, using the mplayer player:
 <papget type="video_plugin" display="mplayer" x="300" y="250">
 <property name="video_feed" value="my video source"/>
 <property name="width" VALUE="320"/>
 <property name="height" VALUE="240"/>
 </papget>
or any video player which takes in option the X window id, here for example VLC:
 <papget type="video_plugin" display="plugin" x="300" y="250">
 <property name="command" value="cvlc video_source --drawable-xid="/>
 <property NAME="width" VALUE="320"/>
 <property NAME="height" VALUE="240"/>
 </papget>
===Aircraft binding===
Upto Paparazzi v5.4, Papgets could not not bound to a specific aircraft. This had the effect that it will work with any of them, and when multiple aircraft are flying the display of messages is mixed and the buttons will send command or settings to all active aircraft.
Since Paparazzi v5.6, Papgets are bound to a single aircraft, which means that they can safely be used with several active aircraft. It is also possible to add a property to the GCS layout file to specify the aircraft ID:
 <property name="ac_id" value="10"/>
Valid IDs are from 1 to 255 (0 being reserved to GCS). When this property is not defined, the Papget will bind to any aircraft like before. This can be useful if you intent to build a generic layout. When saving a layout from the GCS, if their are some Papgets to save, a question box will prompt the user to ask if the ac_id property should be saved or not.
===Papget Development===
Graphical appearence of papgets is defined in sw/lib/ocaml/papget_renderer.ml. A renderer must implement the Papget_renderer.t class type interface (canvas_text is probably the simpler example) and listed in the renderers list to be available
in the edit popup box.
The XML configuration is parsed in sw/ground_segment/cockpit/papgets.ml: a new created papget identifier must listed here.
== Alarms ==
The alarm window displays a list of recent errors such as:
* Low battery warning
* Low altitude warning
* Autopilot mode changes (i.e. Manual, Auto2)
* Flight plan block changes
These alarms can be provided via the speaker using the speech function.
== Airframe Specific GCS Customizations ==
Items related to the aircraft icon, altitude shift values, speech id, and the overall icon theme of the GCS can be customized in each aircraft's airframe configuration file GCS section.
=Related Links=
* Getting the GCS running on a Gumstix board
* Getting the GCS running on a Raspberry Pi board
* PPRZonDroid: a Remote GCS Android application
Category:Software Category:GCS Category:User_Documentation