Research and implementation of bicycle roaming sys

  • Detail

Research and implementation of bicycle roaming system based on virtual reality technology

virtual reality is a computer-generated virtual world (environment) that gives people a variety of sensory stimuli. It is an advanced human-computer interaction system. An ideal virtual reality system should make users feel exactly the same when they interact with the virtual environment as in the real environment. Most of the existing roaming systems use two-dimensional interactive interfaces, that is, the mouse (two-dimensional input) and keyboard (linear input) are used as interactive devices, following the "window icon menu pointer" (wimp) operation paradigm, and the interaction mode is inharmonious and unnatural. Taking fitness as a tool of human-computer interaction, this paper designs a real-time bicycle roaming system vr-bws. Based on virtual reality technology, the system comprehensively uses sensor technology, DSP control technology, multi-threaded, non blocking data real-time communication technology, and realizes people's roaming in the virtual environment through multi-channel interactive technology such as stereoscopic display, so that participants can get the experience of riding in the virtual scene constructed by computer as in the real environment, It is a beneficial attempt to apply virtual reality technology to practice, and its application prospect is very broad

1 system composition and principle

when participants ride on a bicycle, the speed, direction, lifting time and strength of the bridle and the weight of the cyclist are collected in real time by sensors, and then transmitted to the upper computer through DSP control circuit. After analysis and processing, it is simulated and displayed in the virtual scene on the screen, and the effect of performance is achieved in the virtual scene; At the same time, when the scene in the screen changes, such as uphill and downhill, it can also be fed back to the controller of the bike through the control software to generate damping/driving force, so that the cyclist can have the feeling of uphill and downhill generated by the above scene, so as to obtain a good sense of immersion. The system composition is shown in Figure 1

2 key technology

2.1 human computer interaction sensor technology

in this bicycle roaming system, it mainly uses various sensors to capture various motion parameters produced by the human body acting on the bicycle in real time, input them to the computer, act on the virtual environment, and realize the interaction between human and the virtual environment

the sensors used in vr-bws include photoelectric encoder, angular displacement sensor and force sensor. Rotate synchronously with the wheel, record the pulse corresponding to the rotation angle of the bicycle wheel in an incremental coding mode, and then replace the detected pulse data with the number of rotation turns of the wheel, that is, the instantaneous position of the bicycle relative to a reference point; Vr-bws uses an angular displacement sensor to detect the handlebar angle and control the direction of the viewpoint and line of sight in the scene; In the scene, whether there are wide gullies and natural grabens is designed, and whether it can rush over is judged according to the weight and speed of the cyclist. It is simulated to fly over the great wall and the Yellow River. Therefore, force sensors are installed at the handlebars and seats of the bicycle to measure the lifting force and the weight of the human body

2.2 DSP control technology

the bottom control is completed by DSP system. The CPU of the DSP processing system adopts TMS320LF2407A produced by TI company. The chip is used to ensure the real-time bidirectional transmission of sensor data and terrain data between the upper computer and the lower computer, and reduce the delay of motion tracking and information feedback

2.2.1 real time acquisition of sensor data

in the event manager EV module of DSP, there is a quadrature coded pulse circuit QEP. After the circuit is enabled, the orthogonal coding pulse generated by the photoelectric encoder can be input on the coding and counting pins. The basis of the quadrature coded pulse circuit can be provided by the general timer. In the program, the general timer is set to the directional counting mode, and the quadrature coded pulse circuit is used as the clock source. The angle data and force data collected by the angular displacement sensor and force sensor are analog signals, which are stored in the result register after analog-to-digital conversion by the analog-to-digital conversion module (ADC) of DSP

2.2.2 multithreaded, non blocking real-time communication technology

tms320lf2407a serial communication interface SCI module can asynchronously communicate with PC through RS232 conversion chip. Because the data collected by the sensor in real time is transmitted to the upper computer for processing through the SCI serial port of DSP, and the terrain data in the virtual scene needs to be transmitted downward to control the output torque of the actuator, simulate the feeling of people riding a bicycle uphill and downhill, and set it to full duplex mode in the program

when using multi-channel sensors as the viewpoint tracking sensor for three-dimensional scene roaming, the status data of each sensor must be continuously collected from the serial port to track the changes of the observer to the viewpoint position and line of sight direction. There are usually two ways: (1) create a timer in the application; (2) Adopt multithreaded application framework. In the first method, because the control unit transmits state data to the host that will cause buffer failure at a fixed frequency, it is key to select an appropriate timing period for the timer, otherwise it is easy to cause data loss. In addition, because the application needs to constantly respond to the timer function, the rendering speed of 3D scene will inevitably be affected. The author adopts the second method, which is as follows:

in the VC environment, the real-time communication software based on RS232 protocol is developed, which can be directly connected with the software part of the virtual environment, and adopts a multithreaded, non blocking real-time roaming framework to monitor the serial port in the auxiliary thread. When there is data, it depends on event driven, reads the data and reports to the main thread; And waitcomment (), readfile (), WriteFile () all use non blocking communication technology, relying on overlapped read-write operations, so that serial port read-write operations run in the background. Whenever the main thread receives a new frame of data transmitted by the auxiliary thread, it first judges it. Only when its change relative to the state data of the previous frame exceeds the specified threshold can it start to update the scene display in the user viewport, so as to avoid unnecessary scene redrawing caused by the small movement of participants

2.3 construction of virtual scene and its real-time display technology

at present, from a technical point of view, the biggest difficulty of roaming is modeling and real-time rendering, which requires a compromise between the precision of the model and the rendering speed, which should not only ensure a certain rendering quality, but also not cause the user's motion discomfort. Various technologies are used in modeling and real-time display to ensure real-time performance

2.3.1 construction of virtual scene

each object in the virtual environment contains two aspects: shape and appearance. The model file used to store the geometric model in the virtual environment should be able to provide these two aspects of information. At the same time, it should also meet the requirements of three common indicators of virtual modeling technology - interactive display ability, interactive manipulation ability, and easy construction ability for virtual object model. It is easy to realize various transformations, shading, lighting, textures, interactive operations and animations of models in open GL, but it can only provide the modeling functions of basic geometric elements, which makes the modeling of complex models relatively difficult. 3D graphic modeling tools such as 3DMAX can easily establish various complex feature models, but it is difficult to program control. Therefore, the author establishes the complex model in 3DMAX and other tools, and realizes its convenient control and transformation in open GL

the software part of this system (vr-bws) needs to enjoy a variety of public 3D format file data, and at the same time, it should be associated with the database. The vr-bws data flow diagram is shown in Figure 2

2.3.2 real time display of 3D models

after building complex models in modeling tools such as 3DMAX, they can be stored in a variety of file formats. Considering that open GL provides the most basic method of constructing 3D models from polygons, it is stored in the form of triangular networks. The software part of vr-bws is based on object-oriented technology. The three-dimensional graphics class and the attribute classes necessary for rendering the scene, such as color class, texture class, material class, light source, etc., all use the face-to-face method to encapsulate the open GL function (as shown in Figure 3). Each component module of the software uses ocx control and com as the standard interface. This can not only greatly save development time, but also improve rendering speed

the most important feature of virtual reality is that people can feel the dynamic characteristics of the scene under the freely changing interactive control. The technology of improving display performance includes hardware and software. In terms of hardware, high-speed DSP chip is used for real-time data acquisition and transmission; In terms of software, a multithreaded and non blocking roaming framework is established, and the following methods are used to improve the refresh speed of the scene

(1) dual cache mechanism. Two video buffers are also established for the display, one for background refresh screen and one for foreground rendering. When it is necessary to update, switch the two buffers, and use the buffer originally used for refreshing to draw a new frame, while using the buffer originally used for drawing to refresh the display. The more complex the scenario is, the more time advantages of using the dual cache mechanism can be reflected. And the double buffer mechanism can solve the serious "screen flashing" phenomenon in the process of picture demonstration

(2) LOD (level of detail) level of detail technology. The models with different levels of detail are selected according to two different judgments: first, the objects close to the viewpoint are drawn with higher accuracy, and the objects far from the viewpoint are drawn with lower accuracy; The second is to set different thresholds through the speed of the bicycle, select models with different accuracy according to the thresholds, and then display them through smooth transition technology

(3) example technology. Scenes often require multiple identical virtual objects, such as identical trees. For such features that need to appear repeatedly, they are defined as separate display lists by using the display list function in the open GL library, and 3D entities are generated in advance; Then, the features in other positions are obtained through geometric transformation. When displaying graphics, you only need to call the required display list to display the corresponding three-dimensional entities, which greatly saves memory and improves the speed of graphics display

(4) pretreatment technology. For some complex scene models, such as high-rise buildings on both sides of the road, in the preprocessing stage, only the scenes displayed in the field of vision of the observer are calculated and stored. During dynamic display, there is no need to draw invisible objects and objects falling outside the defined observation space, so as to greatly reduce the testing and calculation of visibility during dynamic display

(5) replace the 3D model with 2D texture. For objects on very complex details in the roaming scene, such as vegetation on the mountain slope, if represented by a three-dimensional model, it will require a large number of polygons, but in the actual dynamic display, it is not necessary to express them very accurately, so the two-dimensional texture is used instead of the three-dimensional model. The method is to paste the image of complex features on a plane and place it in the scene. When the 3D complex scene is displayed in real time, the normal direction of the plane always points to the observation point. In this way, these complex objects rotate with the change of observation direction, which improves the real-time performance of scene display

3 stereoscopic display technology

three dimensional stereoscopic display technology is one of the key technologies of virtual reality. In order to realize the three-dimensional display of three-dimensional landscape, we must first get the "match three"

Copyright © 2011 JIN SHI