GnssTrackMobility¶
Package: inet.mobility.single
simple module GnssTrackMobility
Mobility model that follows a recorded GNSS (WGS84) track read from a CSV, GPX, or
GeoJSON LineString source, mapping geographic positions into the scene through
the coordinateSystemModule. Waypoints are interpolated along the great circle,
so the path stays on the Earth’s surface even between far-apart points, which
works for both cars and aircraft.
Timing is auto-detected: if the source carries per-point timestamps (a 4th CSV
column, GPX <time> elements, or a GeoJSON coordTimes property) they drive the
motion; otherwise the speed parameter traverses the track at a constant ground
speed. trackStartTime sets when playback begins, and loopMode controls
whether the track plays once, repeats from the start, or ping-pongs back and
forth. With faceForward the body +X axis is aligned with the direction of
travel (so e.g. a directional antenna mounted along it points along the track).
The CSV or GPX track is given as raw data in the trackData string parameter (e.g.
trackData = readFile("track.csv")). CSV rows are latitude,longitude[,altitude[,time]]
(degrees, meters, seconds); blank lines, # comments, and a non-numeric header row are
ignored. GeoJSON is supplied separately through the trackJson object parameter using
readJSON("track.geojson").
Inheritance diagram¶
Extends¶
Name |
Type |
Description |
|---|---|---|
simple module |
Abstract base module for mobility models. |
Parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
displayStringTextFormat |
string |
“{geo_position}\np: {position}\nv: {velocity}” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
subjectModule |
string |
“^” |
The module path that determines the subject module, the motion of which this mobility model describes. The default value is the parent module |
coordinateSystemModule |
string |
“” |
The module path of the geographic coordinate system module; optional, empty disables geographic conversion (and the {geo_position} directive) |
updateDisplayString |
bool |
true |
Enables continuous update of the subject module’s position by modifying its display string |
constraintAreaMinX |
double |
-inf m |
The minimum x position of the constraint area. It is unconstrained by default (negative infinity) |
constraintAreaMinY |
double |
-inf m |
The minimum y position of the constraint area. It is unconstrained by default (negative infinity) |
constraintAreaMinZ |
double |
-inf m |
The minimum z position of the constraint area. It is unconstrained by default (negative infinity) |
constraintAreaMaxX |
double |
inf m |
The maximum x position of the constraint area. It is unconstrained by default (positive infinity) |
constraintAreaMaxY |
double |
inf m |
The maximum y position of the constraint area. It is unconstrained by default (positive infinity) |
constraintAreaMaxZ |
double |
inf m |
The maximum z position of the constraint area. It is unconstrained by default (positive infinity) |
updateInterval |
double |
0.1s |
The simulation time interval used to regularly signal mobility state changes and update the display |
faceForward |
bool |
true |
|
trackData |
string |
“” |
Raw CSV or GPX track data (use readFile(”…”) to load it from a file); used unless a GeoJSON track is given |
trackJson |
object |
nullptr |
GeoJSON track, e.g. readJSON(“track.geojson”); takes precedence over trackData |
trackFormat |
string |
“auto” |
Track source format; auto-detected from trackJson and the data content by default |
trackStartTime |
double |
0s |
Simulation time at which playback of the first waypoint begins |
speed |
double |
nan mps |
Constant ground speed used only when the track has no timestamps |
loopMode |
string |
“none” |
Playback looping: play once, repeat from start, or ping-pong |
Properties¶
Name |
Value |
Description |
|---|---|---|
class |
GnssTrackMobility |
|
display |
i=block/cogwheel |
Signals¶
Name |
Type |
Unit |
Description |
|---|---|---|---|
mobilityStateChanged |
inet::MobilityBase |
It works in inet, but not in the extended module in another namespace |
Source code¶
//
// Mobility model that follows a recorded GNSS (WGS84) track read from a CSV, GPX, or
// GeoJSON LineString source, mapping geographic positions into the scene through
// the `coordinateSystemModule`. Waypoints are interpolated along the great circle,
// so the path stays on the Earth's surface even between far-apart points, which
// works for both cars and aircraft.
//
// Timing is auto-detected: if the source carries per-point timestamps (a 4th CSV
// column, GPX `<time>` elements, or a GeoJSON `coordTimes` property) they drive the
// motion; otherwise the `speed` parameter traverses the track at a constant ground
// speed. `trackStartTime` sets when playback begins, and `loopMode` controls
// whether the track plays once, repeats from the start, or ping-pongs back and
// forth. With `faceForward` the body +X axis is aligned with the direction of
// travel (so e.g. a directional antenna mounted along it points along the track).
//
// The CSV or GPX track is given as raw data in the `trackData` string parameter (e.g.
// `trackData = readFile("track.csv")`). CSV rows are `latitude,longitude[,altitude[,time]]`
// (degrees, meters, seconds); blank lines, `#` comments, and a non-numeric header row are
// ignored. GeoJSON is supplied separately through the `trackJson` object parameter using
// `readJSON("track.geojson")`.
//
simple GnssTrackMobility extends MovingMobilityBase
{
parameters:
string trackData = default(""); // Raw CSV or GPX track data (use readFile("...") to load it from a file); used unless a GeoJSON track is given
object trackJson = default(nullptr); // GeoJSON track, e.g. readJSON("track.geojson"); takes precedence over trackData
string trackFormat @enum("auto","csv","gpx","geojson") = default("auto"); // Track source format; auto-detected from trackJson and the data content by default
double trackStartTime @unit(s) = default(0s); // Simulation time at which playback of the first waypoint begins
double speed @unit(mps) = default(nan mps); // Constant ground speed used only when the track has no timestamps
string loopMode @enum("none","repeat","pingPong") = default("none"); // Playback looping: play once, repeat from start, or ping-pong
displayStringTextFormat = default("{geo_position}\np: {position}\nv: {velocity}"); // Show the geographic latitude/longitude/altitude position string ({geo_position}) above the raw scene position and velocity
@class(GnssTrackMobility);
}