Summary of the invention
The above-mentioned technical problem of the present invention is mainly addressed by following technical proposals:
A kind of method realizing GNSS/INS integrated navigation at Android inner nuclear layer, it is characterised in that including:
The step of one sensing data access agent module increased across hardware HAL: public based on Android operation system
Open-shelf structure, by GPS HAL kernel and the SensorHAL kernel of amendment standard android system, it is achieved Android bottom
Integrated Navigation Algorithm, and extend the GPS interface of android system, including:
One step increasing interface function: coordinate the work of sensing data access agent module, the interface function of increase
It is to start to expand and amendment, to realize data at HAL kernel, Linux from Java this locality calling layer in standard android system
Mutual between kernel-driven and sensing data access agent module;Wherein, interface function specifically includes:
Interface function one: in hardware/libhardware/include/hardware/gps.h, adds one group
IMUGpsInterface interface function, by the get_extension () of GpsInterface interface in standard Andorid kernel
Function is drawn, and needs in order to meet the relevant setting (such as type, the sample rate etc. of sensor of sensor) in integrated navigation and location
Ask;In standard Andorid kernel in the set_position_mode () of GpsInterface interface, extend GPS_
POSITION_MODE_IMU。
Interface function two: also respective extension relevant interface function in the JNI of GPS application framework layer,
:
frameworks/base/services/jni/com_android_server_location_
In GpsLocationProvider.cpp, add the function corresponding to IMUGpsInterface interface and supply
GpsLocationProvider calls,
:
frameworks/base/services/java/com/android/server/location/
In GpsLocationProvider.java, add native function and call the IMUGpsInterface interface letter in JNI
Number, adds the station-keeping mode GPS_POSITION_MODE_IMU corresponding with GPS HAL layer at GpsLocationProvider,
The station-keeping mode by user selects that arranges in arranging according to system is delivered to HAL layer.
In a kind of above-mentioned method realizing GNSS/INS integrated navigation at Android inner nuclear layer, again realize standard
Relevant interface in the Sensor HAL kernel of Android and data access function so that it is by newly-installed sensing data
Agency (Sensor Data Agent, SDA) interacts with inertial sensor hardware;The GPS HAL of extension standards Android
Kernel so that it is also be able to be interacted with inertial sensor hardware by SDA.By SDA, can by GNSS hardware data with
Sensor hardware data is directed in any one HAL kernel, thus realizes Integrated Navigation Algorithm.Specifically include standard
The process that the Sensor HAL and GPS HAL of Android modifies:
Process one: modify the Sensor HAL of standard Android, by inertia sensings various in standard Android
The SensorBase module definition that device unification is is IMUProxySensor, SensorBase derive from;From application program-oriented method
The calling logic that drives to sensor hardware of SensorService basic service as follows:
The SensorService calling 1:Sensor application framework layer drives file to load acquisition from Sensor HAL
After sensor_poll_device_t, IMUProxySensor can be initialized.When initializing IMUProxySensor, pass through
Socket is connected in SDA module;
The getSensorList function that calling 2:SensorService is provided by sensor_moudle_t obtains
Sensor HAL drives the sensor list supported.IMUProxySensor sends SDA_GET_SENSOR_LIST to SDA module
Message, SDA module is called the getSensorList () interface of internal data read module and is obtained the sensing that IMUSensor supports
Device list also returns to IMUProxySensor by SDA_SENSOR_LIST message;
Call 3: when application program asks inertial sensor data to SensorService when, SensorService
Arranged by the setDelay () and enable () interface calling IMUProxySensor and need to open adopting of sensor and correspondence
Sample rate.IMUProxySensor sends SDA_SENSOR_LIST and SDA_ACTIVE message and calls to SDA module, SDA module
In data read module, parameter is arranged in inertial sensor hardware module by the corresponding interface of IMUSensor;
Call 4:SDA module read by data read module send after IMU data SDA_MESSAGE message to
IMU data in the message that IMUProxySensor, IMUProxySensor will receive are uploaded to SensorService,
SensorService presents the result to application program.
Process two: the amendment being made the GPS HAL implementation method of standard Android, the IMU module of GPS HAL layer is visited
That asks sublayer and SDA module meets following calling logic alternately:
Call 1: in the GPS HAL of standard Andorid, newly increase one " IMU module accesses sublayer ", its effect be with
SDA communication obtains the data of inertial sensor.Corresponding, it is that the GPS HAL kernel of standard Andorid is usually provided with
" GNSS module access sublayer ", in order to obtain GNSS hardware data;
Call 2: be typically implemented method according to the GPS HAL of standard Andorid, can adjust when initializing GPS HAL
By its basic interface GpsInterface::init () (realization of the corresponding present invention is referred to as iwise_loc_int ()), the present invention
In the realization of this interface function, increase the initialization to " IMU module accesses sublayer ", and be passed to socket and be connected to SDA
Module;
Call 3: when initializing GPS HAL, GpsLocationProvider from system arrange middle acquisition station-keeping mode,
Sensor, the sample rate of sensor and the growth data opened, adds by calling set_position_mode interface and the present invention
Configuration information is saved in integrated navigation and location and realizes the shared data of sublayer by the group interface in the IMUGpsInterface added
In iwise_data_t (see table 18 in the claims in the present invention point 4);
Call 4: when upper layer application request GPS navigation location when, GPS application framework layer can call standard Andorid
The GpsInterface::start () realization of the present invention (corresponding be referred to as iwise_loc_start_fix ()) of GPS HAL connect
Mouthful.If station-keeping mode now is that GPS_POSITION_MODE_IMU, IMU module accesses sublayer is from shared data iwise_
Data_t obtains the sensor needing to open and the sample rate of sensor, is disappeared by SDA_ACTIVE and SDA_SET_DELAY
Breath is sent to SDA module.The data read module of SDA inside modules can send SDA_MESSAGE after reading IMU data and disappear
Breath to IMU module accesses sublayer, and then return to integrated navigation and location realize sublayer be combined navigator fix resolve;
Call 5: when application program stops GPS navigation location when, GPS application framework layer can call standard
(realization of the corresponding present invention is referred to as iwise_loc_stop_fix to the GpsInterface::stop () of the GPS HAL of Andorid
()) interface, IMU module accesses sublayer sends SDA_STOP message to SDA module to stop IMU request of data.
At a kind of above-mentioned method realizing GNSS/INS integrated navigation at Android inner nuclear layer, described sensing data
Access agent module starts when android system system_server loads;Digital independent and caching thread data_
Thread is driven from sensor hardware in FIFO mode by the IMUsensor access interface in sensing data access agent module
Dynamic upper acquisition sensing data also caches;Sensing data access agent module passes through communication service end line journey, with standard
Each HAL kernel of android system interacts.When the HAL kernel needing sensing data accesses generation to sensing data
After reason module initiates successful connection, sensing data access agent module is responsible for pushing sensing data to it;Described sensor
Data access proxy module includes:
One SDA communication module: carry out data interaction, by server_ with IMUProxySensor and IMU module accesses sublayer
Thread and message processing module composition;
One SDA control information module: the sensor that in store client side list and the needs arranged by client are opened
And the sampling rate information of sensor
One data buffer storage: be used for preserving the IMU data of reading recently, the data_thread of data read module write
Data, server_thread be sent to client after taking out
One data read module: the data_thread of this data read module calls the interface of the IMUSensor of inside to be come
Obtain IMU data, then write data in the data buffer storage of sda_context_t;IMUSensor in data read module
Mutual with inertial sensor hardware driving, it is provided that inertial sensor parameter to be set and reads the interface of IMU data.
One IMUSensor: be arranged in data read module, mutual with inertial sensor hardware driving, it is provided that to arrange used
Property sensor parameters and read IMU data interface.
In a kind of above-mentioned method realizing GNSS/INS integrated navigation at Android inner nuclear layer, also include growth data
Access: in the GPS HAL of Andorid increase an integrated navigation and location realize sublayer, it is achieved based on GNSS data with
The soft resolving of integrated navigation of Sensor data, and the position coordinates result obtained with soft resolving reports Andorid upper strata.And lead to
Cross the Java layer at Android and increase new api function, it is thus achieved that the most vehicle-mounted attitude letter that Integrated Navigation Algorithm obtains
Breath, including course angle, the angle of pitch, roll angle.
Therefore, present invention have the advantage that therefore, present invention have the advantage that 1, Android third-party application is opened
Originator calls the common position location API of original standard GNSS, can obtain high-precision integrated navigation positioning result;2, existing Android
Third party application, without modifying, can directly obtain high-precision integrated navigation positioning result;3, call this method to exist
The API that Java framework layer newly increases, obtains the most vehicle-mounted attitude information (course angle, the angle of pitch, horizontal stroke in Java application layer
Roll angle etc.).These information are that vehicle App application developer is sought after..
Embodiment:
One, the integral frame of the present invention is first introduced.
A kind of hardware abstraction layer from Android operation system (Hardware Abstraction involved in the present invention
Layer, HAL) start, the most successively realize method and the module of integrated navigation correlation function.Public based on Android operation system
Open-shelf structure, by GPS HAL kernel and the Sensor HAL kernel of amendment standard android system, and increases by one across firmly
Sensing data access agent (Sensor Data Agent, the SDA) module of part HAL, it is achieved the combination of Android bottom is led
Boat algorithm.In standard android system, increase integrated navigation and location pattern, and call (Java Native from Java this locality
Interface, JNI) layer starts to expand and have modified the interface function of a collection of correlation function.
As it is shown in figure 1, this method is based on the open framework of Android operation system, relate to the GPS application of android system
Ccf layer, GPS HAL layer and Sensor HAL layer.Present method invention content relates to yellow shadow region in Fig. 1.
(1) first introduce the data stream of each intermodule of Fig. 1, illustrate by labelling 1-labelling 15.
Labelling 1 and labelling 3 are that the SensorBase interface of the Sensor HAL of standard Android passes to Linux sensing
What device drove arranges data.Concrete data message is as shown in table 1.
Table 1SensorBase interface pass to Linux sensor drive data are set
Labelling 2 and labelling 4 are the sensing data read from sensor hardware drives.Labelling 2 represents IMU sensing
Sensing data outside device, unrelated to the invention therefore do not repeat;Labelling 4 represents the data of IMU sensor, real with the present invention
As a example by the mpu6050 chip that example uses, a packet is made up of accelerometer and gyro data, and data length is 15 words
Joint, its form such as table 2.
The Frame of the mpu6050 chip that table 2 present example uses
Skew |
Data |
Explanation |
0 |
ACCEL_XOUT[15:8] |
A high position for accelerometer X-direction numerical value |
1 |
ACCEL_XOUT[7:0] |
The low level of accelerometer X-direction numerical value |
2 |
ACCEL_YOUT[15:8] |
A high position for accelerometer Y direction numerical value |
3 |
ACCEL_YOUT[7:0] |
The low level of accelerometer Y direction numerical value |
4 |
ACCEL_ZOUT[15:8] |
A high position for accelerometer Z-direction numerical value |
5 |
ACCEL_ZOUT[7:0] |
The low level of accelerometer Z-direction numerical value |
6 |
GYRO_XOUT[23:16] |
The reservation of gyroscope X-direction numerical value is high-order |
7 |
GYRO_XOUT[15:8] |
A high position for gyroscope X-direction numerical value |
8 |
GYRO_XOUT[7:0] |
The low level of gyroscope X-direction numerical value |
9 |
GYRO_YOUT[23:16] |
The reservation of gyroscope Y direction numerical value is high-order |
10 |
GYRO_YOUT[15:8] |
A high position for gyroscope Y direction numerical value |
11 |
GYRO_YOUT[7:0] |
The low level of gyroscope Y direction numerical value |
12 |
GYRO_ZOUT[23:16] |
The reservation of gyroscope Z-direction numerical value is high-order |
13 |
GYRO_ZOUT[15:8] |
A high position for gyroscope Z-direction numerical value |
14 |
GYRO_ZOUT[7:0] |
The low level of gyroscope Z-direction numerical value |
Labelling 5, labelling 6, labelling 7 and labelling 8 are Sensor HAL and GPS HAL is with between C/S model and SDA module
The data message of transmission.Standard Socket communication mode is used to realize in present example.Definition sda_message_t makees
For message frame, the composition of message frame is as shown in table 3, and type of message is shown in Table 4.This explanation emphasis illustrate by inertial sensor data with
SDA module connects.For the data such as optical sensor, barometer are the most consistent with the principle that SDA connects and method, therefore do not go to live in the household of one's in-laws on getting married
State.
Labelling 11 and labelling 13 are control information GPS HAL kernel within after amendment, control information in present example
Pass through Sharing Memory Realization.
Table 3 message frame sda_message_t
The message type field of table 4 message frame sa_message_t
Labelling 9 is that upper strata is toward the auxiliary information of injection in GNSS hardware module.
Labelling 10 is the data read from GNSS locating module, including 1. with the location of standard NMEA0183 form output
Result data;If 2. GNSS locating module is provided that original observation information (such as Pseudo-range Observations, carrier phase observation data etc.), then
Export with the reference format of RTCM 2.3.
Labelling 12 is inertial sensor data structure imu_data_ that integrated navigation and location of the present invention realizes required for sublayer
T, is converted to imu_ by IMU module accesses sublayer by the sensor_event_t list pointed by SDA_MESSAGE in table 4
Data_t structure.Sensor_event_t is the general purpose transducer data structure of standard android system definition, real in the present invention
In the Android4.2.2 version that example uses, the definition of its structure is shown in Table 5, and the definition of imu_data_t structure is shown in Table 6.
The structure definition of table 5sensor_event_t
The definition of table 6imu_data_t structure
Field |
Explanation |
Type |
time |
Timestamp, the second (s) |
double |
gyro_x |
Gyroscope x-axis direction values, spends (degree) |
double |
gyro_y |
Gyroscope y-axis direction values, spends (degree) |
double |
gyro_z |
Gyroscope z-axis direction values, spends (degree) |
double |
accel_x |
Accelerometer x-axis direction, metre per second (m/s) (m/s) |
double |
accel_y |
Accelerometer y-axis direction, metre per second (m/s) (m/s) |
double |
accel_z |
Accelerometer z-axis direction, metre per second (m/s) (m/s) |
double |
Labelling 14 is the location information structure gnss_data_t that this method integrated navigation and location realizes that sublayer needs.
GNSS module accesses sublayer and the locating result information in labelling 10 and the parsing of original observation information is converted to gnss_data_t knot
Structure body, its definition is as shown in table 7.
The definition of table 7gnss_data_t structure
Field |
Explanation |
Type |
time |
Timestamp, the second (s) |
double |
latitude |
Latitude, spends (degree) |
double |
longitude |
Longitude, spends (degree) |
double |
height |
Height, rice (m) |
double |
speed_n |
Speed, north orientation, metre per second (m/s) (m/s) |
double |
speed_e |
Speed, east orientation, metre per second (m/s) (m/s) |
double |
speed_u |
Speed, sky is to, metre per second (m/s) (m/s) |
double |
pos_stdeva_n |
Location criteria is poor, north orientation, rice (m) |
double |
pos_stdeva_e |
Location criteria is poor, east orientation, rice (m) |
double |
pos_stdeva_u |
Location criteria is poor, and sky is to, rice (m) |
double |
speed_stdeva_n |
Velocity standard is poor, north orientation, metre per second (m/s) (m/s) |
double |
speed_stdeva_e |
Velocity standard is poor, east orientation, metre per second (m/s) (m/s) |
double |
speed_stdeva_u |
Velocity standard is poor, and sky is to, metre per second (m/s) (m/s) |
double |
Labelling 15 is the data that can provide other auxiliary data information for integrated navigation and location module, can in present example
Introduce the information such as magnetic compass transmitter data, temperature sensor, gesture stability information, vehicle CAN bus information, be shown in Table 8.
Other auxiliary data information of table 8 defines
(2) interface that the present invention standard android system on the basis of extend is described below.
As in figure 2 it is shown, in hardware/libhardware/include/hardware/gps.h, add one group
IMUGpsInterface interface function, by the get_extension () of GpsInterface interface in standard Andorid kernel
Function is drawn, and needs in order to meet the relevant setting (such as type, the sample rate etc. of sensor of sensor) in integrated navigation and location
Ask;In standard Andorid kernel in the set_position_mode () of GpsInterface interface, extend GPS_
POSITION_MODE_IMU.Newly-increased interface is as shown in table 9.
Table 9IMUGpsInterface increases interface function newly
Adapt with GPS HAL, this method also respective extension relevant interface function in the JNI of GPS application framework layer.
As it is shown on figure 3, frameworks/base/services/jni/com_android_server_location _
In GpsLocationProvider.cpp, add the function corresponding to IMUGpsInterface interface and supply
GpsLocationProvider calls, as shown in table 10.At frameworks/base/services/java/com/
In android/server/location/GpsLocationProvider.java, add native function and call in JNI
IMUGpsInterface interface function, as shown in table 11.Add relative with GPS HAL layer at GpsLocationProvider
The station-keeping mode GPS_POSITION_MODE_IMU answered, station-keeping mode user selected that arranges in arranging according to system passes
It is delivered to HAL layer.
The Function Mapping table of table 10JNI adds new interface mappings relation
Native function name in Java |
Pa-rameter symbols |
C c++ function name |
native_set_imu_gps_rate |
(I)V |
android_location_GpsLocationProvider_set_imu_gps_rate |
native_set_imu_gps_sensor |
(J)V |
android_location_GpsLocationProvider_set_imu_gps_sensor |
native_imu_gps_inject_extern_data |
(I[BI)V |
android_location_GpsLocationProvider_imu_gps_inject_extern_data |
The interface that table 11GpsLocationProvider increases newly at application framework layer and JNI layer
Two, the concrete framework of involved in the present invention SDA proxy module is described below.
Hardware HAL layer lower floor in standard Android operation system is provided for the SDA module of inertial navigation, its feature
It is: associated sensor data (including 3 axle gyroscopes, 3 axis accelerometers, barometer, magnetometer etc.) is respectively directed to
The GPS HAL kernel of android system and Sensor HAL kernel;Again the Sensor HAL kernel of standard Android is realized
In relevant interface and data access function so that it is interacted with inertial sensor hardware by SDA;Extension standards
The GPS HAL kernel of Android so that it is also be able to be interacted with inertial sensor hardware by SDA.
By SDA, GNSS hardware data and Sensor hardware data can be directed in any one HAL kernel, from
And realize integrated navigation in this kernel.Implemented below is to be combined the method explanation of navigation calculation in GPS HAL.
(1) amendment that the Sensor HAL implementation method of standard Android is made.
As shown in Figure 4, standard Android kernel defines for sensor hardware in sensor_poll_device_t structure
Activate, setDelay and poll tri-basic interfaces.Standard Android system defines the knot of entitled SensorBase
Structure is in order to abstract various sensor hardware, and preserves the various sensors of current support with the list of a SensorBase.
The interface list of SensorBase is as shown in table 12, and three basic interfaces of sensor_poll_device_t can call further
These SensorBase interfaces.
The interface list of the SensorBase of table 12 standard Android
In the implementation, it is contemplated that different hardware devices can the most different inertial sensor of integrated value volume and range of product, therefore
The usual way of industry is that unifying abstract by various inertial sensors is a SensorBase module.When application program need to access not
With hardware time, identify different sensors with handle parameter, the Android 4.2.2 version that example of the present invention is based on
Value corresponding to the sensor supported and handle is as shown in table 13.In the present example, the unification of inertial sensor is taken out
As the named IMUProxySensor of module, SensorBase derive from.
Sensor list and handle value in table 13Android 4.2.2 version
After adding SDA module, drive to sensor hardware from the SensorService basic service of application program-oriented method
Dynamic calling logic is as shown in Figure 5:
The SensorService of Sensor application framework layer drives file to load from Sensor HAL and obtains sensor_
After poll_device_t, IMUProxySensor can be initialized.When initializing IMUProxySensor, by socket even
Receive in SDA module;
The getSensorList function that SensorService is provided by sensor_moudle_t obtains Sensor
HAL drives the sensor list supported.IMUProxySensor sends SDA_GET_SENSOR_LIST message to SDA module,
SDA module is called the getSensorList () interface of internal data read module and is obtained the sensor list that IMUSensor supports
And return to IMUProxySensor by SDA_SENSOR_LIST message;
When application program asks inertial sensor data to SensorService when, SensorService is by adjusting
SetDelay () and enable () interface with IMUProxySensor arrange the sample rate needing to open sensor and correspondence.
IMUProxySensor sends SDA_SENSOR_LIST and SDA_ACTIVE message and calls data to SDA module, SDA module
In read module, parameter is arranged in inertial sensor hardware module by the corresponding interface of IMUSensor;
SDA module read by data read module send after IMU data SDA_MESSAGE message to
IMU data in the message that IMUProxySensor, IMUProxySensor will receive are uploaded to SensorService,
SensorService presents the result to application program.
(2) amendment that the GPS HAL implementation method of standard Android is made.
It is that the present invention realizes logic chart according to what the GPS HAL specification of standard Android was worked out as shown in Figure 6.Accordingly
Function declaration such as table 14, table 15.
Table 14 this method realizes the interface function in sublayer at the abstract sublayer of GNSS and integrated navigation and location
Table 15 action type code and operating instruction
Table 16 callback events type and operating instruction
Callback events type |
Explanation |
IWISE_LOC_EVENT_LOCATION_REPORT |
Report positioning result (with numeric form) |
IWISE_LOC_EVENT_SATELLITE_REPORT |
Report satellite state information |
IWISE_LOC_EVENT_STATUS_REPORT |
Report positioning states |
IWISE_LOC_EVENT_NMEA_REPORT |
Report positioning result (with NMEA form) |
As it is shown in fig. 7, be the IMU module accesses sublayer interaction figure with SDA module of GPS HAL layer.
Newly increasing one " IMU module accesses sublayer " in the GPS HAL of standard Andorid, its effect is to communicate with SDA
Obtain the data of inertial sensor.Corresponding, it is " the GNSS mould that is usually provided with of the GPSHAL kernel of standard Andorid
Block access sublayer ", in order to obtain GNSS hardware data;
GPS HAL according to standard Andorid is typically implemented method, can call its base when initializing GPS HAL
This interface GpsInterface::init () (realization of the corresponding present invention is referred to as iwise_loc_int ()), the present invention connects at this
The realization of mouthful function increases the initialization to " IMU module accesses sublayer ", and is passed to socket and is connected to SDA module;
When initializing GPS HAL, GpsLocationProvider arranges middle acquisition station-keeping mode from system, opens
Sensor, the sample rate of sensor and growth data, by calling what set_position_mode interface and the present invention added
Configuration information is saved in integrated navigation and location and realizes the shared data of sublayer by the group interface in IMUGpsInterface
In iwise_data_t (see table 18 in the claims in the present invention point 4);
When upper layer application request GPS navigation location when, GPS application framework layer can call the GPS of standard Andorid
GpsInterface::start () (realization of the corresponding present invention is referred to as iwise_loc_start_fix ()) interface of HAL.As
Fruit station-keeping mode now is that GPS_POSITION_MODE_IMU, IMU module accesses sublayer is from shared data iwise_data_t
Middle acquisition needs sensor and the sample rate of sensor opened, and is sent by SDA_ACTIVE and SDA_SET_DELAY message
To SDA module.The data read module of SDA inside modules can send after reading IMU data SDA_MESSAGE message to
IMU module accesses sublayer, and then return to integrated navigation and location realize sublayer be combined navigator fix resolve;
When application program stops GPS navigation location when, GPS application framework layer can call the GPS of standard Andorid
GpsInterface::stop () (realization of the corresponding present invention is referred to as iwise_loc_stop_fix ()) interface of HAL, IMU mould
Block access sublayer sends SDA_STOP message to SDA module to stop IMU request of data.
Involved in the present invention sensing data is described below and acts on behalf of the particular hardware structure of SDA module.
The sensing data of inertial navigation sensors chip (or module) acts on behalf of SDA by SDA module by SDA communication module, SDA
Control information, data buffer storage, data read module and IMUSensor composition.It is characterized in that: 1. SDA module is in android system
Start when system_server loads;2. digital independent and caching thread data_thread are by IMUsensor access interface
From sensor hardware drives, obtain sensing data in FIFO mode and cache;3. SDA passes through communication service end line journey, with mark
Each HAL kernel of quasi-android system interacts.When the HAL kernel needing sensing data initiates to connect to SDA module
After success, SDA module is responsible for pushing sensing data to it.
As shown in Figure 8, SDA module is shared data (sda_context_t), digital independent mould by SDA communication module, SDA
Block forms.SDA communication module and IMUProxySensor and IMU module accesses sublayer carry out data interaction, by server_
Thread and message processing module composition;In the present invention, server_thread receives and dispatches sda_message_t message by socket
To carry out data interaction with client;The sda_message_t message that message processing module dissection process receives.sda_
Context_t comprises control information and data buffer storage, and its definition is shown in Table 17;The in store client side list of control information and by visitor
The information such as sensor that the needs that family end is arranged are opened and the sample rate of sensor;Data buffer storage is used for preserving reading recently
IMU data, are write data by the data_thread of data read module, server_thread are sent to client after taking out
End.The data_thread of data read module calls the interface of IMUSensor of inside to obtain IMU data, then by data
In the data buffer storage of write sda_context_t;IMUSensor in data read module hands over inertial sensor hardware driving
Mutually, it is provided that inertial sensor parameter is set and reads the interface of IMU data.
The context mechanism body sda_context_t of table 17SDA module
As it is shown in figure 9, the initial work of SDA module is put into inside system_server by present example, in standard
In android system, system_server can call during system start-up.The initial work of SensorService
Also complete in system_server, need the initial work ensureing SDA module before SensorService.SDA mould
Server_ can be started after being provided with for sda_context_t storage allocation the initial value arranging each field during initialization block
Two threads of thread and data_thread are to complete to initialize.
In present example, the status field references of the sda_context_t state of SDA in table 17, SDA is whole
Life cycle has 4 kinds of states, is SDA_STATUS_NULL, SDA_STATUS_INITED, SDA_STATUS_START respectively
And SDA_STATUS_STOP.When dividing situation explanation SDA to change between each state below, the duty of each module.
Sight one: android system is called system_server and completed to initialize after starting, present example exists
System_server adds sda_init function to complete the initialization procedure of SDA.First sda_init initializes
The control information of SDA and be data buffering application memory headroom, now the state of SDA is SDA_STATUS_NULL.Start afterwards
Server_thread and data_thread, server_thread monitor designated port and wait request of data, server_
Thread, as service end, regards IMUProxySensor or IMU module accesses sublayer as client, now data_thread
In a dormant state;After SDA has initialized, state is changed into SDA_STATUS_INITED state.
Sight two: when have upper layer application open navigation or request inertial sensor data time, IMUProxySensor or
IMU module accesses sublayer initially sets up the connection with SDA as client, then sends request of data to server_thread.
After server_thread receives request of data, server_thread arranges, according to request data, the sensor needing to open and adopts
Sample rate, SDA state is become SDA_STATUS_START, data_thread from SDA_STATUS_INITED and is transferred to by resting state
State of activation, calls IMUSensor to read data, and the data that IMUSensor reads are put into data buffering by data_thread
District, server_thread is sent to client after sensing data is read in data buffer zone.Data_thread and server_
Synchronization between thread and mutual exclusion are to be ensured by lock sda_sensor_lock and conditional-variable sda_sensor_cond
's.
Sight three: when SDA has been in SDA_STATUS_START state, if receiving new client request, now
IMUProxySensor and IMU module accesses sublayer is all to SDA request data.Server_thread please according to two clients
The sensor asked and sample rate, the union of the sensor choosing they requests arranges the sensors field of sda_context_t,
And to arrange labelling sensors_changed be 1;That chooses less in the sampling delay time (relatively high sampling rate) arranges sda_
The delay field of context_t, and to arrange labelling delay_changed be 1.Data_thread detects sensors_
When changed and delay_changed is 1, enable and the setDelay interface that can call IMUSensor is configured, if
After having put, sensors_changed and delay_changed is set to 0.
Sight four: if the client being connected to SDA is become one from two, i.e. IMUProxySensor or IMU module is visited
Ask sublayer one of them stopping request data.After server_thread receives SA_STOP request, traversal sda_context_t's
Client side list, the union of the sensor choosing the request of existing customer's end arranges sensors and arranges labelling sensors_
Changed is 1, and the minima chosen in the time delay of existing customer's end request is set to the value of delay and arranges labelling
Delay_changed is 1.Data_thread detects when sensors_changed and delay_changed is 1, can call
Enable and the setDelay interface of IMUSensor is configured, by sensors_changed and delay_ after being provided with
Changed is set to 0.
Sight five: when all of client all stops request data, and server_thread receives SA_STOP and asks and examine
The number measuring the client now connected is 0, and the state of SDA is changed into SDA_STATUS_ by SDA_STATUS_STAR
STOP.Data_thread detects that state can stop after being changed into SDA_STATUS_STOP reading data, and enters dormancy shape
State.
The acquisition concrete grammar of involved in the present invention other data is described below.
As described in claim point 1, the GPS HAL kernel of standard Android is modified to support the mode of integrated navigation,
Integrated Navigation Algorithm being put into integrated navigation and location and realizes sublayer, algorithm is not protected itself.It is characterized in that: in the reality of GPS HAL
Realizing the soft resolving of integrated navigation in existing sublayer, the result replacing GNSS hardware by the result of soft resolving reports.
As shown in Figure 10, integrated navigation and location realize sublayer GPS module access sublayer will read from location hardware
Positioning result data and original observation information resolve and be converted to gnss_data_t data structure and be put into sharing data area;Another
Aspect, after IMU module accesses sublayer obtains IMU data by SDA module, resolves to imu_data_t data structure and is put into shared
Data field;Present example also supports the introducing of other assistance data, such as magnetic compass transmitter data, gesture stability information, car
The information such as CAN information;Integrated navigation and location module copies out gnss_data_t and imu_data_t from sharing data area
Adjust after calculation result is packaged as after resolving after data event_payload_u_type (structure definition is shown in Table 18) structure
Uploading with event_callback call back function, the report thread of the abstract sublayer of GNSS is activated, by sharing data area
Event_payload_u_type data parsing is converted to the positioning result form that upper strata needs, and recalls respective call back function
Positioning result is uploaded to upper strata.
Table 18event_payload_u_type defines
(1) the various data structure bodies that integrated navigation and location realizes in sublayer are first introduced.
In the present invention, the input of Integrated Navigation Algorithm includes inertial sensor data imu_data_t (being shown in Table 6), and location is hard
Number of packages is according to gnss_data_t (being shown in Table 7) and other auxiliary information (being shown in Table 8).The calculation result of Integrated Navigation Algorithm is by event_
Payload_u_type (being shown in Table 18) represents.
Integrated navigation and location realizes sublayer can initialize this layer when calling iwise_loc_init and carrying out initialized
Required sharing data area, control structure and thread etc..Present example preserves this with iwise_data_t structure
A little data, in its structure, each field is as shown in table 18.
Table 18 integrated navigation and location realizes sublayer and shares data iwise_data_t
(2) introduce each thread during integrated navigation and location drives and perform the control of flow process.
In present example, IMU module accesses sublayer, GPS module access sublayer and integrated navigation and location realize sublayer it
Between collaborative be to be controlled by the quantity of state in synchronization control module and the lock of shared data module and semaphore.
When there being finder request location, the iwise_start_fix interface of the abstract sublayer of GNSS sends state and changes letter
Number amount status_cond.IMU module accesses sublayer, GPS module access sublayer and integrated navigation and location realizes sublayer and receives signal
It is activated after amount, initially enters duty.
GPS module accesses sublayer and opens and initialize serial ports, reads positioning result data and original observation letter from serial ports
After breath, resolved and be converted to gnss_data_t structure, need afterwards to obtain the lock that sharing data area is operated
Data_lock, then copies analysis result to the gnss_data field of sharing data area, and updates gnss_data_
Updated is 1, has copied and has discharged lock afterwards.
First IMU module accesses sublayer is set up with SDA module and is connected, after receiving the SA_MESSAGE message that SDA returns,
Resolved and be converted to imu_data_t structure, copy the imu_data of sharing data area to and send resolve_cond letter
Number amount the integrated navigation and location of waiting signal amount may realize sublayer to activate.All needed before sharing data area is operated
First to obtain lock data_lock, operate and needed release lock afterwards.
Integrated navigation and location realizes after sublayer is activated, and waiting signal amount resolve_cond, if before waiting time-out
Receive semaphore, then obtain the lock data_lock that sharing data area is operated, copy out imu_data from sharing data area
Data, then check gnss_data_updated whether be 1, if 1 data copying out gnss_data, copy completes
Discharge lock afterwards;If waiting time-out, then enter and wait next time.After successfully copying out data, integrated navigation and location realizes son
Layer calls gives the abstract sub-layer processes of GNSS after location algorithm calculates positioning result.
By lock data_lock and semaphore resolve_cond, IMU module accesses sublayer, GPS module access sublayer and
Integrated navigation and location realize the multiple threads in sublayer achieve be combined in an orderly manner navigator fix resolve.
(3) control of multiple station-keeping mode switching during integrated navigation and location drives is introduced.
User changes station-keeping mode by changing system settings, and GpsLocationProvider detects that system is arranged
In station-keeping mode change after, call set_position_mode interface and new station-keeping mode arranged in GPS HAL.?
Three kinds of station-keeping modes defined in standard android system: GPS_POSITION_MODE_STANDALONE, GPS_
POSITION_MODE_MS_BASED, GPS_POSITION_MODE_MS_ASSISTED, the present invention is that integrated navigation and location increases
GPS_POSITION_MODE_IMU station-keeping mode.Two kinds of situations of station-keeping mode switching in following discussion driving.
Sight one: station-keeping mode is converted to other station-keeping mode by GPS_POSITION_MODE_IMU.Location detected
After pattern becomes other station-keeping modes, IMU module accesses sublayer enters resting state after disconnecting the connection with SDA;Integrated navigation
Location realizes sublayer and exits positioning calculation entrance resting state;GPS module access sublayer after reading positioning result data not
It is reconverted into gnss_data_t, but after being converted directly into event_payload_u_type structure, passes to the abstract sublayer of GNSS.
Sight two: station-keeping mode is converted to GPS_POSITION_MODE_IMU by other station-keeping mode.As it is shown in fig. 7,
Set_position_mode interface can call iwise_loc_set_position_ in the GPS HAL of present example
Mode, if station-keeping mode is GPS_POSITION_MODE_IMU, then activates IMU module accesses sublayer in a dormant state
Sublayer is realized with integrated navigation and location.IMU module accesses sublayer is connected to SDA and obtains inertial sensor data, and integrated navigation is fixed
Position realizes sublayer and starts positioning calculation.GPS module accesses sublayer and detects that station-keeping mode is converted to GPS_POSITION_MODE_
After IMU, no longer positioning result data are converted to event_payload_u_type structure, but resolve and be converted to gnss_
Copy in sharing data area after data_t.
(4) integrated navigation and location resolves the process of other calculation result.
Integrated navigation can provide more navigational parameter compared to common location navigation, using the teaching of the invention it is possible to provide full attitude information ginseng
Number (including course angle, the angle of pitch, roll angle).In the present invention, the positional information calculated for integrated navigation and location is permissible
The GpsLocation structure being packaged as in standard Android in the abstract sublayer of GNSS reports upper layer application;For standard
Not thering is provided the full attitude information reporting interface in Android, the present invention expands $ GPATT language in standard NMEA-0183 form
Sentence (its definition is shown in Table 19), $ GPATT statement reports interface to report by the NMEA-0183 data of standard Android.Such as Figure 11
Shown in, the NMEA-0183 data of positioning result and extension are reported interface to be reported to GPS application framework by standard by GPS HAL
The LocationManager of layer, the NMEA parsing module of LocationManager the $ GPATT statement processing extension obtains
Full attitude information.The application-oriented layer of the present invention extends AttitudeListener audiomonitor, third-party application by
LocationManager registration AttitudeListener audiomonitor obtains full attitude information, and LocationManager resolves
By calling the onAttitudeChanged interface of AttitudeListener audiomonitor by full attitude after success $ GPATT statement
Information passes to application.Example is shown in the use of AttitudeListener.
The NMEA-0183 statement of table 19 present invention extension
Other two kinds of avatars of this method thought are shown in Figure 12 and Figure 13.As shown in figure 12, inertial sensor number is set
Positioning agent data module according to GNSS, integrated navigation and location realizes sublayer inside proxy module, and proxy module obtains IMU number
Carrying out integrated navigation and location resolving according to after the data of GNSS location, the full attitude information in calculation result is by Sensor HAL
Report, location information is reported by GPS HAL.As shown in figure 13, GNSS is set and positions agent data module, in Sensor HAL
Obtaining GNSS by GNSS module access modules from proxy module and position data, integrated navigation and location realizes sublayer at Sensor
In HAL, integrated navigation and location result reports upper layer application by the passage that reports of Sensor HAL.Both avatars with
This method thought there is no essential distinction, also in scope.
By this method so that: (1) Android third-party application developer is called original standard GNSS and is commonly positioned
API, can obtain the result of GNSS and inertial sensor combination location;(2) existing Android third-party application program is without entering
Row amendment, can directly obtain integrated navigation and location result;(3) API that this method newly increases is called at Java framework layer,
Java application layer obtains the relevant results of intermediate calculations of Integrated Navigation Algorithm.
After the bottom layer driving of equipment replaces with inertial sensor combination Locating driver, call original standard GNSS commonly fixed
Position API, can obtain inertial sensor combination positioning result, and step is as follows:
Step one newly-built Android project, needs to add ACCESS_ in AndroidManifest.xml inventory file
FINE_LOCATION authority.
Step 2 creates position audiomonitor, it is achieved android.location.LocationListener interface.
Step 3 obtains LocationManager, calls getProvider and obtains GpsLocationProvider.
Step 4 call requestLocationUpdates by create position audiomonitor with
GpsLocationProvider associates, and asks more new location information.When updating location information, will calling station prison
Listen the onLocationChanged interface of device, after the bottom layer driving of equipment replaces with inertial sensor combination Locating driver,
The positional information obtained in onLocationChanged is exactly inertial sensor combination location information.
Third party developer can obtain integrated navigation and location algorithm by the API provided in the extension of GPS application framework layer
The full attitude information calculated, step is as follows:
Step one newly-built Android project, needs to add ACCESS_ in AndroidManifest.xml inventory file
FINE_LOCATION authority.
Step 2 creates position audiomonitor, it is achieved android.location.LocationListener interface, establishment appearance
State information audiomonitor, it is achieved the new android.location.GpsStatus.AttitudeListener interface provided.
Step 3 obtains LocationManager, calls getProvider and obtains GpsLocationProvider.
Step 4 call requestLocationUpdates by create position audiomonitor with
GpsLocationProvider associates, and asks more new location information, calls what LocationManager newly provided
AddAttitudeListener interface adds full attitude information audiomonitor.
Specific embodiment described herein is only to present invention spirit explanation for example.Technology neck belonging to the present invention
Described specific embodiment can be made various amendment or supplements or use similar mode to replace by the technical staff in territory
Generation, but without departing from the spirit of the present invention or surmount scope defined in appended claims.