Scripting: Geolocation
- Tutorial
Tutorial
This chapter describes the geolocation mechanisms natively provided by Immersive, to dynamically represent the position and movement of objects geolocated in the 3D digital twin, without the need for specific JavaScript development.
In the case of geolocated equipment, Immersive provides several native behaviors allowing to visually represent a change in the position of an object in its environment and do not require specific development in JS but only a configuration at the equipment level.
The 3 behaviors available in the following:
GeoTracking: Teleport of a geolocated objectGeoMove: Real-time tracking of a geolocated object with orientationNavMeshMove: Tracking an object with a movement constraint on the navigation graph.
In all 3 cases, the map on which the objects are to be placed must be perfectly geolocated,
and the reported positions must be in the coordinate system WGS 84.
GPS positions reported by a variable of type GISVector must follow the following format:
longitude;latitude
Example of a valid GPS position:
7.841257629258633;48.552757624772426
Enabling GeoTracking
The GeoTracking Allows you to change the position of an object on the map based on its GPS position.
Each time a GPS position is received, the associated object will be teleported to the corresponding position on the map.
This type of tracking is used in the case of a GPS position that is not accurate or whose frequency is low.
Real use case: monitoring the position of a module on a park with a position that goes up every 5 mins.
In order to associate a GeoTracking equipment,
all you have to do is create a variable with the name GeoTracking.
Indeed, a behavior has been saved by default by Immersive with the import rule $(GeoTracking).
The behavior can retrieve the GPS position of the object in 2 different ways:
- Via a variable of type
GISVectorbearing the nameGeoPos - Via 2 separate variables of type
Singlebearing the namesLongitudeandLatitude
Activating the GeoMove
The GeoMove is an advanced version of the GeoTracking.
He takes care of animating the object on the plane between the different GPS positions
in order to achieve a fluid movement.
This type of tracking is used in the case of a very accurate GPS position report (a few centimetres) and with a high frequency (< 1 s).
Real-world use cases: tracking the position of a jumper in a port or a fenwick in a park.
In order to associate a GeoMove equipment,
all you have to do is create a variable with the name GeoMove.
Indeed, a default behavior has been recorded by Immersive with the import rule $(GeoMove).
The behavior can retrieve the object's GPS position in two different ways:
- Via a variable of type
GISVectorbearing the nameGeoPos - Via two separate variables of type
Singlebearing the namesLongitudeandLatitude
In the event that the object needs to be oriented in addition to its position, two solutions are available to us:
- Provide object orientation via orientation sensor (recommended solution)
- Add a variable
Orientationto the object containing the orientation value
- Add a variable
- Provide information as to whether the object is in forward or reverse gear,
as well as the last known GPS position in addition to the previous one.
- Add a variable
ReversingTypeBoolean, which is true if reverse is engaged - Add a variable
PreviousCoordinatescorresponding to the GPS position previously measured
Warning: by default, Immersive retrieves values from the hub every second. In the case of the GeoMove, a higher retrieval frequency is required.
"Supervision.UpdatesPeriod" : 0.5
Activating the NavMeshMove
This type of tracking is used in the case of a more or less accurate GPS position report, and whose frequency is not large enough to be animated by the GeoMove. To be able to use it, it is necessary to have a navigation graph on the map.
When a GPS position is reported, the tracked object looks at its current position and the position to which it should go, it looks for the points of the navigation graph closest to these 2 positions, and look for a valid path.
If a valid path is found, the object will be animated from point A to point B by following the calculated path.
Real-world use cases: tracking an order picker's position in a warehouse between 2 scans, or animations of vehicles geolocated in an airport.
In order to associate a NavMeshMove equipment,
all you have to do is create a variable with the name NavMeshMove.
Indeed, a default behavior has been recorded by Immersive
with the import rule $( NavMeshMove).