1. Introductions and Background

Drive simulator for ambulance is needed to reproduce special situation such as bad weather. But simulator for professional is not developed yet. Ambulance simulator has is developing in Metropolia University as one of project. Hardware part was almost developed and software part is just start.

2. Goal of my project

Simulator has to have function to read some information from map data of 3D format.

As first step, I trying to make function that realize to output height and angle data from input of coordinate data. And tested libcitygml library to handle map data.

3. Development environment

In my project, development environment is as follows.

IDE: Qt Creator

Language: C++

Added external library: libcitygml

I tried to use Microsoft Visual Studio at first, because hardware part of simulator had been controlled by program developed by Visual Studio. But I couldn’t build up with libcitygml in environment of Visual Studio. Therefore I used Qt Creator as prototyping.

4. Map data and CityGML

Map data that is 3D format and will be loaded by simulator is constructed by CityGML format. CityGML format is one of kinds of XML-based format. In XML-based format, all data is written with tags. Tags have many kinds and are able to express tree construction. CityGML format data is able to transform easily by libcitygml library to use in environment of C++ language. And, libcitygml is open source library.

5. Method

Transformed data by libcitygml is substituted for class of C++. I can choose kinds of filtering when substituting. Data of points have information about type of object, dependence relationship and x, y, z coordinate. I have to pick up and convert from many data of points to height and angle and optional input of coordinate. I realized it function divided by two parts.

5-1 Selection of points

Three points is needed to create surface and pick up function is realized formula as follows.

It is formula of distance between two points, x0,y0 are optional input of coordinate and xi,yi are transformed data from CityGML. This calculation does against all data of points and chooses the value fewest three points, finally.

5-2 Create of surface and calculation of intersections

Surface is created by three points data that is chosen by above formula. The equation of a plane is follows.

In this equation,  is got from data of points by using cross product and a normal vector. And, when substituting optional input to x and y, can get z that means height of map surface.

6. Experiments and results

Built function was tested using by two sample data. Sample data is as Fig.1 that picture is generated by FZK Viewer that is free software to read CityGML format. And call left picture sample 1 and right is sample 2 in Fig.1.

 

Fig.1 Data samples

Fig.2 Data of sample 1

Fig.2 is view from above. In this experiments, I run two routes, (1) is from left to right and (2) is from bottom to top. Fig.3 and Fig.4 are results. Blue line is surface of ground by height data and red line is angle of between surface and normal vector. And, both results could reproduce characteristic of geographic. But angle data is not reflected characteristic of slope.

Fig.3 Output results when moving followed to x-axis. (1)

Fig.4 Output results when moving followed to y-axis. (2)

Fig.5 is another sample. Sample 2 was experimented like same, mentioned above.

Fig.5 Data of sample 2

Fig.6 Output results when moving followed to x-axis. (3)

Fig.7 Output results when moving followed to y-axis. (4)

Both results captured characteristic of a ground but angle data was unstable as case of sample 1. I think that reason come from size of area to calculate angle. Because function only refers, to getting angle, small range, it doesn’t show characteristic.

7. Future plans

To calculate more correctly angle, I think approximation is better way. Make curve from near points and calculate tangent. Probably it way can reflect characteristic of slope better than now method.

8. Conclusion

I built function that can output height and angle data from input of coordinate data. Simulator can reflect to motion from condition of geography by this function. But angle data is not stable and not correctly. Function should be more improved by other method.

Reference

https://code.google.com/p/libcitygml/

https://qt-project.org

http://www.opengeospatial.org/standards/citygml

http://www.iai.fzk.de/www-extern/index.php?id=1123

http://www.citygml.org/index.php?id=1539

 

code.zip

  • No labels
You must log in to comment.