dfti::Server Class Reference

UDP server for vehicle state data. More...

#include <server.hh>

Inheritance diagram for dfti::Server:
Collaboration diagram for dfti::Server:

Public Slots

void getRIOData (RIOData data)
 Slot to receive data from the RIO.
 
void getUADCData (uADCData data)
 Slot to receive data from the Micro Air Data Computer.
 
void getVN200Data (VN200Data data)
 Slot to receive data from the VN-200 INS.
 
void writeData (void)
 Slot to write data.
 

Public Member Functions

 Server (Settings *_settings, QObject *_parent=nullptr)
 Constructor. More...
 
 ~Server ()
 Dtor.
 
void enableUADC (uADC *adc)
 Enable Micro Air Data Computer Sensor. More...
 
void enableRIO (RIO *rio)
 Enable Remote I/O unit. More...
 
void enableVN200 (VN200 *ins)
 Enable VN-200 INS Sensor. More...
 
void start (void)
 Start server. More...
 

Detailed Description

UDP server for vehicle state data.

For online system identification and similar use cases, we need the vehicle state data available. This class implements a UDP server that server the StateData structure at a user-specified rate. The data is sent to a user-specified IP address and port; these default to localhost and 2701.

The native byte order and 1-byte padding is used for the structure; no conversions are made to network byte order. The easiest way to receive the data is to bind a socket to the address and port and cast the bytes to the data structure; in C++ static_cast<StateData> should work.

For Python, code similar to the following may be used:

1 import socket
2 import struct
3 
4 BUF_SIZE = 128 # Make sure this is larger than sizeof(StateData)!
5 SOCK_ADDR = "127.0.0.1"
6 SOCK_PORT = 2701
7 
8 if __name__ == '__main__':
9  sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
10  sock.bind((SOCK_ADDR, SOCK_PORT))
11 
12  fmt = '=QffffffffffffffffBffffffffff'
13  while True:
14  data, _ = recvfrom(BUF_SIZE)
15  unpacked_data = struct.unpack(fmt, data)
16  # Do stuff with unpacked_data, which is a tuple.

Constructor & Destructor Documentation

dfti::Server::Server ( Settings _settings,
QObject *  _parent = nullptr 
)
explicit

Constructor.

Parameters
_settingsPointer to Settings object.
_parentPointer to parent QObject.

Member Function Documentation

void dfti::Server::enableRIO ( RIO rio)

Enable Remote I/O unit.

Parameters
rioQPointer to RIO object.
void dfti::Server::enableUADC ( uADC adc)

Enable Micro Air Data Computer Sensor.

Parameters
adcQPointer to uADC object.
void dfti::Server::enableVN200 ( VN200 ins)

Enable VN-200 INS Sensor.

Parameters
insQPointer to VN200 object.
void dfti::Server::start ( void  )

Start server.

Connects QTimers to the writeData slot.


The documentation for this class was generated from the following files: