|
Using External Coordinate Files
You can associate a Ground Vehicle object to an external
set of three files that contain the object’s waypoints. This feature allows
you to control the location of a dynamic object, in real time, by updating
the set of coordinate files. The coordinate files should be located behind
a web server and the file name should be provided as a URL address. Each
of the three files can contain the coordinates of one or more dynamic
objects. A managing application should control the content and the names
of the coordinate files.
Managing the Coordinate Files
The application that manages the external coordinate files
should follow these rules:
1.
The files should be located behind a web server. The “Coordinate
File Name” parameter should contain the full URL and the name of the first
file (i.e. “www.skylinesoft.com/coordinates/MyProject.gp0”).
2.
The managing application should always create three binary
files. The three files should have the following extensions:
§ FileName.gp0
– contains the current positions
(“FileName” is the name of the file).
§ FileName.gp1
– contains the positions at the time of the previous update.
§ FileName.gp2
– contains the positions two updates ago.
3.
For
each new positions update, the managing application should:
§ Rename
the file FileName.gp1 to FileName.gp2.
§ Rename
the file FileName.gp0 to FileName.gp1.
§ Create
a new file, FileName.gp0, containing the new locations.
Object Movements
The dynamic objects follow these steps to perform their
smooth movement:
1.
At the startup of the project, the object reads the three files
and places itself at the waypoint found in FileName.gp2.
2.
If the files do not exist the object stays at the location
defined in the Point X, Point Y parameters of the object. The moment the
object finds the coordinate files it jumps to the waypoint found in FileName.gp2
and starts the movement.
3.
The object moves from the coordinate in .gp2 to the coordinate
at .gp1. The distance and the time difference between the waypoints calculate
the speed.
4.
The object reads the content of the coordinate files every
few seconds, as defined in the object’s “Time Interval” parameter and
adds the new waypoints.
5.
If no update is available and the object reaches the .gp1 waypoint
it continues to the waypoint presented at .gp0.
6.
If the object reaches the.gp0 waypoint and there is no new
update, the object stops until a new update arrives.
7.
In case the object doesn’t manage to get an update (there is
no continuity in the file index) the object jumps to the next waypoint.
File Format
A coordinates file has two sections, the File Header and
the File Body.
File Header Format:
|
Format
(2 bytes) |
Header Size
(2 bytes) |
Number of Files
(2 bytes) |
Index
(4 bytes) |
§
Format [WORD - 2 bytes] – Contains the format
of the file. Should always be set to 1.
§
Header Size [WORD - 2 bytes] – Contains the size
of the header section. Should always be set to 10.
§
Number of Files [WORD - 2 bytes] – Contains the number
of position files. Should always be set to 3.
§
Index [DWORD - 4 bytes] – Contains the serial index
of this file. The index of the first.gp2 file should be set to 0. The
index of the first .gp1 file should be set to 1. The index of the first.gp0
file should be set to 2. Each time a new .gp0 file is created this number
should be increased by 1.
File Body Format:
The file body can contain entries for several objects (one
after another) where “object entry” is in the following format:
|
Format
(2 bytes) |
Length
(2 bytes) |
Object ID
(4 bytes) |
X (float)
(4 bytes) |
Y (float)
(4 bytes) |
Time
(4 bytes) |
§
Format [WORD - 2 bytes] – Contains the format
of the file. Should always be set to 1.
§
Length [WORD - 2 bytes] – Contains the length of
this record. Should always be set to 20.
§
Object ID [DWORD - 4 bytes] – The
ID of the object as it appears in the “Object ID” parameter in the object’s
Properties Sheet.
§
X [FLOAT - 4 bytes] – X-coordinate of the waypoint.
§
Y [FLOAT - 4 bytes] – Y-coordinate of the waypoint.
§
Time [DWORD - 4 bytes] – Time
elapsed (in seconds) from the beginning of the first file update.
|