Haptic Data Transmission Based on the Prediction and Compression

In this paper, we present a floating-point compression method using position prediction for haptic data transmission. The main objective of our work is to reduce the size of bandwidth used for haptic data transmission in networked haptic virtual environments, such as remote-teaching or tele-operation, by compressing the size of packets composed of floating-point numbers. In order to compress floating-point numbers, we first analyze the characteristics of floating-point arithmetic and haptic data transmission. Then, we introduce a simple position prediction method for the movement of a haptic cursor (also known as a haptic pointer or haptic probe). Finally, we propose a compression method on the basis of those characteristics and prediction method. We also build an experimental test bed for the evaluation of the proposed method and conclude that our method is effective enough for improving haptic data transmission.


B. Haptic Data Transmission
In networked haptic applications, there exist various requirements such as high bandwidths, the low network latency, the high stability, and the synchronization. However, there has been extensive research related to the problems caused by the bandwidth limitations and latency (Hikichi et al., 2001), (Ishibashi & Asano, 2007). Time-varying network conditions pose challenges to successful communication of haptic data (Hikichi et al., 2001). Adverse network links sometimes cause irregular force-feedback which deteriorates the haptic experiences (You et al., 2007). The transmission of the haptic data, which mainly consists of the position information of haptic device pointers, is basically similar to multimedia streaming. However, it is much more demanding because the haptic rendering rate required for satisfactory haptic experience is quite higher than that of graphic rendering; 1 KHz for haptics, in contrast to 30 Hz for graphics. To meet such challenges, there have been various research efforts. For group synchronization control, Y. Ishibashi et al propose virtual time rendering algorithms (Ishibashi & Asano, 2007). Hikichi et al employ a queue monitoring algorithm (Hikichi et al., 2001) designed for efficient haptic collaboration. However, these approaches have limitations that they are not able to cope with delay, loss and jitter at the same time.

C. Floating-point Number Compression
In some environments, the fast transmission or the storage of large amounts of numerical data are required. Examples involve storing 3D geometry, sending statistical results over a network, and also sending haptic data which is composed of three floating-point numbers x, y and z. Since such data are too bulky, it is necessary to find a way to compress them efficiently in a lossless manner. There are some approaches for compressing the floatingpoint numbers (IEEE 754, 1985).

www.intechopen.com
Martin Isenburg, Peter Lindstrom, Jack Snoeyink from University of North Carolina have proposed a predictive geometry coding used for 3D mesh compression (Lindstorm & Isenburg , 2006), (Isenburg et al. , 2005), (Isenburg & Alliez, 2002). Paruj Ratanaworabbhan, Jian Ke, and Martin Burtscher have also designed a compression method of scientific floating-point data using a predictor and hash tables (Raranaworabhan et al., 2006). In addition, Costa Touma and Craig Gotsman from Israel Institute of Technology have developed a compression algorithm using entropy coding for triangle mesh compression (Touma & Gotsman, 1998). Even though all of these methods work differently, the main ideas of compression are mostly based on the characteristics of floating-point arithmetic. Those characteristics will be explained in the latter section.

Floating-Point Compression for Haptic Data Transmission
In networked haptic virtual environments, there exist various types of haptic devices. Some of those devices called stylus-type generate 3D positional information. The positional information usually consists of x, y and z coordinates which are represented in single precision floating-point numbers. The positions of haptic pointer play an important role to produce the force-feedback, since the position itself or the collision between the haptic pointer and an object are main factors for calculating the magnitude and the direction of force-feedback. Therefore, we usually need to transmit the positional information at the haptic rendering rate 1 KHz over the network in any networked haptic environment. In this case, we need to send at least 12 bytes per millisecond.
Our approach for compressing the haptic data is to compress the bit-representations of single precision floating-point numbers. It is to reduce the size of the haptic data packet (12 bytes) that consists of three floating-point numbers x, y and z. IEEE floating point is the most commonly used representations for real numbers on computers, including Intel-based PC's, Macintoshes, and most Unix platforms. For a single-precision 32-bit IEEE floating-point number, the sign s is a single bit that specifies whether the number is positive (s=0) or negative (s=1), the exponent e is an eight bit number with an added bias of 127 where 0 and

Advances in Haptics 378
255 are reserved for un-normalized near-zero and infinite values, and the mantissa m is a twenty-three bit number that is used to represent 223 uniformly-spaced numbers within the range associated with a particular exponent (IEEE 754, 1985). Figure 1 shows the configuration of a single precision 32-bit IEEE floating-point number. As shown in Table I, we can recognize that when there are small differences between floating-point numbers.
There occur only small changes in mantissa. Due to the configuration of a single precision 32-bit IEEE floating-point number, if the absolute difference between two floating-point numbers is small, the difference in mantissa is also small (IEEE 754, 1985). We propose an algorithm to compress haptic data using the idea discussed above. If we only transmit the different bits of 3D positions of a haptic pointer, the packet may vary from 0 byte to 12 bytes (0~4 bytes for x, y and z), contrary to the fact that without the compression, we have 12 bytes every millisecond. As discussed before, the position of the haptic pointer is sampled at 1 KHz and this indicates that the differences between consecutive floating-point numbers are relatively small. Figure  2 is the result from the experiment where we calculated the differences between consecutive positions of the haptic pointers. The number of positions that were used in the experiment was 6000. The maximum difference was 1.937969 while the average difference was 0.390084. This means that the differences are relatively small so changes in mantissa are also small. From the results of our experiment we found out that if we can make the differences smaller, then the amount of haptic data we need to transmit over a network will be smaller.

A. Position Prediction for Haptic Pointer
As discussed above, if we can get smaller differences we have smaller sizes of packets to send. In this section, we describe how the differences can be minimized by prediction. The haptic pointer, which represents the movement of the haptic device moves freely according to the user's will, so it seems to be impossible to predict the next position based on the previous positions. However, we can predict the next position with a certain acceptable error using the previous vector of the haptic pointer since haptic pointers are sampled very densely. We propose a simple position prediction method in order to minimize the difference between two floating-point numbers which are used for compression. Our method works as in Figure 3. If we can calculate the previous vector of the haptic pointer, we can predict the next position of the haptic pointer more precisely rather than just using the previous position The prediction method is executed as follows: where x n p is the predicted position while x n-1 corresponds to the previous position. v n denotes the velocity of the haptic pointer's position. The velocity v is computed by averaging the previously received positions.
In order to verify the efficiency of applying the linear prediction method to the prediction of haptic pointer, we performed an experiment comparing the error of using the prediction value x n p and using the previous position x n-1 to compare with the next position x n . The results of the experiment are shown in Figure 4. If we category one using the previous position as type 1 and the other using its prediction value as type2. The average errors are 0.249083 and 0.038881 for type 1 and type 2 respectively. Since type 2 shows a small error this means that using a linear prediction method will result in the efficiency of compression.

B. Predictive Haptic Data Compression
We compress the floating-point number by extracting the efficient bits from a floating-point number and its prediction, since the small difference in numbers results in a small difference

Advances in Haptics 380
in bit-representation of a floating-point number (IEEE 754, 1985). If the absolute difference between a floating-point number and its prediction value is small, the difference in mantissa is also small and we only need to transmit the difference in bit representation. In this section we examine how the compression of the haptic data proceeds for networked haptic applications. For the ease of explanation, we assume that there is a networked haptic application based on the master-slave model. Figure 5 shows the process of the haptic data transmission.

a) Initialization
To let both the master and the slave have the initiation values, a master sends the whole positional information at least twice. The init value will be stored in Prediction Module for further prediction.

b) Prediction
Prediction Modules in a master and a slave predict the next position based on the previously received position. For example as in Figure 5, the Prediction Module produces the prediction value -77.916992.

c) Encoder
With the actual position from the haptic device and the predicted position, the encoder performs an exclusive-or operation to compress the floating-point number x to the smaller number of bits; for example, the actual number -77.916916 which is 32bit long, can be reduced to 8 efficient bits and only those 8 bits are required to be sent. Encoder also performs the exclusive-or operation iteratively for y and z.

d) Packet Module
Packet Module is responsible for organizing the compressed data into a packet and putting a header onto the packet. Packet Module first calculates the number of the efficient bits of the results from Encoder. In Figure 5, only 11110110 has to be sent to the receiver. However, for the convenience of packetizing, we provide a packetizing policy as in Table 2. If the number of efficient bits are between 1~8, 2~16 and 17~24, we put the efficient bits in 1, 2, and 3 bytes. In addition, if the exponents of the actual position and the predicted position are different, the master transmits all of the positional information without compression for reliability. Packet Module also add to a packet a one byte header which describes the size of the efficient bits for x, y and z. Header X 0x00 0x40 0x44 Y 0x00 0x20 0x22 0x08 Z 0x00 0x10 0x11 Table 2. Examples of floating-point numbers in bit representation www.intechopen.com

e) Parsing Module
Once the slave receives a packet, Parsing Module disassembles the packet into a header and efficient bits of x, y and z.

f) Decoder
Decoder gets a predicted position and performs an exclusive OR operation with the efficient bits of x, y and z added with 0s in the front. Then, we finally regenerate the original position from the relatively small amount of bits.
As discussed above, if we can use the prediction and Exclusive Or operation properly, we don't have to send the 12 bytes(x, y and z) of long floating-point data for bulky haptic data which often cause network delays, losses, and jitters.

Experiment
We performed an experiment to evaluate the efficiency of the proposed compression method. In this section, we explain the test application, software configuration, hardware setup, experiment and results.

A. Test Application
The test application used in the experiment is a haptic device tele-operation application. It is composed of two parts: a master and a slave. The master sends the motion data to the slave and the slave outputs the force feed-back according to the motion data which consists of three floating-point numbers. The slave sometimes sends control messages to the master such as connect, ready, NAK and so forth to connect or control errors. The overview of the application is shown in Figure 6. This application is suitable for the test because we can feel the effects of network errors through both the sense sight and touch.

D. Experiments
We performed an experiment to evaluate the efficiency of the proposed method. The master mainly transmits its positional information to the slave and the haptic device of the slave follows the motion of the master. In order to assess our method, we measure the size of packets sent in six cases; five cases depending on the motions of the haptic pointer (1: stay static, 2: move slow, 3: draw 8, 4: draw *, 5: move fast and irregularly) and one without compression (6). Figure 8 shows the result of the transmission experiment for approximately four minutes. If we do not consider the UDP header, the average bandwidths used for the transmission are 7992.59bps (compression ratio 47.06%), 10574.76bps (62.27%), 11201.43bps (65.96%), 11441.18bps (67.37%), 11808.37bps (69.53%), and 16983 bps in the cases of 1, 2, 3, 4, 5, and 6 respectively. The result leads us to confirm that our compression method works efficiently for networked haptic applications. www.intechopen.com

Conclusion
We propose a floating-point haptic data compression in order to reduce the bandwidth which sometimes causes packet losses, jitters, and delays when being exceeded. Our compression method is based on the idea that the bit representations of consecutive floatingpoint numbers change slightly from the most significant bit. The exclusive OR operation helps extract the efficient bits from floating-point numbers and our prediction method produces a smaller difference between two consecutive floating-point numbers. Some experiments on our proposed method lead us to conclude that our method provides relatively high compression ratio, approximately 47.06%~69.53%. This will help the haptic data transmission even under limited bandwidth. For future work, we plan to work on the QoS algorithms which cope with significant delay, jitter, and loss for haptic applications (Cruz-Neira et al., 1993), (Marsh et al., 2004), (Fujimoto & Ishibashi, 2005).