SwisTrack/Multi-Camera Client

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Introduction[edit | edit source]

Abstract[edit | edit source]

SwisTrack Multi-Camera Client is a client tool to communicate with several SwisTrack instances. It is written in C++ using wxWidgets. Data received by a TCP connection will be merged and synchronized before displaying it on a window. SwisTrack is the server part of the connection and SwisTrack Multi-Camera Client is the client.


Zoom / focus function[edit | edit source]

You can zoom in and out using the scroll wheel of the mouse. To focus on a specific region click with the right mouse button on that region. The left mouse button is to get several information if clicked on a robot. By clicking the mouse wheel the view will be reset.


Class hierarchy[edit | edit source]

We have 10 classes, where "ClientFrame" is the mean one.


SwisTrack Multi-Camera Client class hierarchy


Name Explanation
ClientFrame Defines a new frame type (main class)
CommunicationMessage Creates new messages that can be send to the robots and the SwisTrack instances.
CommunicationNMEAInterface Interface to parse incoming messages and send outgoing messages
MapPanel Responsible for painting the panel
Robot Creates new robots for communication and painting
RobotSocketManager Responsible for the communication between the robots and the SwisTrack Multi-Camera Client
SavePosition If enabled, saves the positions of the robots each separated in a file
STClient Defines the application type
SwisTrack Creates new SwisTrack objects for communication and painting the camera areas
SwisTrackSocketManager Responsible for the communication between the SwisTrack instances and the SwisTrack Multi-Camera Client


Edit Settings[edit | edit source]

If you select the menu "Edit/Edit settings" a editing window will pop up and you will be able to change the settings. Beware to the syntax, otherwise the program won't run correctly. Lines that begins with "#" are treated like comments.

The proper syntax of the SwisTrack Multi-Camera Client settings is (with example)):


SwisTrack[edit | edit source]

Type Adress:port; Reference point (x,y); Vector 1 (x,y); Vector 2 (x,y); Width, height (w,h);
cam: localhost:3000; 2,3; 1,0; 0,1; 4,6


Robot[edit | edit source]

Type Adress:port; id
robot: 127.0.0.1:4002; 5


Watch that after a type follows always a ":" and else after every entry follows a ";" except for the last one where nothing follows. Have a look on the screenshots for an real example.


Save tracking positions: file syntax[edit | edit source]

If desired, the movements of the robots can be saved on a "robotX.txt" file (X is the id of the robot). A line per frame will be used. The syntax is the following:


frame number, position in x, position in y, angle

example: 217,0.669787,8.297836, 6.210000


Camera area definition[edit | edit source]

As seen above we use a reference point with 2 vectors, a width and height for defining a camera area.


SwisTrack Multi-Camera Client camera setting


NMEA 0183 protocol[edit | edit source]

The SwisTrack Multi-Camera Client uses the NMEA 0183 protocol to communicate with the SwisTrack instances and the robots.


SwisTrack[edit | edit source]

Keep in mind that every command is encapsulated in a message with a message header (command) and a list of arguments according to the specific command. Every command begins with a $ and is in capitals.


Sending commands[edit | edit source]

Command Arguments Description
$START None Initiates the SwisTrack instances and sets the current frame number to 0, but doesn't process anything till $STEP is send.
$STOP None Stops the current tracking and resets the current frame number to 0.
$STEP None Indicates to the SwisTrack instances to process a next image frame.

The program can be paused (not sending $STEP commands any more) and be resumed by the menu commands under "ST controls/Pause tracking" and "ST controls/Resume tracking".


Receiving commands[edit | edit source]

Command Arguments Description
$PARTICLE int id, double x, double y, double angle Every robot recognized on a frame is send separately with these parameters
$BEGINFRAME int frameNb Indicates that the data that arrives after this command belongs to the frame number send
$ENDFRAME None Indicates that the current processing frame is completed and finished

Remark: One or several $PARTICLE commands can only be received between a $BEGINFRAME and a $ENDFRAME command!


Robot[edit | edit source]

Sending commands[edit | edit source]

Command Arguments Description
$STATUS None Get the current status of the robot (for example: tracking, idle, searching).
$POSITION double position x, double position y Reset the current position of the robot.

Receiving commands[edit | edit source]

Command Arguments Description
$STATUS string status Returns its current status.


Screenshots[edit | edit source]

Here are some screenshots taken from the SwisTrack Multi-Camera Client:

SwisTrack Multi-Camera Client "main" window SwisTrack Multi-Camera Client "edit" window