Showing posts with label position tracking. Show all posts
Showing posts with label position tracking. Show all posts

Sunday, May 8, 2016

Understanding Predictive Tracking

Image source: Adrian Boeing blog
In the context of AR and VR systems, predictive tracking refers to the process of predicting the future orientation and/or position of an object or body part. For instance, one might want to predict the orientation of the head or the position of the hand.

Why is predictive tracking useful?

One common use of predictive tracking is to reduce the apparent "motion to photon" latency, meaning the time between movement and when that movement is reflected in the drawn scene. Since there is some delay between movement and an updated display (more on the sources of that delay below), using an estimated future orientation and position as the data used in updating the display, could shorten that perceived latency.

While a lot of attention has been focused on predictive tracking in virtual reality applications, it is also very important in augmented reality. For instance, if you are displaying a graphical overlay to appear on top of a physical object that you see with an augmented reality goggles, it is important that the overlay stays on the object even when you rotate your head. The object might be recognized with a camera, but it takes time for the camera to capture the frame, for a processor to determine where the object is in the frame and for a graphics chip to render the new overlay. By using predictive tracking, you can get better apparent registration between the overlay and the physical object.

How does it work? 

If you saw a car travelling at a constant speed and you wanted to predict where that car will be one second in the future, you could probably make a fairly accurate prediction. You know the current position of the car, you might know (or can estimate) the current velocity, and thus you can extrapolate the position into the near future.

Of course if you compare your prediction with where the car actually is in one second, your prediction is unlikely to be 100% accurate every time: the car might change direction or speed during that time. The farther out you are trying to predict, the less accurate your prediction will be: predicting where the car will be in one second is likely much more accurate than predicting where it will be in one minute.

The more you know about the car and its behavior, the better chance you have of making an accurate prediction. For instance, if you were able to measure not only the velocity but also the acceleration, you can make a more accurate prediction.

If you have additional information about the behavior of the tracked body, this can also improve prediction accuracy. For instance, when doing head tracking, understand how fast the head can possibly rotate and what are common rotation speeds, can improve the tracking model. Similarly, if you are doing eye tracking, you can use the eye tracking information to anticipate head movements as discussed in this post

Sources of latency

The desired to perform predictive tracking comes from having some latency between actual movement and displaying an image that reflects that movement. Latency can come from multiple sources, such as:
  • Sensing delays. The sensors (e.g. gyroscope) may be bandwidth-limited and do not instantaneously report orientation or position changes. Similarly, camera-based sensors may exhibit delay between when the pixel on the camera sensor receives light from the tracked object to that frame being ready to be sent to the host processor.
  • Processing delays. Sensors are often combined using some kind of sensor fusion algorithm, and executing this algorithm can add latency.
  • Data smoothing. Sensor data is sometimes noisy and to avoid erroneous jitter, software or hardware-based low pass algorithms are executed.
  • Transmission delays. For example, if orientation sensing is done using a USB-connected device, there is some non-zero time between the data available to be ready by the host processor and the time data transfer over USB is completed.
  • Rendering delays. When rendering a non-trivial scene, it takes some time to have the image ready to be sent to the display device.
  • Frame rate delays. If a display is operating at 100 Hz, for instance, there is a 10 mSec time between successive frames. Information that is not precisely current to when a particular pixel is drawn may need to wait until the next time that pixel is drawn on the display.
Some of these delays are very small, but unfortunately all of them add up and predictive tracking, along with other techniques such as time warping, are helpful in reducing the apparent latency.

How much to track into the future?

In two words: it depends. You will want to estimate the end-the-end latency of your system as a starting point and then optimize them to your liking.

It may be that you will need to predict several timepoints into the future at any given time. Here are some examples why this may be required:
  • There are objects with different end-to-end delays. For instance, a hand tracked with a camera may be have different latency than a head tracker, but both need to be drawn in sync in the same scene, so predictive tracking with different 'look ahead' times will be used.
  • In configurations where a single screen - such as a cell phone screen - is used to provide imagery to both eyes, it is often the case that the image for one eye appears with a delay of half a frame (e.g. half of 1/60 seconds, or approx 8 mSec) relative to the other eye. In this case, it is best to use predictive tracking that looks ahead 8 mSec more for that delayed half of the screen.

Common prediction algorithms

Here is some sampling of predictive tracking algorithms:
  • Dead reckoning. This is a very simple algorithm: if the position and velocity (or angular position and angular velocity) is known at a given time, the predicted position assumes that the last know position and velocity are correct and the velocity remains the same. For instance, if the last known position is 100 units and the last known velocity is 10 units/sec, then the predicted position 10 mSec (0.01 seconds) into the future is 100 + 10 x 0.01 = 100.1. While this is very simple to compute, it assumes that the last position and velocity are accurate (e.g. not subject to any measurement noise) and that the velocity is constant. Both these assumptions are often incorrect.
  • Kalman predictor. This is based on a popular Kalman filter that is used to reduce sensor noise in systems where there exists a mathematical model of the system's operation. See here for more detailed explanation of the Kalman filter.
  • Alpha-beta-gamma. The ABG predictor is closely related to the Kalman predictor, but is less general and has simpler math, which we can explain here at a high level. ABG tries to continuously estimate both velocity and acceleration and use them in prediction. Because the estimates take into account actual data, they provide some measurement noise reduction. Configuring the parameters (alpha, beta and gamma) provide the ability to emphasize responsiveness as opposed to noise reduction. If you'd like to follow the math, here it goes:

Summary

Predictive tracking is a useful and commonly-used technique for reducing apparent latency. It offers simple or sophisticated implementations, requires some thought and analysis, but it is well worth it.

Tuesday, January 12, 2016

Diagramming the VR Stack

While preparing for last week's Consumer Electronics Show, I created a simple diagram to explain and VR application stack and how it related to the work that we are doing with OSVR. I thought it might be interesting to share this diagram and explain its contents:

The VR Stack diagram, Copyright (c) Sensics, Inc.
At the risk of contradicting Copernicus, we see the HMD at the center. Without the display, whether VR or AR, there is not much of an experience.

The display by itself does not make the experience, just like a game console without game controllers are not very interesting. Thus, the HMD is surrounded by a variety of sensors and output devices. These are often orientation and position trackers, input devices, but could also be eye trackers, motion platforms, gesture and skeleton sensors, depth sensors and more.

Moving for a moment to the outer circle, there are games and other applications. These needs to be distributed (and often monetized), but let's leave the distribution discussion for another time.

Very often, these applications are written using graphics or game engines. They provide a wide range of services: from assets to lighting to physics and more. These engines - such as Unity, Unreal, Cryengine or other are shown in the next to last circle.

To me, what is often overlooked in VR is the need for a middleware layer - a layer that connects the various engines to the various sensors and peripherals. I submit that no one likes to write applications that work only on one device and because of that, a layer that allows a game engine to connect to many different HMDs, to many different eye trackers, to many different sensors is critical. Think about your computer at home. Does everyone use the same monitor? Keyboard? Mouse? Printer? Not everyone would want to use the same HMD. That's why middleware is required and an excellent example of middleware is the OSVR software platform supporting hundreds of devices, peripherals and game engines. All layers are important, so don't forget the middleware!

The post "Diagramming the VR Stack" first appeared on "Virtual Reality and Head Mounted Displays"

Saturday, February 7, 2015

Building Wireless VR Goggles

Wireless is good. Most people prefer cordless or mobile phones over corded ones; a wireless network connection over a wired one; wireless game controllers; wireless speakers; wireless charging. You get the point.

Would a wireless goggle - one that does not require cables to connect to a PC - be desirable? I certainly think so. With a wireless goggle, you could:
  • Use the goggle in the living room even if the computer is on your desk
  • Have multiple people use multiple goggles in the same space - such as an arcade - without tripping over each other's wires
  • Avoid the risk of wrapping the goggle's umbilical cord around you as you turn
  • Have greater freedom of movement

While wireless solutions already exist for professional-grade goggles (see this 2012 video of the Sensics zSight to the right), let's examine what it would take to do this for a consumer-grade product such as the OSVR HDK (Hacker Developer Kit)

For a wireless solution, one would need to consider three key components: video transmission (how you get the video to the goggles), wireless tracking (how the PC gets information about where the user is) and power.

Video Transmission

Not all wireless video solutions are created the same, because not all aim to solve the same problem. Here is what's important to look for:
  • Low latency. Streaming a movie or a sports event to your TV does not require tight control over latency. If the movie is shown with a 1-second delay, that is perfectly acceptable. Streaming a game to a goggle with a 1-second delay is completely unacceptable. Sometimes, the need to control latency also dictates whether compression can be used. Compressed video saves on bandwidth but takes time to compress at the transmitter and decompress at the receiver.
  • No line-of-sight requirement. Some wireless video solutions require there the transmitter can "see" the receiver, which is typically called 'line of sight'. Those solutions typically don't work for VR goggles because the whole premise of wireless goggles is to allow the user to move around as well as turn. Such turning will inadvertently result in breaking the line of sight from transmitter to receiver and thus dropping the connection. Other use cases, such as having the PC in one room and using the goggles in another probably don't even have line of sight to begin with. This requirement that the wireless signal can go through objects or walls also influences the wireless transmission frequency. Higher frequency transmission (e.g. 60 GHz) results in shorter wavelength which in turn results in greater difficulty in going through walls or humans. Lower frequency bands such as 5 GHz does a better job in penetrating through obstacles and is thus more suitable for wireless goggles.
  • Support the right resolution. Wireless video solutions were originally designed with home entertainment in mind, and thus focus on supporting standard home video resolutions of 1080p (1920x1080) or 720p (1280x720). However, many consumer goggles use smartphone displays that have a native resolution of 1080x1920 - portrait mode - as opposed to the traditional 1920x1080 landscape mode. Many wireless video links do not support 1080x1920. One solution, that is now available as an option with the OSVR HDK is to use on-goggle FPGA to perform the video rotation, so that the wireless link still carries the standard 1920x1080 resolution but it is rotated in real-time to 1080x1920. This enables using wireless video links with such products (note: see the 'no free lunch' section below)
  • Ability to support multiple independent video links. While this is not required if there is just one video link from the PC to the goggles, it might be required if 1) there are multiple goggles in the same space, and they each want to operate independently; 2) there is a need to carry video, such as from a video camera, from the goggles back to the PC (see this wireless camera) or 3) if the goggles require multiple HD1080p signals such as those goggles that have dual screens

Tracking

Goggles are interactive and thus very often require head orientation and sometimes head position tracking to be sent back to the controlling application. Thus, cutting the video cable is not enough and one needs to find a solution for wireless tracking.

Some wireless transmission technologies - such as WHDI - support an in-band downstream data link. If the transmission of video is considered 'upstream' - from video transmitter to video receiver - a downstream data downlink is sending information from the video receiver (where the goggles are) to the video transmitter (where the PC is). These data downlinks can often carry USB HID (Human Interface Device) messages such as those coming from game controllers and provide a reasonable bandwidth of about 100 kbps. If on-board orientation tracking is formatted into a compatible message, head tracking can be carried to the PC on the same link as the video. This is how tracking is performed in the 2012 zSight video above. The downside of this approach is the update rate. Assuming 60 FPS video, WHDI transmits the downstream data during the blanking periods inbetween frames. Thus, USB HID transmission is also provided at 60 Hz, which is sometimes not interactive enough.

Another method is to use or embed a wireless tracker such as the YEI 3-space sensor. Adding an out-of-band data link ((not on the same link as the video transmission) to a tracker can provide high-rate tracking information without needing a cable.

Other methods are to use trackers that have some kind of base station, such as the Sixense STEM. In this case, the tracker base is connected to the PC. An advantage of this approach is that beyond the head, other parts of the body can also be tracked, as is also the case with the PrioVR suit.

Power

Cutting the cord means also providing local power to the goggles as well as other local consumers of energy - wireless receiver, wireless tracker, on-board camera where applicable and so forth. Including the goggle and wireless receiver, one could expect a power draw of 5-10 Watts (1-2 Amps on +5V). This can typically be satisfied with a 1 or 2 high-current battery such as those being marketed to charge phones and tablets. These batteries are rated in mAh (milliampere-hour) or Ah (ampere-hour). An Ampere-hour means that the battery can theoretically provide 1 ampere of current for an hour. For instance, a 10000 mAh battery that outputs +5V can theoretically provide 10 Watts (2 Amps x 5V) for 5 hours. A typical AA battery provides 2-3Ah. A typical external battery for smartphones can provide 10Ah and a typical car battery can provide about 50Ah (though it would be quite heavy). However, because of many factors - such as the drop in voltage when the battery drains - these figures are a someone optimistic. However, one can often plan for 1-2 hours between charges on an external smartphone battery.

There's no free lunch

What are the downsides of a wireless VR solution?
  • It costs more. One would need to factor in the price of the wireless video link, a potential price increase in the tracking costs, and the costs of a battery
  • There may be a price to pay in video latency. If you use an on-board FPGA to rotate the image from 1920x1080 to 1080x1920, you add 1 frame's worth of latency, or 16mSec. This is because you have the store the entire image in memory before you can start outputting the rotated image.
  • You are often limited to 60 FPS video. Because most wireless video solutions were designed for home entertainment, they provide 1080p @ 60 FPS. Newer solutions that aim to provide higher resolutions might be able to address this issue.
  • You have to carry the battery and the receiver. This is can be done in a beltpack or small backpack.
  • You have to recharge or change the battery from time to time.

What about using a phone for your HMD?

One way to completely overcome this issue is not use a PC. Phone-based HMDs such as Google Cardboard perform all the processing and display on the local phone, thus eliminating the need for wireless video transmission. However, one could probably safely assume that a powerful PC would always have more computing power, more graphics power and access to a wider range of peripherals than a phone, and thus some PC-based experiences could not be replicated on a phone.

Should you do it?

Having discussed the advantages and disadvantages, should you use a wireless HMD? At the very least, you will want to experience it. Having no cables can be quite liberating and is certainly worth a try. Let me know what you think!


The post "Building Wireless VR Goggles" first appeared on the VRguy's blog at www.vrguy.net 



Monday, August 4, 2014

Positional tracking: "Outside-in" vs. "Inside-out"

Optical positional tracking for goggles uses a camera (or cameras) and a known set of markers to determine the position of the camera relative to the markers. Positional tracking can be done using the visible spectrum but is more commonly done using infra-red markers and a camera that is sensitive to IR light.

There are two main options:

  • Inside-out tracking: where the camera is based on the goggles and the IR markers are placed in stationary locations (e.g. on the computer monitor, on the wall, etc.)
  • Outside-in tracking: where the camera is placed in a stationary location and the IR markers are placed on the goggles.
In both cases, the targets sometimes flash in a way that is synchronized with the camera. This allows reducing power consumption for the targets and helps reduce tracking noise from IR sources that are not the targets.

Sensics dSight panoramic HMD with IR targets for "outside in" tracking
How do these approaches compare?

  • Tracking volume: in both cases, at least some of the targets need to be visible to the camera. When the user rotates the head, an "inside-out" system needs targets that are physically far apart. If the targets are, for instance, placed on the bezel of a notebook PC, it is easy to see how head rotation could easily take these targets out of the field of view of the camera. A wider lens could be used in the camera, but this would reduce the tracking precision as each camera pixel would now cover a greater physical space in the world. In the "outside-in" system, targets could be placed on most sides of the goggle, allowing reasonably large rotation while still having targets visible on the camera. Advantage: outside-in
  • Tracking inside an entire room: if we want to allow mobility within a room, an 'inside-out' system would require additional markers on the walls, whereas an 'outside-in' system would require additional cameras. Both systems would require room calibration to make sure the target and/or cameras are placed in a known position. Additional cameras require additional processing power. Slight advantage: inside-out
  • Where is data being processed? In "inside-out' tracking, the camera data is either processed on the goggle or the camera is connected to a computer that is either carried by the user or stationary and connected via a wire. In 'outside-in' tracking, the data is processed on a computer that could be stationary. Advantage: outside-in
  • Can this be used with a wireless goggle? If the goggle is not tethered to a computer, "inside-out" tracking requires that the data is either processed locally or that the camera signal is sent wirelessly to a base station. In contrast, an 'outside-in' approach does not require wireless data of the camera. At most, a synchronization signal can be sent to the IR LEDs to make sure they flash in sync with the camera. Advantage: outside-in
  • Ability to combine with augmented reality system. Sometimes, the goggle will already have an on-board camera (or cameras) for the purpose of augmented reality and/or 3D reconstruction. In that case, using the same camera for positional tracking may have some cost advantages if positional tracking can be used with visible targets or if the camera already has IR sensitivity. Advantage: inside-out
Note: tracking accuracy is also an important comparison parameter, but this is more difficult to generically compare across both approaches. Very often, accurate tracking is achieved not just through the camera data but also by integrating ("sensor fusion") rotational data and linear acceleration data from on-board sensors. The sensors used and the quality of the sensor fusion algorithm would determine which approach is better.

Bottom line: for most applications, an 'outside-in' approach would be better, and thus we expect to see a greater number of 'outside-in' solutions on the market.


What has been your experience?


For additional VR tutorials on this blog, click here
Expert interviews and tutorials can also be found on the Sensics Insight page here

Monday, May 26, 2014

An overview of positional tracking technologies for VR

Photo Credit: 
Saad Faruque
 
via Compfight
Positional tracking is very important towards achieving immersion and presence in virtual reality. Whether it is the head, arms, fingers or objects (such as a weapon), positional tracking can deliver multiple benefits:

  • Change the viewpoint of the user to reflect actions such as jumping, ducking or leaning forward.
  • Show hands and other objects in the displayed image. A common complaint of users in virtual reality is that they can't see their hands.
  • Connect the physical and virtual world. For instance, by detecting hand position, a software program can implement the option to move virtual objects by touching them.
  • Detect gestures. By analyzing position over time, a gesture can be detected. For instance, a user might draw the number "8" in air and have the software detect it.
There are several methods of tracking position and I felt it is worthwhile to describe some of them. This post focuses on tracking for virtual reality applications, so we will not look at vehicle tracking, tracking of firemen in buildings and so forth. In no particular order, here are some of the popular tracking methods include magnetic, inertial, optical and acoustic tracking as well as hybrid tracking that combines multiple methods.

I've described these tracking methods as well as others such as depth map in a guest blog post at RoadToVR. Please click here to read that post on the RoadToVR site.


For additional VR tutorials on this blog, click here
Expert interviews and tutorials can also be found on the Sensics Insight page here