Design and Implementation of a Real-time Monitoring System for Intelligent Vehicle Motion Status
2026-04-06 07:21:23··#1
System Functions and Applications This system primarily transmits various status information of the intelligent vehicle during its operation (such as sensor on/off status, vehicle speed, servo motor angle, battery level, etc.) to a host computer for processing in real time via wireless serial communication, and plots curves of each status value as a function of time. These curves clearly show the intelligent vehicle's status at various points on the track, and the advantages and disadvantages of various control parameters become readily apparent. Particularly important is the selection of PID parameters for motor control; the speed-time curves easily reveal the differences between different sets of PID parameters. For teams using CCD sensors, this system becomes the "eyes" of the debugger, allowing them to see what the intelligent vehicle sees, which should greatly aid in developing line-following algorithms. Furthermore, this data can be further processed, such as calculating the first derivative to obtain more information. System Hardware and Software Design The design scheme is mainly divided into three parts: an onboard data acquisition system, a wireless data transmission system, and a host computer data processing system. The basic system structure is shown in Figure 1. Figure 1. Block Diagram and Flowchart of the Intelligent Real-Time Monitoring System Vehicle Data Acquisition System The vehicle data acquisition system is mainly composed of a microcontroller responsible for collecting information such as speed, sensor status, battery voltage, and servo angle during the race car's operation. To prevent the monitoring system from consuming the internal resources of the S12 microcontroller and to support hot-swapping, we separated the monitoring system (except for power supply) from the intelligent vehicle control system. We selected the Atmel ATMEGA16 microcontroller as the processor for this data acquisition system. Binary photoelectric sensor signals are directly acquired using the microcontroller's I/O ports, while continuous photoelectric sensor, battery voltage, and CCD camera signals are acquired using the microcontroller's A/D ports. Speed information is acquired through a photoelectric encoder and the microcontroller's counter. The acquired data is sent to the host computer every 20ms. Wireless Data Transmission System The lower-level computer transmits data to the upper-level computer every 20ms, including a set of data containing the photoelectric encoder value (speed), battery voltage (battery), servo motor angle value (angle), and the current sensor status (sensor). Ideally, the upper-level computer should receive periodic data where these values appear cyclically. In this case, the upper-level computer only needs to load these data into their respective arrays in sequence and plot them. However, data loss may occur during actual wireless transmission. Therefore, adding appropriate data verification is necessary; otherwise, data loading errors will occur, causing plotting chaos. In our actual process, we add a frame header of 0x00, 0xff to each data set. When a data error occurs, the frame is discarded. The wireless transceiver section uses the SUNRAY QC96 wireless transceiver module, which can transmit and receive serial data at a baud rate of 9600bps over a distance of up to 100m. Data Reception and Processing by the Host Computer The host computer section mainly consists of four modules: * **Data Reception Module:** The host computer collects raw data sent by the slave computer via serial port. * **Implementation:** Serial communication in VC++ generally uses two methods: the MSComm control and Windows API functions. MSComm is simple and easy to use, suitable for relatively simple systems. Windows API functions are widely used but more complex and cumbersome. Since the serial communication function of this module is relatively simple, this system uses the former. In practice, an event-driven approach is used, which offers timely response, high reliability, and consumes fewer resources than the polling method. * **Storage Module:** This module can directly store the collected raw data for later analysis and processing. * **Implementation:** After each OnComm event is triggered, the data received from the serial port is directly stored in a temporary file (temp). The values in the temp temporary file can be stored in a specified file upon user request. • Data analysis and processing module functions: The collected raw data is analyzed and processed according to user selection. This mainly includes discarding erroneous data, removing frame headers and loading data, and can also analyze and process saved data. Implementation: Read and load data from a temporary temp file or a user-specified file. The main program code is as follows: void CChuankokjDlg::find_data(car_data c_data[], BYTE c_source[], int c_length) { int i=0; while (i { if ((c_source[i]==0x00)&& (c_source[i+1]==0xff)&& (c_source[i+6]==0x00)&& (c_source[i+7]==0xff))//Check the frame header and load the data { c_data[length].speed_data=c_source[i+2]; c_data[length].battary_data=c_source[i+3]; c_data[length].direction_data=c_source[i+4]; c_data[length].sensor_data=c_source[i+5]; i = i + 1; } else i++; } } · Graphical Display Module Function: Displays processed data through a graphical interface for more intuitive observation of the intelligent vehicle's operating status. Implementation: Plots the data loaded into each array in the previous module in the user-selected mode. Users can view only one graph or compare all four graphs together. The actual running interface and effect are shown in Figure 2. Figure 2 Graphical Display Interface Running Module Conclusion This system, by adding a wireless transceiver module, transmits the real-time status information of the intelligent vehicle to the host computer. Using VC++ programming, it visually and intuitively represents this information, effectively achieving the goal of real-time monitoring of the intelligent vehicle's status. This greatly facilitates the adjustment of intelligent vehicle parameters such as PID control and provides significant assistance for the research of track memory algorithms.