ServAdvisor.co /Adding location data in AR space

ServAdvisor
4 min readAug 8, 2018

--

ServAdvisor app is able to display the rectangular pins showcasing retailers\ service providers ratings. Once we have the GPS coordinates of the pins, we need to calculate the locations onscreen to render the rectangles. First, let’s start with the GPS coordinate where the user is currently standing. In navigation, a common term is the azimuth, which is the angle on the ground plane between the current location and some other location in the distance, relative to true north.

The azimuth angle can be calculated for each pin based on the arc-tangent of its difference in latitude with live view location divided by its difference in longitude with the live view location, adjusting for quadrant.

Once we have the azimuth angle for each pin, the next step is to find the horizontal location onscreen for that pin. We continually update a special azimuth angle representing an imaginary location straight ahead of us in the field of vision, whenever the user decides to rotate the live view panorama left or right. The horizontal onscreen location is computed by comparing this special azimuth with the pin azimuth.

On the ServAdvisor, in landscape orientation we can assume that our field of vision spans roughly 90 degrees out of a possible 360. If the difference between the straight-ahead azimuth and the pin azimuth is greater than 90 degrees, then we do not show the pin at all. Otherwise, we calculate the horizontal coordinate of the pin such that pins with azimuth angles closest to the straight-ahead azimuth appear in the exact center of the screen. Pins with azimuth angles exactly 45 degrees on either side of the straight-ahead angle will appear just on the edge of the screen.

The final step is to calculate the vertical location of each pin onscreen. Here, we have a few options. We do not know the height off the ground of each place, and so we’ll need to simulate the intended height value. One option is to keep the pin centered vertically if it is very far away, and move the pin towards the top or bottom of the screen if it is very close to the live view location. This option has the effect of showing faraway locations right on the horizon.

However, in practice, we do not ever want two pins to overlap with each other for display purposes, and by putting many pins on the horizon, they almost always tend to overlap. So, the second option is to just ignore the pin distance and stack pins vertically so that they never overlap, and are also clustered towards the center of the screen.

Making use of device sensors

In the typical augmented reality experience, the user moves their phone or tablet around in real-time, looking through the camera at their surroundings. The device compass, accelerometer, and gyroscope are used to calculate the direction and height in which the user is facing.

Compass

The device compass readings can tell us the straight-ahead azimuth angle as described in the previous section. That is, it tells us the degree by which the current forward direction differs from north. Keep in mind that the compass reading does not change at all based on how the user’s phone or tablet is currently being held. Compass readings can be used to calculate the horizontal location of pins onscreen.

Accelerometer

The device accelerometer readings tell us the orientation at which the user’s phone or tablet is currently being held. If the user is holding their device perpendicular to the ground, then pins should appear in the center of the screen because the user is looking forward at the horizon. However, if the user is holding their device at a 45 degree angle facing downwards toward the ground, then pins might appear further towards the top of the screen. The accelerometer can also be used to determine whether pins should be rotated onscreen.

Gyroscope

The device gyroscope can be used to determine how quickly a user is currently rotating their phone or tablet. A common complaint with augmented reality apps is that the pins onscreen move around very frequently and are overly sensitive to device movement. By observing gyroscope events, the effect of the accelerometer on pin movement can be dampened whenever device movement is rapid.

In the future, we expect that augmented reality will become even more prevalent on mobile and tablet devices, especially for online travel planning. We are very excited at ServAdvisor to be on the leading edge of this technology.

#cryptonews #cryptocurrency #blockchain #ICO #Crypto #TokenSale #earlybird #bitcoin #cryptokitties #altcoin #ServAdvisor #SRV

--

--