“Inertial navigation/satellite combined navigation is usually used for mobile robots working in outdoor environments.Inertial Navigation SystemIt has the advantages of complete autonomy, strong anti-interference, good concealment ability and comprehensive output parameters, but its robustness is extremely low, and the error will continue to accumulate and diverge over time. Satellite navigation systems have the advantages of high accuracy, wide positioning range and no accumulation of errors over time, but they have disadvantages such as poor autonomy, easy to be blocked and interfered by the outside world, and low frequency of receiver data update. Therefore, in engineering, the two are often used in combination to form a satellite/inertial integrated navigation system.
Inertial navigation/satellite combined navigation is usually used for mobile robots working in outdoor environments.Inertial Navigation SystemIt has the advantages of complete autonomy, strong anti-interference, good concealment ability and comprehensive output parameters, but its robustness is extremely low, and the error will continue to accumulate and diverge over time. Satellite navigation systems have the advantages of high accuracy, wide positioning range and no accumulation of errors over time, but they have disadvantages such as poor autonomy, easy to be blocked and interfered by the outside world, and low frequency of receiver data update. Therefore, in engineering, the two are often used in combination to form a satellite/inertial integrated navigation system.
This paper takes the low-power MSP430F149 as the core, and designs a satellite navigation (GNSS) receiver, inertial measurement unit (IMU), high-speed combined transmission and high-speed combined transmission of navigation information such as satellite navigation (GNSS) receiver, inertial measurement unit (IMU), and high-speed combined transmission. The integrated navigation system can not only provide direct navigation services for outdoor mobile robots, but also can be used as a high-speed acquisition system of original measurement information for high-precision integrated navigation systems.
The key to the system design is to use the limited interface resources of the single-chip microcomputer to realize the parallel acquisition of multi-sensor information, design an effective data synchronization method, solve the problem of inaccessibility caused by the omission of the data manual of the pressure sensor, and give the basic method of combined positioning of the robot. . The system makes full use of the capabilities of the MSP430F149 microcontroller, and has the advantages of simple structure, low power consumption, and universality to sensors.
1 Overall Design
The system consists of power supply, barometer interface, IMU interface, GNSS receiver interface, SPI to UART module and MSP430F149. The system composition is shown in Figure 1.
The function realization of the integrated navigation system is divided into five parts: IMU data reception and analysis, GNSS data reception and analysis, barometer data reception and analysis, integrated navigation calculation and data output. The IMU data reception and analysis function is used to obtain the acceleration and angular velocity information required in the navigation solution; the GNSS data reception and analysis function is used to obtain the position and velocity information (loosely coupled combination) or GNSS pseudorange and pseudorange required in the navigation solution. Distance rate (tightly coupled combination); barometer data reception and analysis functions are used to obtain altitude information; integrated navigation calculation function is the core of the system, used for integrated navigation calculation; data output includes the integrated output and calculation of the original data package result output.
Figure 1 System composition structure diagram
The inertial devices and GNSS receivers used in this article are both RS-232 level UART interfaces, which are versatile, and users can consider devices with different precisions according to cost. The barometer uses MS5803-02BA produced by American MEAS Company, which has been solidified in the circuit.
2 Hardware circuit design
2.1 Microcontroller Interface
The entire integrated navigation and positioning system requires three UART interfaces and two SPI interfaces. Two of the UART interfaces are provided by the UART resources that come with the 430 MCU, and the other UART interface is obtained by GPIO simulation SPI through the MAX3111E chip conversion; the two SPI interfaces are obtained by GPIO simulation. In addition, an external interrupt pin is required to capture the pulse-per-second signal (PPS), and an external interrupt pin to capture the MAX3111E interrupt signal. The MSP430F149 pin resource allocation is shown in Table 1.
2.2 Power circuit
The power supply requirement of this system is 3.3V power supply, so the AMS1117 voltage regulator chip is used, and the 5V power supply can output 3.3V stable voltage, which can provide 1A current to meet the system power supply requirements. The circuit design is shown in Figure 2.
Figure 2 Power supply circuit
2.3 IMU device and GNSS receiver interface circuit
Both the IMU device and the GNSS receiver use the UART interface to access, and use the RS232 protocol. Therefore, the two UART interfaces on the 430 microcontroller can be used, but the TTL level and RS232 level conversion are required. The common MAX3232 chip is used here, and the circuit design is shown in Figure 3.
Figure 3 IMU and GNSS interface circuit
2.4 Barometer MS5803-02BA Interface Circuit
MS5803-02BAIt is a digital pressure sensor produced by MEAS with a resolution of 10cm. The chip contains a high linearity pressure sensor and an ultra-low power consumption 24-bit ΔΣ ADC with an internal factory calibration coefficient. This chip has two interface modes: SPI and I2C, and different interface modes are configured through the PS pin of the chip (when PS is set low, the SPI working mode is used; when the PS is set high, the I2C working mode is used). The positioning system described in this article configures the barometer for SPI operation. The interface circuit design between MS5803-02BA and microcontroller is shown in Figure 4.
Figure 4 MS5803-02BA interface circuit
The control commands of MS5803-02BA include reset command, temperature ADC command, air pressure ADC command, ADC read command, and PROM read command. The control commands are shown in Table 2.
The control command is input through the SDI port shift, and the response result is shifted and output from the SDO. The input level is judged on the rising edge of the clock signal, and the output level is judged on the falling edge of the clock signal. The output air pressure value can be temperature compensated, which needs to be compensated by the coefficient in the PROM inside the chip. After the ADC reads the command input, it outputs the 24-bit ADC result; after the PROM reads the command input, it outputs the 16-bit compensation coefficient.
The following is the C language code to read the ADC:
CSN_OFF_MS();//CS is set low
SPI_WRITE_8BIT(CMD);//SDI is shifted into 8-bit CMD
delay_ms(10); // Delay 10ms
CSN_ON_MS();//CS set high
CSN_OFF_MS();//CS is set low
SPI_WRITE_8BIT(0x00);//SDI is shifted into 8 bits 0x00
result = SPI_READ_24BIT();//SDO shifts out 24 bits
CSN_ON_MS();//CS set high
The following is the C language code to read the PROM:
CSN_OFF_MS();//CS is set low
SPI_WRITE_8BIT(CMD); //SDI is shifted into 8-bit CMD
result=SPI_READ_16BIT();//SDO shifts out 24 bits
CSN_ON_MS();//CS set high
Combined with the user manual of the device and the omissions in the manual, you need to pay attention when using MS5803-02BA:
1. After the temperature and pressure ADC commands are sent, the chip needs a certain time for sampling and conversion. The specific time is related to the oversampling rate (OSR). The maximum required time is 10ms, so the delay time used in this paper is 10ms;
2. There must be a time delay of at least 21ns from the falling edge of the chip select signal CS to the first rising edge of the clock SCLK signal, otherwise the command cannot be correctly written to the chip;
3. After the 8-bit ADC read command, the CS chip select signal must be kept low, and then a 24-bit clock signal input is generated to read the 24-bit ADC result (that is, a command word is 8 bits, but the actual need 32 consecutive clock cycles to fully read the ADC results);
4. For the PROM read command and the ADC read command, a total of 24 consecutive clock cycles are required to complete, of which 8-bit command word is input and 16-bit data is read.
5. For all shift output data from SDO, the SDI input terminal needs to be kept low.
2.5 SPI to UART circuit
Since the on-chip UART resources of the MSP430F149 are all occupied by the IMU device and the GNSS receiver, it is necessary to expand a UART interface to meet the communication between the positioning system and the PC. To this end, the GPIO on the MSP430F149 is simulated SPI, and then converted into a UART interface through the MAX3111E chip.
MAX3111E is a full-featured transceiver launched by MAXIM, which contains two independent parts of UART and RS232 level conversion. The UART part includes a serial interface compatible with SPI, a programmable baud rate generator, a transmit shift register, a receive shift register, an 8-word FIFO, and 4 maskable interrupt generators; the RS232 part includes electric pump capacitors, Hardware shutdown (SHDN pin), with ±15kV electrostatic protection. It can choose 1.8432MHz or 3.6864MHz two crystal oscillators as external crystal oscillators, the chip can work at 300bps ~ 230kbps baud rate, this article uses 3.6864MHz crystal oscillator. The connection circuit between MAX3111E and MSP430F149 is shown in Figure 5.
Figure 5 SPI to UART circuit
The control commands of the MAX3111E are divided into four types: write configuration commands, read configuration commands, write data commands, and read data commands. The configuration command written into the chip in this article is 0xE809, 8bit data length, FIFO enable, transmit interrupt enable, baud rate 38400bps. The writing of data needs to add 0x81 in front of each byte. For example, if you want to send byte 0x55, you need to shift input 0x8155 from the DIN terminal.
The following is the C language code to send n bytes continuously:
SPI_WRITE_16BIT(0xE809);//Write configuration command
SPI_WRITE_16BIT(0x8100+DATA1);//Send the first data DATA1
SPI_WRITE_16BIT(0x8100+DATA2);//Send the second data DATA2
SPI_WRITE_16BIT(0x8100+DATAn);//Send the nth data DATAn
Note when using the MAX3111E:
1. There must be a time delay of at least 100ns from the falling edge of the chip select signal CS to the first rising edge of the clock SCLK signal;
2. When the chip determines that the chip select signal CS is invalid, the CS pin needs to keep the high level for at least 200ns. Therefore, when data needs to be sent continuously, at least 200ns are required between two write data commands, and an interval of 250ns is recommended;
3. The writing configuration command requires the crystal oscillator to work stably, so you can read the configuration after writing the configuration command, until the corresponding bits of the written and read configuration data are the same to ensure that the chip is configured as required.
3 Software Design
3.1 GPIO analog SPI implementation method
Use GPIO to simulate SPI, and perform level operation on the selected IO port to simulate the SPI timing. In this paper, the level operation of SPI is defined by macros, and the source code in Table 3 can be referred to.
The program uses the above macro definition according to the SPI logic relationship, can generate SPI signals in the selected IO port, and can flexibly control the number of clocks during each CS valid period. The SPI simulated by GPIO has the advantages of intuitive operation, flexibility and change. Compared with the simulated SPI, the built-in SPI interface on the controller basically does not occupy the controller resources, and the shift of transmission and reception and the generation of the clock signal are all handled by the internal SPI module. The SPI simulated by GPIO requires the controller to continuously operate the IO, so it will take up the processing time of the controller. The clock signal also consumes machine cycles due to level manipulation, resulting in a limited clock signal speed.
3.2 Data collection and processing methods
The data of the IMU and GNSS receiver will be actively sent to the UART interface of the 430 single-chip microcomputer. In this paper, the data is received by means of interrupt reception, and each incoming byte is stored in the designated storage area cyclically; the barometer needs the 430 single-chip microcomputer to obtain the query type altitude information. Therefore, when IMU or GNSS information is required, data needs to be scanned in the storage area. The scanning is based on the protocol (frame header, frame end, CRC, etc.) that the device sends a frame of data, and then the value of the corresponding physical quantity is obtained according to the protocol; When the altitude information is required, the 430 single-chip microcomputer is required to send the control word to the barometer to obtain the information. When scanning the IMU and GNSS information, a variable ptr is required to store the offset address of the first address of the valid data in the storage area. In order not to reuse the used data, it is necessary to destroy the frame of this frame of valid data after the information is used. header and footer.
In addition, it should be noted that using the method of cyclic storage of data and scanning and retrieval requires that the processing speed of the data is faster than the receiving speed of the data, otherwise the old data will be overwritten by the new data.
3.3 Height calculation method
The acquisition of altitude information needs to be converted from the air pressure information acquired by MS5803-02BA. For the operation of this barometer, it is necessary to obtain six parameters C1~C6 in the PROM inside the chip, then obtain the temperature ADC result D1 and the pressure ADC result D2, and finally use the official calculation formula to calculate the pressure value with compensation. The software flow chart of air pressure value acquisition is shown in Figure 6.
Figure 6 Flowchart of height calculation
According to the calculation formula provided in the user manual of the barometer, a temperature-compensated standard air pressure value can be finally calculated, in mbar. The acquisition of altitude information also needs to convert the air pressure value through a functional relationship. There is the following functional relationship between the height h and the standard atmosphere P:
Th=288.15K, is the lower limit of temperature at the height corresponding to g0; β=-6.5K/km, is the vertical rate of change of temperature; H=0m, is the height corresponding to g0; Ph=101325Pa, is the height corresponding to g0 The lower limit of air pressure; R=287.05287m2/(K s2), is the gas constant; g0=9.80665m/s2, is the sea-level gravitational acceleration.
In the transformation of the relationship between air pressure and altitude, the piecewise linearization method is used to fit their nonlinear relationship. In the range of different pressure values, the linearization formula obtains h=a·P+b, and different linear parameters a and b are obtained, refer to Table 4.
3.4 Time Alignment of Integrated Navigation
The data received from the IMU and GNSS receiver should be synchronized in time when performing the combined navigation filter solution, because if at a data fusion point, the data from the two subsystems entering the Kalman filter come from different The time point will bring errors to the filtering calculation and also affect the correction calculation. The navigation data output by GNSS receivers are all with precise time stamp, while the data output from IMU has only a relative time stamp. Using the time stamp of the GNSS receiver as the time reference, the composition of the time difference is analyzed. A schematic diagram of the system time is shown in Figure 7.
Figure 7 Schematic diagram of system clock
3.4.1 Time difference analysis
When a GNSS data (1Hz) arrives, the receiver generates a pulse-per-second signal (PPS) for time alignment. The GNSS receiver itself has a data delay: the entire calculation process of the receiver will generate a solution time delay Δt1, and the data output from the satellite navigation receiver and the inertial navigation system are input to the navigation solution through the McBSP and RS-232 data interfaces respectively. The device will generate a certain transmission delay Δt2. Therefore, the time Δt1+Δt2 before the PPS signal is the real time of the currently received GNSS data frame. The IMU data processing time is small relative to the recursion time and can be ignored. In addition, the time difference Δτ between the PPS pulse signal and the inertial measurement signal describes the relationship between the absolute time of GNSS and the relative time of IMU, so that GNSS and IMU are unified under the same time standard.
3.4.2 Dealing with ideas
According to the total time difference △T =△t1+△t2+△τ, find the interpolation time corresponding to the IMU data. Through the time ΔT, the alignment time point and the two nearest inertial acquisition moments can be obtained, and then the inertial time points on both sides of the time synchronization point, that is, the time points t(k-1) and t(k) in the figure By performing linear interpolation on the data, the synchronized measurement data of the inertial navigation data and the GNSS receiver data at the same time point can be obtained.
3.4.3 Implementation method
The GNSS receiver solution time Δt1 is provided by the receiver.
The transmission time Δt2 is usually a fixed time. The oscilloscope is used to measure the transmission time of the GNSS receiver and the reception time of the navigation solution circuit, and then the difference between the two times can be obtained.
The acquisition of △τ needs to open the timer and external interrupt of MSP430F149, and obtain it by interrupting the timing. The specific method is as follows: by connecting the PPS signal to the external interrupt interface of the navigation processor, the occurrence of the interrupt event is triggered by an edge-triggered method. The interrupt event starts the timer working. When the IMU data is received through the serial port interrupt mode, the value of the timer is read, and the delay time Δτ of the IMU data relative to the PPS can be obtained.
In this paper, an outdoor mobile robot combined navigation and positioning system is designed based on the MSP430F149 microcontroller. Through the expansion of the interface, the positioning system can access the three-way information of IMU, GNSS receiver and barometer to complete the preliminary navigation and positioning service function. Data acquisition equipment, which integrates multiple channels of data into one high-speed output interface for further high-precision navigation solutions. According to the different needs of users, the system can be connected to equipment of different cost and precision, as long as it meets the RS-232 protocol. The author applies it in practice, the whole system makes full use of the resources of this single-chip microcomputer, with simple structure, low power consumption, and wide application range.