
Chapter 4. Implementation 49
come from the interface converter service or the "send usb" and "send wlan"-command.
Raw output: Emits all incoming data from the gateway. Equals an addition of the topics other
output and protocol output, except that the HA messages are outputted in their raw string
format.
Raw input: sends all data directly to the gateway without further processing.
Both MiniCtrl and WifiCtrl can be configured by special configuration commands (see reference
card on 79); therefore a mechanism must exist, which ensures that the gateway assumes a particular
state during the start-up of the nodes. This algorithm is called start-up script and sends commands
successively and with a small delay between each from a command list. That list can be passed
as a command line parameter or loaded with a launch file.
Now that we have learnt the basics functions of the gateway driver, I will go into further detail.
Figure 4.12 depicts the internal structure of the node.
Qextserialport
QTcpSocket
serial
tcp
gateway rosnode
serial
tcpWLAN
USB
driver
driver
main
protocol
out
protocol
in
connect
ros
gateway driver
thread 1 thread 2
Figure 4.12.: The internal structure of the gateway driver. Each block represents an object within
the program, in which the green objects are third-party classes. The different objects
communicate through signals and slots as well as by method calls. The driver blocks
are drivers of the operating system, which convert the serial stream to USB and
distribute the TCP packages over WLAN.
When starting the gateway driver, the main function initialises all objects, connects to the gateway
and starts the Qt event systems, which is used for the signal/slot mechanism. Most of the
intercommunication is done via signals and slots, as they are event driven and easy to program.
This is useful, because they are thread safe and the program is divided in two threads, one for the
ROS related functions and one for all other functions. This separation makes it possible to run
the ROS main loop in a separate thread, so that the rest of the program is not blocked during
service calls. As mentioned before, the gateway can be connected via serial interface or TCP
connection. The serial class is used for serial connection. It inherits from the third-party library
QextSerialPort and adds a receiving and transmitting buffer, as well as a filtering algorithm, which
assembles fragmented input streams. As the WifiCtrl lost its full real time capability due to use of
Kommentare zu diesen Handbüchern