Scripting: Geolocation

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 object
  • GeoMove : Real-time tracking of a geolocated object with orientation
  • NavMeshMove : Tracking an object with a movement constraint on the navigation graph.

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.

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 GISVector bearing the name GeoPos
  • Via 2 separate variables of type Single bearing the names Longitude and Latitude

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).

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 GISVector bearing the name GeoPos
  • Via two separate variables of type Single bearing the names Longitude and Latitude

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 Orientation to the object containing the orientation value
  • 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 Reversing Type Boolean, which is true if reverse is engaged
  • Add a variable PreviousCoordinates corresponding to the GPS position previously measured
"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.

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).