Disclosure of Invention
The invention overcomes the problems in the prior art and provides a balance car indoor positioning and navigation itinerant system based on a single line laser radar.
The technical scheme adopted by the invention for solving the problems in the prior art is as follows:
a balance car indoor positioning and navigation itinerant system based on a single line laser radar comprises: the system comprises a server, an upper computer, a sensor, a motion controller and a motion actuator. Firstly, an operator inputs coordinates of a target point in a server; the server sends the coordinates of the target point to an upper computer, the upper computer completes self positioning and path planning of the balance car by using sensor information, and the upper computer sends expected angular speed and expected linear speed planned by the path to the motion controller; the motion controller receives information sent by the upper computer, simultaneously collects sensor information, calculates PWM wave duty ratio required by the motion actuator by using the information and combining an active disturbance rejection control method, and then sends the PWM wave to the motion actuator; after receiving the PWM wave, the motion actuator completes the self-balancing of the balance car and drives the balance car to travel to a target point; finally, the operator can see the map and the real-time position and state information of the balance car at the server.
The server has the functions of displaying the map and the real-time position state information of the balance car, generating a target point, sending and the like, and the functions are realized by the cooperation of three software modules in the server, wherein the three software modules respectively comprise: the device comprises a communication module, a target generation module and a display module. The following is a detailed functional description of three modules in the server:
the communication module is mainly used for Socket communication between the server and the upper computer, wherein a Socket communication unit of the upper computer subscribes a map from a mapping unit, obtains real-time balance car pose and state information from a positioning unit, converts the information into a json format, sends the json format to the communication module of the server in a byte stream mode in a Socket communication mode, and finally outputs the data to the display module for displaying to an operator; and the communication module of the server is responsible for sending the coordinates of the target point obtained from the target generation module to a Socket communication unit of the communication module of the upper computer.
And the target generation module is used for enabling an operator to observe the map in the display module and the real-time pose of the balance car and then inputting the coordinates of a target point which the balance car is expected to reach. And then the coordinates are sent to a Socket communication unit in a communication module of the upper computer through a communication module of the server and finally input to a global path planning unit of a navigation module in the upper computer.
And the display module acquires information such as an environment map of the balance car, the pose and the state of the balance car from the communication module of the server and displays the information in real time.
The upper computer establishes a map for the surrounding environment by using the sensor information and realizes self-positioning of the balance car in the two-dimensional map, and then combines the coordinates of the target point sent by the server, the upper computer can plan a reasonable shortest path from the position of the balance car to the target point, and converts the path information into an expected angular velocity and an expected linear velocity and sends the expected angular velocity and the expected linear velocity to the motion controller. The host computer includes: the device comprises a two-dimensional laser SLAM module, a navigation module and a communication module. These three functional modules are explained in detail below:
the two-dimensional laser SLAM module comprises three units, namely a data processing unit, a mapping unit and a positioning unit. The data processing unit consists of an encoder data processing subunit, an IMU data processing subunit and a laser radar data processing subunit. Three sub-units in the data processing unit are described first below:
an encoder data processing subunit: firstly, the serial port communication unit in the upper computer communication module is utilized to obtain the encoder data of the left wheel and the right wheel, and the speed of the right wheel is defined as VrAnd the left wheel speed is VlAnd a distance parameter d between two wheels of the balance car. Substituting the left wheel speed, the right wheel speed and the wheel spacing data into the formula (1) to calculate the instantaneous linear velocity and the instantaneous angular velocity of the balance car, wherein the linear velocity in the y direction is always 0 because the balance car cannot move transversely:
and (3) substituting the instantaneous linear velocity and the instantaneous angular velocity obtained by the formula (1) into the motion model (2) to calculate the wheel type odometer.
And finally, outputting the wheel type odometer to an IMU data processing subunit.
An IMU data processing subunit: the wheel odometer steering angle is larger than the yaw angle error measured by the IMU because the magnetic field interferes with the IMU data and the yaw angle information calculated by the IMU is corrected by the magnetometer. For the translation amount, the accelerometer of the IMU is easily interfered by high-frequency noise, so that the translation amount error of the wheel type odometer is smaller. And then, the IMU data obtained from the serial port communication unit in the upper computer communication module is fused with the wheel type odometer output by the encoder data processing subunit by selecting the extended Kalman filtering to obtain the odometer with higher precision, and the IMU data and the odometer data are output to the laser radar data processing subunit, the positioning unit and the map building unit.
The laser radar data processing subunit: because the laser radar is used for rotatably measuring the depth information of surrounding obstacles, the data of the laser radar is distorted due to the movement of the balance car, and therefore, the original data of the laser radar is corrected by using the odometer, so that the data of the laser radar is not distorted in a moving state. Therefore, laser radar data are obtained from a serial port communication unit in the upper computer communication module and are used as input of the laser radar data processing subunit, mileometer data output by the IMU data processing subunit are used for correcting the laser radar data, a corrected result is output through the likelihood field model, and the set bit unit, the graph building unit and the navigation module are output.
The drawing establishing unit specifically comprises the following operation steps:
1) and acquiring the odometer information and the laser radar data from the data processing unit. And carrying out time synchronization on the odometer information and the laser radar data.
2) The particle filter is first initialized so that the weight of each particle is equal and uniformly distributed.
3) And calculating the coordinate of the laser radar on the odometer, and substituting the particle pose at the last moment into the motion model for calculation to obtain the estimated particle pose.
4) The predicted sampling distribution of the particles is updated with the matching results by substituting the laser data into each particle for matching.
5) The target distribution and the predicted distribution are used to determine the weight of each particle.
6) And resampling the particles according to the weight of the particles, traversing the information stored by the particles on the whole track, updating the grid map, and returning to the third step to update the pose of the particles.
7) And finally, outputting the map to a Socket communication unit in the navigation module, the positioning unit and the upper computer communication module.
The positioning unit adopts a Monte Carlo method, and takes the built map, radar and odometer data as input to obtain the pose of the robot, and the specific operation steps are as follows
1) And acquiring the odometer information and the laser radar data from the data processing unit. And carrying out time synchronization on the odometer information and the laser radar data, and then taking the map output by the map building unit as the input of the positioning unit.
2) Initializing the particle swarm. The initial pose is set manually, namely the distribution of the particle swarm is initialized.
3) And (4) updating the pose of each particle by sampling the kinematic model by using the odometer.
4) And substituting the radar information and the map into the pose corresponding to each particle, calculating the weight corresponding to each particle, and selecting the pose with the highest weight as the robot.
5) After the weight calculation is finished, there are many low-weight particles, and these particles occupy computer resources, so it is necessary to discard these low-weight particles appropriately and perform resampling according to the weights corresponding to the particles: the particles with high weight are copied, and the particles with low weight are discarded. And ending one iteration, returning to the third step and continuing the iteration.
The navigation module comprises a global path planning unit and a local path planning unit. A reasonable and shortest running route from the real-time pose of the balance car to the destination is planned through the global path planning unit; and then a local path planning unit is used for controlling the balance car to follow the global track and realizing the functions of avoiding obstacles and the like. The global path planning unit and the local path planning unit are introduced as follows:
and the global path planning unit is used for subscribing a map from the map building unit, acquiring the real-time pose of the balance car from the positioning unit, the position of a target point sent from the communication module of the server and other information, inputting the data into the global path planning unit, searching a reasonable shortest path from the position of the balance car to the target point from the map by using an A-x algorithm, outputting the path and outputting the path to the local path planning unit.
The local path planning unit takes the output path of the global path planning unit as the input of the local path planning unit; and subscribing the laser radar information output by the laser radar data processing subunit in the data processing unit. Firstly, initializing a path; adding constraint conditions: 1) the method has the advantages that a global path can be tracked, 2) obstacles are avoided, 3) the method conforms to the motion mode of the balance car, 4) the acceleration and speed limits are met, the constraint conditions are converted into graph optimization edges, time intervals are used as graph optimization nodes, then the solution is carried out through an optimization algorithm of a large-scale sparse matrix in a g2o optimization library, and a local optimal track is planned. And finally, calculating the expected angular velocity and acceleration according to the balance car kinematic model, and sending the expected angular velocity and acceleration to a serial port communication unit in the upper computer communication module.
The upper computer communication module comprises a serial communication unit and a Socket communication unit, wherein the serial communication unit also comprises serial communication between the motion controller and the upper computer, and serial communication between the sensor and the upper computer:
serial port communication between the motion controller and the upper computer: a serial port communication unit of the upper computer subscribes to an expected angular velocity and an expected linear velocity output by a local path planning unit in the navigation module, then sends the expected angular velocity and the expected linear velocity to the motion controller through a serial port, and after receiving the expected angular velocity and the expected linear velocity, a communication module of the motion controller outputs data to a direction control unit and a speed control unit of the motion control module; the motion controller collects data of the encoder, the encoder data are sent to a serial port communication unit of the upper computer communication module through a communication module of the motion controller by utilizing a serial port, and after the serial port communication unit of the upper computer communication module receives the encoder data, the encoder data are sent to an encoder data processing subunit of the data processing unit for odometer calculation.
Serial port communication between sensor and host computer: the serial port communication unit of the upper computer communication module obtains laser radar and IMU data from the laser radar and the 100D2 IMU through a serial port, then sends the laser radar data to the laser radar data processing subunit of the data processing unit, and sends the IMU data to the IMU data processing subunit of the data processing unit.
And after the upper computer completes the construction of a balance car map, self positioning and path planning, the expected angular velocity and the expected linear velocity are sent to the motion controller.
The motion controller can complete the calculation of the duty ratio of the PWM wave required by the balance car to reach the destination by collecting the information of the sensor in real time and combining the data sent by the upper computer with an active disturbance rejection control method, and sends the PWM wave to the motion actuator in real time. The motion controller completes the functions through the cooperative work of the three functional modules. Wherein three functional modules are respectively: the device comprises a motion control module, an active disturbance rejection control module and a communication module.
The motion control module comprises an upright control unit, a direction control unit and a speed control unit. The deviation between the real-time angle of the balance car and the expected balance angle is calculated through the vertical control unit, and the balance car has a good balance effect at a balance position by combining with the active disturbance rejection control module; calculating the deviation between the real-time angular speed and the expected angular speed by using a direction control unit, and enabling the balance car to run along the planned path by combining an active disturbance rejection control module; and calculating the deviation between the real-time speed and the expected speed by using a speed control unit, and driving the balance car at the calculated speed by combining an active disturbance rejection control module. The respective functions of the three units in the motion control module are set forth below:
an upright control unit: first, the motion controller collects data of the sensor MPU6050, which includes information of angular velocity and acceleration of the pitch angle of the balance car. Because the acceleration information is easily annihilated by high-frequency noise, the acceleration information is filtered by a Butterworth low-pass filter, then the angular velocity gyro in the pitch Angle direction of the balance car is fused with the acceleration acc by a complementary filtering formula (3), and the calibration is carried out after the weight x is adjusted, so that the Angle information Angle can be obtained, wherein dt is the period of Angle calculation:
Angle=x*(Angle+gyro*dt)+(1-x)*acc; (3)
and then the real-time Angle is deviated from the expected balance Angle and is input to the active disturbance rejection control module.
A direction control unit: the desired angular velocity is obtained from the communication module of the motion controller, then the angular velocity of the yaw angle of the balance car is collected in real time from the sensor MPU6050, the units of the angular velocity and the yaw angle are unified, and then the subtraction result is input to the active disturbance rejection control module.
A speed control unit: first, a motion controller is used for collecting data of a sensor encoder, and the data of the encoder represents the rotating speed of left and right wheels of the balance car. And calculating the real-time speed of the balance car through encoder data. Unifying the real-time speed and the expected linear speed unit obtained from the communication module of the motion controller, performing subtraction, and inputting the result to the active disturbance rejection control module.
Finally, the results of the three units, the upright control unit, the directional control unit and the speed control unit are all input to the active disturbance rejection control module.
The active disturbance rejection control module adopts a control method of active disturbance rejection control, and comprises a differential tracking unit, an expansion state observation unit and a nonlinear control rate unit. The following are the roles of the individual units:
a differential tracking unit: the method is used for solving the problem that discontinuous or random noise signals are generated by a navigation module or a communication module, and reasonably extracting the expected angular speed and speed signals and differential signals from the discontinuous or random noise signals, so that the expected signals are smooth. And three deviation values input from the motion control module are smoothed to prevent sudden change of signals from influencing the stability of the system, and the results are respectively output to the expansion observation unit and the nonlinear control rate unit.
An expanded state observation unit: the expansion state observation unit is mainly used for observing and offsetting the disturbance of the system. The expansion state observation unit obtains three deviation amounts from the differential tracking unit: the angular deviation, the angular speed deviation and the speed deviation of the balance car. The system is characterized in that the system is expanded into new state variables, expanded total disturbance signals are observed through a special feedback mechanism, the total disturbance is constructed into a state variable and a second-order system through input and output, an expansion observer of the system reaches the third order, the state of the total disturbance of the whole balance car system is added, the finally observed total disturbance output is differed with a signal output to a nonlinear control rate unit by a differential tracking unit, the signal is used for eliminating the disturbance, and the system is more stable.
A nonlinear control rate unit: the nonlinear control method is constructed by a steepest control synthesis function Fhan. The method is mainly used for solving the problem that the linear controller cannot control nonlinear systems such as a balance car and the like to obtain better effects. And taking the result of the difference between the output of the differential tracking unit and the output of the expansion state observation unit as the input of the nonlinear control rate unit, calculating the duty ratios of pwm waves required by the vertical control, the direction control and the speed control respectively through calculation, and linearly overlapping the duty ratios and outputting the duty ratios to the motion actuator.
The communication module in the motion controller is used for realizing serial communication between the motion controller and the upper computer: a serial port communication unit of the upper computer subscribes to an expected angular velocity and an expected linear velocity output by a local path planning unit in the navigation module, then sends the expected angular velocity and the expected linear velocity to the motion controller through a serial port, and after receiving the expected angular velocity and the expected linear velocity, a communication module of the motion controller outputs data to a direction control unit and a speed control unit of the motion control module; the motion controller collects data of the encoder, the encoder data are sent to a serial port communication unit of the upper computer communication module through a communication module of the motion controller by utilizing a serial port, and after the serial port communication unit of the upper computer communication module receives the encoder data, the encoder data are sent to an encoder data processing subunit of the data processing unit for odometer calculation.
Finally, the motion actuator is a direct current motor in the system, and can receive the PMW waves sent by the motion controller and convert the PWM waves into driving force to control the balance of the balance car and the thrust reaching the destination.
The invention has the advantages that: according to the invention, the active disturbance rejection control is adopted as a basic motion control method, so that the balance car has better stability and the capability of tracking the track and speed planned by the navigation module in time, an effective dynamic obstacle avoidance effect is achieved, and the robustness of the balance car is increased. In addition, the invention adopts a mode of combining the chassis of the two-wheeled balance vehicle and the two-dimensional laser radar positioning and navigation, effectively improves the flexibility of the vehicle, can effectively avoid obstacles and reach a destination more quickly in a complex environment, and increases the efficiency of the robot in completing tasks.
Detailed Description
The following examples are further detailed in conjunction with the accompanying drawings:
a balance car indoor positioning and navigation itinerant system based on a single line laser radar comprises: the system comprises a server, an upper computer, a sensor, a motion controller and a motion actuator.
The server can obtain real-time position and state information of the two-dimensional map and the balance car through Socket communication, and the information is displayed on a screen and observed by an operator. Then, an operator can input the target position of the balance car into the server, and the server can send the coordinates of the target point to the upper computer through Socket communication.
The upper computer firstly reads sensor information such as IMU (inertial measurement Unit), laser radar and the like and encoder data by using a serial port, and then calculates the information by using a two-dimensional laser SLAM (simultaneous localization and mapping) algorithm, so that a two-dimensional map and real-time pose information of the surrounding environment of the balance car can be obtained. Meanwhile, the upper computer obtains coordinates of a target point sent by the server through Socket communication, combines a two-dimensional map, the real-time pose of the balance car and sensor information, can plan a reasonable shortest path to a destination through a navigation module in the upper computer, and sends an expected path to a motion controller through a serial port in the form of an expected angular velocity and an expected linear velocity.
And the motion controller is used for controlling the motion of the balance car. The method comprises the steps of firstly collecting MPU6050 data, converting the data into real-time pitching angle data of the balance car, and then receiving expected angular velocity data and expected linear velocity data sent from an upper computer by adopting serial port communication. And then, the angle of the balance car, the expected angular speed and the linear speed are used as input quantities and are input to an active disturbance rejection control module, the duty ratio of a PWM wave required by the motion actuator is obtained through calculation, and then the PWM wave is sent to the motion actuator.
The motion actuator consists of a chassis of the two-wheel differential balance car and is used for receiving the PWM waves sent by the motion controller and driving the balance car to a destination.
In the motion control module, an active disturbance rejection controller is adopted to simultaneously control three state quantities of an angle, a driving direction and a driving speed of the balance car. The active disturbance rejection controller is composed of a differential tracker, an extended state observer and a nonlinear state error feedback control law:
the differential tracker is used for solving the problem that discontinuous or random noise signals are generated by a navigation module or a communication module, and reasonably extracting expected angular velocity and velocity signals and differential signals from the discontinuous or random noise signals so as to smooth the expected signals.
The extended state observer expands the disturbance action of the angle, direction and speed of the balance vehicle into a new state variable, observes an expanded total disturbance signal through a special feedback mechanism, constructs a system with the total disturbance as a state variable and a second order through input and output, and reaches a third order and adds the state of the total disturbance of the whole balance vehicle system.
And the control and disturbance compensation are further carried out according to the given signal obtained by the tracking differentiator, the derivative of the given signal and the error of the derivative of the system output and the output observed by the state observer, and the nonlinear control method is constructed by a steepest control comprehensive function Fhan. The method is mainly used for solving the problem that the linear controller cannot control nonlinear systems such as a balance car and the like to obtain better effects.
A balance car indoor positioning and navigation system based on a single-line laser radar is characterized in that a platform mainly comprises a laser radar of a rpidar A2 model, a miniPC (a cpu of the miniPC uses an Inter Core i7-7567U), a single chip microcomputer development board carrying a master control stm32f103, a balance car chassis, an IMU of a 100D2 model, a lithium battery of 5000mAh, and a single chip microcomputer is communicated with the miniPC through a serial line.
The application mode of the invention is as follows:
the specific operation steps of using the balance car carrying the two-dimensional laser radar to construct the map are as follows:
1) firstly, the balance control (stable and non-shaking in situ), speed control and direction control of the vehicle are started, and simultaneously, the serial port function is started, and the wheel speed is sent to the upper computer and the expected angular speed and the expected linear speed are received, as shown in figure 4.
2) And the IMU and the computer, the laser radar and the computer, the singlechip and the computer are connected through serial port lines, and the information of the laser radar, the IMU and the wheel speed is read. And substituting the wheel speed information into the balance car kinematic model and the odometer model for solving, and calculating to obtain the wheel type odometer. And calibrating the wheel type odometer.
3) And fusing the wheel type odometer and IMU data to obtain a new odometer, inputting the new odometer and laser radar data to a mapping module, starting mapping by the balance car in situ, and mapping the result as shown in figure 2.
4) And opening the keyboard control node, and controlling the balance car to move by using the keyboard, so that the balance car can be completely built as much as possible.
The specific operation steps of positioning and navigating by using the balance car carrying the two-dimensional laser radar are as follows:
1) and closing the map building and keyboard control module, and opening the positioning, navigation and upper computer and server communication module.
2) And detecting whether the server side can successfully receive the map and the robot state information. After the detection is finished, the server side inputs destination coordinates to be reached, the balance car can autonomously plan a reasonable shortest path through the path planner, the planned path is shown in fig. 3, a red line is a global planned path, and a green line is a local planned path.
3) After the balance car arrives at the destination, the arrival information of the server is returned, and the server is allowed to perform the next target point setting, wherein the information obtained by the server is shown in fig. 5.
It is emphasized that the embodiments described herein are merely illustrative of implementations of the inventive concept and that the scope of the invention should not be considered limited to the specific forms set forth in the examples but rather the scope of the invention is to be accorded the full scope of equivalents that can occur to those skilled in the art upon reading the teachings herein.