DecaPDOARTLS PC Source Code Guide
DecaPDOARTLS PC Source Code Guide
TABLE OF CONTENTS
1 INTRODUCTION ........................................................................................................................................ 4
2 DECA-PDOA-RTLS APPLICATION OVERVIEW ............................................................................................. 8
2.1 RTLSDISPLAYAPPLICATION CLASS ................................................................................................................... 8
2.2 SERIAL CONNECTION CLASS ............................................................................................................................ 9
2.3 RTLS CLIENT CLASS ...................................................................................................................................... 9
2.3.1 Location Display Function ............................................................................................................. 10
2.3.2 Range and Phase Difference Report Format ................................................................................. 10
2.3.3 Tag Discovery Report Format........................................................................................................ 11
2.4 MAIN WINDOW ......................................................................................................................................... 11
2.4.1 Graphics ........................................................................................................................................ 11
2.4.2 Connection widget ........................................................................................................................ 12
2.4.3 Status bar ...................................................................................................................................... 12
2.4.4 View settings ................................................................................................................................. 13
2.4.5 Minimap view ............................................................................................................................... 14
2.4.6 Drop down menus ......................................................................................................................... 14
2.5 WIDGETS AND VIEWS ................................................................................................................................. 16
2.5.1 Graphics View ............................................................................................................................... 16
2.5.2 Graphics ........................................................................................................................................ 17
2.5.3 Minimap ........................................................................................................................................ 17
2.5.4 View Settings ................................................................................................................................ 17
2.6 TOOLS AND UTILITIES.................................................................................................................................. 17
2.6.1 Abstract Tool ................................................................................................................................. 17
2.6.2 Origin Tool .................................................................................................................................... 17
2.6.3 GeoFence Tool............................................................................................................................... 18
2.6.4 Rubber Band Tool .......................................................................................................................... 18
2.6.5 Scale Tool ...................................................................................................................................... 18
2.6.6 QProperty Model .......................................................................................................................... 18
3 QT SDK INSTALLATION GUIDE ................................................................................................................ 19
4 BIBLIOGRAPHY ....................................................................................................................................... 21
5 DOCUMENT HISTORY ............................................................................................................................. 21
6 FURTHER INFORMATION ........................................................................................................................ 22
LIST OF TABLES
LIST OF FIGURES
DOCUMENT INFORMATION
Disclaimer
Decawave reserves the right to change product specifications without notice. As far as possible changes to
functionality and specifications will be issued in product specific errata sheets or in new versions of this
document. Customers are advised to check the Decawave website for the most recent updates on this
product
Decawave products are not authorized for use in safety-critical applications (such as life support) where a
failure of the Decawave product would reasonably be expected to cause severe personal injury or death.
Decawave customers using or selling Decawave products in such a manner do so entirely at their own risk
and agree to fully indemnify Decawave and its representatives against any damages arising out of the use of
Decawave products in such safety-critical applications.
1 INTRODUCTION
This document describes the Deca-PDoA-RTLS application and its source code. The application
connects to the PDoA node (running the PDoA node application), and consumes the range and phase
difference (PD) and x,y position reports coming from the PDoA node and plots tag’s location
estimate as seen from the node’s point of view. Figure 1 shows the demo system.
The reader is encouraged to read the accompanying PDoA Evaluation kit documents, in particular
the PDoA-Node Source Code Guide [1], PDoA-Tag Source Code Guide [2].
PDOA
Node
Deca-PDOA-RTLS application
Tags
The Deca-PDoA-RTLS application is built with the Qt framework. Section 3 Qt SDK Installation Guide
describes how to set up and build the project.
The RTLSDisplayApplication class is the singleton class which handles the application and its main
parts are:
• Main window (_mainWindow see 2.4) – this is the application’s main user interface, it
contains:
o Drop down menus: View and Help
o The main display area which shows position of tags and the node on a floor plan
(Graphics Widget->scene see 2.4.1.2).
o Table with list of known and discovered tags and their configuration (Graphics
Widget->tagTable see 2.4.1.1)
• Serial connection (_serialConnection see 2.2) – this is used to establish and monitor
Virtual COM port connection with the node over the USB.
• RTLS client (_client see 2.3) – this processes the range, PDoA and x,y report messages
from Virtual COM port connection, and sends location estimate to the main display
(Graphics Widget).
• Configuration (_viewSettings see 2.4.4) – used for the general application and
floorplan/view configurations
© Decawave 2018 Confidential API-Deca-PDoA-RTLS-GUI-Source-Code-Guide-1.1 Page 4
DECA-PDOA-RTLS SOURCE CODE GUIDE
• Loading and Saving osf the tag and display parameters and configurations
These are described in more detail in the following chapters, whereas the Figure 2 gives overview of
the main functional blocks. Table 2 gives the list of all the source files and their brief descriptions.
RTLSDisplay Application
Connection Widget
RTLS Client
Menus
tagGra
phics
The RTLSDisplayApplication class is a singleton class which handles the Deca-PDoA-RTLS application.
This class is called from main.c. It initialises the application and its parts:
• the _serialConnection is used for managing the COM port connection
• the _client consumes the data received over the COM port connection and sends the
calculated location estimation data to the graphical display (graphicsWidget) part of the
_mainWindow
• _mainWindow also holds the various other GUI parts: connection widget (_cWidget),
statusBar, _viewSettings_w (configuration); dockable widgets: viewSettings_dw and
minimap_dw) and menu items (viewMenu, helpMenu),
• the _viewSettings is used to hold many properties about the view, such as the grid and
viewplan settings for configuration of the graphical display.
When built in Release mode, the application will automatically try to connect to the PDoA node. If
the COM port connection fails the user will be prompted to close the application or try again. If the
COM port connection is successful, the application will then open the Main window (_mainWindow)
and finish configuration / initialisation of all of its parts. As part of initialisation the configuration
files, if present, will also be loaded.
The Serial Connection class is used to establish and monitor the COM port connection to the PDoA
node. When the Deca-PDoA-RTLS application is started it will scan all of the COM ports available in
the system (PC) and check which ones reply to “deca$”. If the reply contains “Node” string (see
function findSerialDevices()) the application will add the COM port to an PDoA Node ports list. I.e.
for each found COM port the Serial Connection will send “deca$” string and if the returned string
matches JSON format:
JS0089{"Info":{
"Device":"PDoA Node",
"Version":"4.1.0",
"Build":"Oct 26 2018 11:03:34",
"Driver":"DW1000 Device Driver Version 04.01.01"}}
ok
the COM port will be added to the list of PDoA Node ports (_ports).
When the application is built in Release mode the Serial Connection will then connect to the 1st
COM port in the list (see function openConnection()), automatically (without any user interaction).
For the connection to be successful the PDoA node needs to be already plugged into the PC, and its
port enumerated. Firstly, the Serial Connection sends “stop” command, followed by “deca$”
command. If it receives the correct JSON Info string, it will pass all future the COM port data
processing to the RTLS client.
As part of connection the Serial Connection will also start a periodic 30 s timer, which will send
“getDlist” command to request a list of any newly discovered tags to the GUI, so that the tag table
can be updated. For details of these commands please see PDoA Node Source Code Guide.
The GUI COM port Connection state can be: Disconnected, Connecting, Connected or Connection
Failed.
The RTLS Client class is used to process the incoming data on the COM port and send the calculated
tag’s location to the graphical display (graphicsWidget). It will also send details of any newly
discovered tags to the graphical display to update the tag’s table.
On connection to the PDoA node, the RTLS client class will initialise its data structures and open a log
file (./Logs/yyyyMMdd_hhmmssPDoARTLS_log.txt). It will then assign the COM port data handler to
itself, and from then on, all the data received from the COM port will be handled by the RTLS client
only. It will also request from the node a list of known tags (“getKlist”), and issue a “node 0”
command which will enable PDoA node to range to any known tags.
_serial = RTLSDisplayApplication::serialConnection()->serialPort();
connect(_serial, SIGNAL(readyRead()), this, SLOT(newData()));
For each range and PD report received (a JSON “TWR” object) the application will extract the report
data and calculated X and Y coordinates of the tag’s location. The tag’s location estimate (x and y
coordinates) will then be sent to the graphical display (graphicsWidget) to update tag’s position on
the application display window. The node is always placed on 0,0 2D-coordinate and the tag’s
© Decawave 2018 Confidential API-Deca-PDoA-RTLS-GUI-Source-Code-Guide-1.1 Page 9
DECA-PDOA-RTLS SOURCE CODE GUIDE
position will be drawn “under” the node (± 90⁰), as shown in Figure 3. The JSON TWR output is as
shown:
JS006A{"TWR": {"a16":"4096","R":53,"T":5126,"D":112,"P":-
161,"Xcm":112,"Ycm":0,"O":336,"V":0,"X":0,"Y":0,"Z":0}}
When the logging is enabled the RTLS client will log the serial port data (TOF, PDoA, X and Y
coordinates) as well as the calculated positions. The logging can be stopped by pressing the “Stop
Logging” button, a new log file can be started by pressing “Start Logging” button on the applications
configuration window.
Upon the reception of JSON range and PDoA report, the RTLS client extracts tag’s location (x and y
coordinates) and sends a signal to the graphicsWidget to updated tag’s location on the display
window.
The PDoA node sends range, PDoA and other tag data as a JSON “TWR” object over the COM port.
The format of which is, as shown in Figure 4:
{ “TWR”:
{ “a16” : “aaaa”, “R” : “rrr”, “T” : “ttt”, “D” : “ddd”, “P” : “ppp”, “Xcm”:xxx, “Ycm”:yyy, “O” : “o”, “V”
: “v”, “X” : “x”, “Y” : “y”, “Z” : “z” }
}
Figure 4: Example Teraterm window showing the JSON “TWR” info sent via COM port
The PDoA node will output a list of tags which are part of its network and also any newly discovered
tags as a reply to “getKlist” and “getDlist” commands. (For more information on this please see the
PDoA Node Source Code Guide [1]).
{"DList": ["addr64_t1","addr64_t2","addr64_t3"]}
{"KList": [
{ “slot” : “1”, “addr64” : “t0 64-bit”, “addr16” : “t0 16-bit”, “multFast” : “1”, “multSlow” : “2”,
“mode” : “1”},
{ “slot” : “2”, “addr64” : “t1 64-bit”, “addr16” : “t2 16-bit”, “multFast” : “1”, “multSlow” : “2”,
“mode” : “1”},
]}
The RTLS client will parse the JSON tag data and update its tag array structures and send the tag
information to the graphicsWidget to update the tag information in the tag table.
The Main window is a class that contains the drop down menus, main display area, tag information
table and other information and control widgets as described in the sections below:
2.4.1 Graphics
The graphical display (graphicsWidget) part of the _mainWindow which holds the various GUI parts
namely these are Tag and PDoA node table pane, the display pane. The display pane consists of
Graphics View which has visible rectangle to keep track of the visible rectangle 2.5.1 and tools 2.6
which operate on it and the Grid Layout.
The Tag table is a Qt Table widget, part of the graphicsWidget. It contains Tag’s ID, position
information and range measurements, as shown in Figure 5.
© Decawave 2018 Confidential API-Deca-PDoA-RTLS-GUI-Source-Code-Guide-1.1 Page 11
DECA-PDOA-RTLS SOURCE CODE GUIDE
• Tag ID/Label:
o The checkbox is used to display the label beside the tag in the display panel
o The tag label can be changed by double-clicking on the label name and editing the
label field. The default name is the 64-bit ID of the tag
• Joined:
o Check this to enable this tag to join the network of the current node
• X (m)
o Horizontal position from the node
• Y (m)
o Vertical position from the node
• Range (m)
o Displays the range from this tag to the node
• Use IMU
o If checked, the accelerometer is used to detect stationary or non-stationary mode.
o If stationary, the circle of the tag on the display changes to an empty circle. The
location rate drops down to 0.1 Hz
o If non-stationary, the location rate reverts to the fast rate that is selected in the pull-
down menu
• Fast rate (Hz)
o The default location rate to use when moving, or if the ‘Use IMU’ is not checked,
when stationary too
The display pane has a _scene (QGraphicsScene) element, it provides a surface for managing a large
number of 2D graphical items. It is the _scene part of Graphics View 2.5.1. When the graphical
display widget (graphicsWidget) receives data from the RTLS client it will:
The Connection widget contains the Serial Connection (COM port) configuration options. This widget
is hidden from the user (when the application is compiled in Release mode) and the RTLS application
connects automatically to 1st found PDoA node COM port.
The View settings widget contains three Tabs: Configuration, Floor Plan and Grid.
The Configuration tab contains three groups of application configuration options and settings:
1. Phase Calibration: this is used to calibrate the 0⁰ phase offset.
2. Function Options: here user can select filtering option
3. Display Options: here the user can select to display the tag history. Use full screen to display
PDoA node and the tag, and also enabled or disable logging.
The Floor Plan tab contains the floor plan image loading and configuration options as shown in Figure
8 and described in 2.5.4.
The Grid tab contains the grid configuration options as shown in Figure 8 and described in 2.5.4.
The Geofencing tab contains the geofencing configuration options as shown in Figure 6Figure 8 and
described in 2.5.4. The geofencing area is shown in Figure 7.
The Minimap view widget allows the user, by using the mouse, to select different regions of the
floorplan to be displayed in the main scene. It is only operational if a floorplan has been loaded. Š
There are two drop down menus: View and Help. These are described below:
2.4.6.1 VIEW
• View Settings – selecting this will open a view configuration widget. This allows the user to
upload a floor plan and specify the grid, X and Y axis scale and origin positions: -
o Configuration tab:
© Decawave 2018 Confidential API-Deca-PDoA-RTLS-GUI-Source-Code-Guide-1.1 Page 14
DECA-PDOA-RTLS SOURCE CODE GUIDE
o Grid tab:
o Geofencing tab:
• Minimap – selecting this opens a Minimap widget, which shows the loaded image and the
zoomed in area (which is shown in the Main Display Area window).
2.4.6.2 HELP
• – this opens the “About” window which provides information on the revision of the client.
The Deca-PDoA-RTLS application has a number of Widgets and View classes they are used to display
the data, and allow user to change/configure the various parameters.
The Graphics View class draws the scene and provides user interaction using the mouse. User
interaction can be complex as we have to handle many different interactions based on very few
mouse events:
- Zooming using the scroll wheel
- Panning by dragging
- Contextual menu by right-click
- Cancelling the current tool by right-click
- Starting a Rubber Band Tool on Ctrl+Drag (2.6.4)
- Tools listening to AbstractTool::clicked() events (2.6.1)
- Tools listening to AbstractTool::mousePressEvent() events (2.6.1)
The GraphicsView keeps track of the visible rectangle, in scene coordinates. This rectangle will
always be visible on the screen. Initially, the visible rectangle is the square from (0, 0) to (1, 1).
The visible rectangle can be transformed using translateView() or scaleView() or changed using
setVisibleRect(). Whenever the visible rectangle changes, for any reason, the visibleRectChanged()
signal is called.
Tools allow simple interaction inside the scene. A new tool can be set using setTool(). The tool then
remains active until it's AbstractTool::done() signal is emitted. When ESC button or right click is
pressed, the view attempts to cancel the tool by calling AbstractTool::cancel().
2.5.2 Graphics
The Graphics Widget is used to display tags and the PDoA node on the main display. It adds tag and
node items to the scene, and updates the x and y co-ordinates as it gets new data from the RTLS
Client.
The list of tags is also shown with their configuration properties, here the user can add a new tag
label, change the IMU use or fast and slow location rates.
2.5.3 Minimap
The Minimap view shows a zoomed out view of the whole floorplan. It allows the user to quickly
select and zoom into a particular place on the floor plan loaded.
The View Settings widget allows the user to configure the grid size, floorplan settings etc. This is
explained in detail in section 2.4.6.1 View Settings.
The Abstract Tool class is a base class any tool implementations should inherit. Tools allow simple,
temporary user interaction in the graphics view, based on mouse events. They are used to set the
scale (Scale Tool 2.6.5) and origin (Origin Tool 2.6.2) of the bitmap, and select nodes using a click and
drag style rubber band (Rubber Band Tool 2.6.4).
Once a tool is enabled, using GraphicsView::setTool(), the cursor changes to the return value of
cursor(), the draw() function gets called when drawing the foreground of the scene, and the tool
starts receiving mouse events.
The tool can receive the mouse events through two means, pressing and releasing of the left mouse
button. The clicked() function gets called when the left button is pressed and released. For more
complex interaction, the mousePressEvent()/mouseMoveEvent()/mouseReleaseEvent() functions
can be overridden. When a mouse button is pressed, mousePressEvent is called. If it returns true,
then tool grabs the mouse interaction, and will receive mouse events until the button is released.
Otherwise the scene will be handling mouse events, and mouseMoveEvent()/mouseReleaseEvent()
won't be called.
Note that the two mouse event mechanisms are incompatible. If mousePressEvent returns true,
clicked() will not be called for this mouse click.
The Origin Tool class is a tool used for setting the floorplan's origin point. It reacts to the clicked()
event. When clicked() is called, the origin is calculated based on the click position, and the tool
© Decawave 2018 Confidential API-Deca-PDoA-RTLS-GUI-Source-Code-Guide-1.1 Page 17
DECA-PDOA-RTLS SOURCE CODE GUIDE
The GeoFence Tool class is a tool used for setting the geofencing area origin point. It reacts to the
clicked() event. When clicked() is called, the centre is calculated based on the click position, and the
tool finishes right away.
The Rubber Band Tool class is a tool used to select nodes using a click and drag to draw a selection
box. Once the user has started the drag, a rectangular selection box is drawn, and all items within
the box get selected. In order to differentiate this tool's click and drag with the one used to move
the scene, the tool is started if the Control button is held during the initial mouse press event.
This is handled by the GraphicsView::mousePressEvent(), and is outside the scope of this class.
The Scale Tool class is a tool used to change the floorplan's scale. It allows the user to select two
points by waiting for two consecutive clicked() events. Once the user has clicked on two points, the
tool shows a popup to enter the distance between the two points. The scale is recalculated and
stored.
The QProperty Model is a class for turning any QObject-derived subclass with properties into a one-
row model. (Copyright 2013 - Harvey Chapman [email protected] Source:
https://gist.github.com/sr105/7955969). QPropertyModel creates a single row data model
consisting of columns mapping to properties in a QObject. The column list can be retrieved as a
QStringList, and a method exists to convert the property names to column numbers.
Once the installer is downloaded, run it, specify the installation path and select the following
components:
• Qt -> Qt 5.3 -> MinGW 4.8.2
• Qt -> Tools -> Qt Creator
• Qt -> Tools -> MinGW 4.8.2
Run the Qt Creator software. Under the File menu, select Open File or Project
Select the .pro file inside the Project’s directory. The first time the project is opened, it must be
© Decawave 2018 Confidential API-Deca-PDoA-RTLS-GUI-Source-Code-Guide-1.1 Page 19
DECA-PDOA-RTLS SOURCE CODE GUIDE
4 BIBLIOGRAPHY
Table 3: Table of References
5 DOCUMENT HISTORY
Table 4: Document History
6 FURTHER INFORMATION
Decawave develops semiconductors solutions, software, modules, reference designs - that enable
real-time, ultra-accurate, ultra-reliable local area micro-location services. Decawave’s technology
enables an entirely new class of easy to implement, highly secure, intelligent location functionality and
services for IoT and smart consumer products and applications.
For further information on this or any other Decawave product, please refer to our website
www.decawave.com.