Method, device and equipment for controlling vehicle and storage medium
By using two monocular cameras to obtain the relative distance and angle between the vehicle and the vehicle in front, and combining kinematic and dynamic models to generate driving parameters, the high-cost and complex vehicle-following control problem in existing technologies is solved, and low-cost and efficient vehicle-following control is achieved.
Patent Information
- Application Number
- CN202511123719.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2025-10-10
AI Technical Summary
Existing vehicle-following control technologies are costly and complex to implement, requiring the configuration of multiple sensors and the acquisition of excessive information.
Two monocular cameras are used to capture images separately, and the relative distance and angle between the vehicle and the vehicle in front are obtained through parallax calculation. Based on these parameters, driving parameters are generated to control the vehicle to follow the vehicle in front, including establishing kinematic and dynamic models to solve the torque parameters.
It achieves low-cost and simple vehicle-following control, reduces sensor configuration requirements, ensures rapid error convergence, and improves the steady-state and transient performance of the system.
Smart Images

Figure CN120756475A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent driving, and particularly relates to a method and device for controlling a vehicle, equipment and a storage medium. BACKGROUND
[0002] Adaptive cruise control (ACC) is an intelligent automatic control technology. The following vehicle control technology is one of the core technologies of ACC, aiming to enable a vehicle to automatically follow a preceding vehicle and adjust its speed and direction according to the dynamics of the preceding vehicle, which can further improve driving efficiency and safety. The following vehicle control technology has significant advantages in improving driving safety, comfort, and driving efficiency, and is widely used in assisted driving, logistics transportation, intelligent transportation, and other fields. The following vehicle control method in the conventional technology has the problems of high cost and complex implementation. SUMMARY
[0003] The present application provides a method and device for controlling a vehicle, equipment and a storage medium, and the technical solution adopted by the present application is as follows:
[0004] In a first aspect, a method for controlling a vehicle is provided, the vehicle being in a following mode, the method comprising: obtaining a first image of a preceding vehicle collected by a first camera and a second image of the preceding vehicle collected by a second camera; determining a relative distance and a relative angle between the vehicle and the preceding vehicle according to the first image and the second image; generating a driving parameter according to the relative distance and the relative angle, and controlling the vehicle to follow the preceding vehicle to drive based on the driving parameter; wherein the driving parameter is used to adjust the driving speed and / or driving direction of the vehicle, so that the relative distance between the vehicle and the preceding vehicle approaches a desired distance and / or the relative angle between the vehicle and the preceding vehicle approaches a desired angle.
[0005] The present application uses two cameras, such as a first camera and a second camera, to collect two images of the preceding vehicle, and obtains the relative distance and the relative angle between the vehicle and the preceding vehicle based on the two images. Then, based on the relative distance and the relative angle between the vehicle and the preceding vehicle, the vehicle is controlled to follow the preceding vehicle to drive. For example, based on the relative distance and the relative angle, a driving parameter is obtained, and the vehicle is controlled to follow the preceding vehicle to drive based on the driving parameter. The vehicle does not need to be equipped with too many sensors and does not need to obtain too much information, so that the following control can be realized with low cost and simple implementation.
[0006] In one aspect, the driving parameter includes a torque of a left drive wheel and a torque of a right drive wheel. The present application generates the torque of the left drive wheel and the torque of the right drive wheel based on the relative distance and the relative angle between the vehicle and the preceding vehicle, and controls the vehicle to follow the preceding vehicle to drive through the torque of the left drive wheel and the torque of the right drive wheel.
[0007] In one aspect, in a possible implementation, a kinematic model of a vehicle and a dynamic model of the vehicle are established; a distance error and an angle error are obtained; wherein the distance error is the difference between a relative distance and a desired distance; and the angle error is the difference between a relative angle and a desired angle; and based on the distance error and the angle error, the driving parameters are solved in combination with the dynamic model of the vehicle and the dynamic model of the vehicle.
[0008] This implementation provides a feasible implementation method for obtaining driving parameters based on the relative distance and relative angle between the vehicle and the preceding vehicle. In this embodiment, the driving parameters for controlling the vehicle to follow the preceding vehicle can be obtained without obtaining too much information, which is simple and efficient.
[0009] In one possible implementation, based on the distance error and the angle error, the driving parameters are solved in combination with the vehicle's dynamics model, the vehicle's dynamics model, and the performance constraint model; wherein the performance constraint model is used to converge the angle error to the angle error at the moment when the system is stable, and to converge the distance error to the distance error at the moment when the system is stable.
[0010] In this embodiment, the driving parameter is solved with the performance constraint model as a constraint. The performance constraint model can quickly converge the angle error to the angle error at the time when the system is stable, and converge the distance error to the distance error at the time when the system is stable, which helps to improve the convergence speed.
[0011] In one possible implementation, the parallax of the preceding vehicle in the first image and the second image is determined; based on the parallax, a preset algorithm is used to determine the relative distance between the vehicle and the preceding vehicle, and the relative angle between the vehicle and the preceding vehicle is determined through coordinate mapping. For example, the relative distance between the vehicle and the preceding vehicle is determined based on the following formula: Where L is the baseline distance between the first and second cameras; f is the focal length of the first or second camera; and d is the parallax. In this application, two cameras are used to capture images of the preceding vehicle, and the parallax of the preceding vehicle in these two images is used to measure distance and angle. This implementation is simple and low-cost.
[0012] In one aspect, in a possible implementation, when the following vehicle condition is met, driving parameters are generated according to the relative distance and the relative angle; when the following vehicle condition is not met, the vehicle is controlled to exit the following vehicle mode.
[0013] In the present application, after the relative angle and the relative distance between the vehicle and the front vehicle are obtained, it can be determined whether the following condition is met based on the relative angle and the relative distance, and the vehicle is controlled to follow the front vehicle in the case that the following condition is met. In the case that the following condition is not met, the vehicle is controlled to exit the following mode. The following condition is also referred to as a field of view condition. The following condition being met indicates that the front vehicle is within the field of view of the vehicle. The following condition not being met indicates that the front vehicle is not within the field of view of the vehicle.
[0014] In an aspect, in a possible implementation, the following condition is that the relative distance is greater than the safety distance and less than the maximum distance that can be detected by the target camera, and the relative angle is greater than the maximum negative angle that can be detected by the target camera and less than the maximum positive angle that can be detected by the target camera; and the target camera is the first camera or the second camera. The following condition is determined based on the field of view of the camera.
[0015] In an aspect, in a possible implementation, the first camera and the second camera are symmetrically arranged at the front of the vehicle based on the center axis of the vehicle; and the first camera and the second camera are both monocular cameras.
[0016] In a second aspect, a device for controlling a vehicle is provided, and the device comprises:
[0017] a obtaining module, configured to obtain a first image of the front vehicle collected by the first camera and a second image of the front vehicle collected by the second camera;
[0018] a determining module, configured to determine a relative distance and a relative angle between the vehicle and the front vehicle according to the first image and the second image;
[0019] a control module, configured to generate a driving parameter according to the relative distance and the relative angle, and control the vehicle to follow the front vehicle based on the driving parameter; wherein the driving parameter is used to adjust the driving speed and / or the driving direction of the vehicle, so that the relative distance between the vehicle and the front vehicle approaches an expected distance and / or the relative angle between the vehicle and the front vehicle approaches an expected angle.
[0020] In a third aspect, a device for controlling a vehicle is provided, and the device comprises:
[0021] one or more processors;
[0022] a memory, configured to store one or more programs, which, when executed by the one or more processors, cause the device to implement the method for controlling a vehicle according to any one of the first aspect.
[0023] In a fourth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium stores a computer program, which, when executed by a processor of a computer, causes the computer to execute the method for controlling a vehicle according to any one of the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0024] Figure 1 is a flowchart of a method for controlling a vehicle according to an embodiment of the present application;
[0025] Figure 2 is a schematic diagram of relative distance and relative angle between vehicles according to an embodiment of the present application;
[0026] Figure 3 is a flowchart of another method for controlling a vehicle according to an embodiment of the present application;
[0027] Figure 4 is a flowchart of still another method for controlling a vehicle according to an embodiment of the present application;
[0028] Figure 5 is a structural schematic diagram of an apparatus for controlling a vehicle according to an embodiment of the present application;
[0029] Figure 6 is a structural schematic diagram of an apparatus for controlling a vehicle according to an embodiment of the present application. DETAILED DESCRIPTION
[0030] Other advantages and effects of the present application can be easily understood by those skilled in the art from the disclosure herein. The present application can also be implemented or applied in other different specific embodiments, and various modifications or changes can be made to the details herein without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, and are not intended to limit the protection scope of the present application.
[0031] It should be noted that the diagrams provided in the following embodiments only schematically illustrate the basic concept of the present application, and only the components related to the present application are shown in the diagrams, not the number, shape and size of the components when actually implemented. The actual implementation of each component may be a random change in shape, number and proportion, and the layout pattern of the components may also be more complex.
[0032] Adaptive cruise control (ACC) is an intelligent automatic control technology. Following vehicle control technology is one of the core technologies of ACC, which aims to enable vehicles to automatically follow the front vehicle and adjust their speed and direction according to the dynamics of the front vehicle, which can further improve driving efficiency and safety. Following vehicle control technology has significant advantages in improving driving safety, comfort, driving efficiency, etc., and is widely used in assisted driving, logistics transportation, intelligent transportation and other fields. With the progress of technology and the growth of market demand, following vehicle control technology has become one of the popular research directions in assisted driving, and has broad development prospects.
[0033] In some related technologies, vehicle following control is performed based on information collected by multiple sensors. For example, depth cameras located at the front and rear of the vehicle collect real-time depth data images of the road conditions in front and behind the vehicle, while light sensors located at the front and rear collect light information in the areas in front and behind the vehicle. Based on the depth data images and light information, road condition information is obtained. In this related technology, the vehicle must be equipped with at least two depth cameras and two light sensors, which is relatively costly.
[0034] In other related technologies, following vehicle control is performed based on driving data from the vehicle and the vehicles preceding and following it. For example, first vehicle information of the preceding vehicle, second vehicle information of the ego vehicle, and a safety distance are obtained. Based on the safety distance, the first vehicle information, and the second vehicle information, a target acceleration and target speed of the ego vehicle that meet preset constraints are determined. Based on these target acceleration and target speed, the ego vehicle's safety braking system is controlled. This related technology requires a large amount of information, such as information about the preceding and following vehicles, as well as the target acceleration and speed of the ego vehicle, making its implementation relatively complex.
[0035] In summary, the conventional vehicle following control method has the problems of high cost and complex implementation.
[0036] To this end, embodiments of the present application provide a method, apparatus, device, and storage medium for controlling a vehicle. Two images are captured by two cameras, such as a first camera and a second camera, respectively, and the relative distance and angle between the vehicle and the preceding vehicle are determined based on the two images. The vehicle is then controlled to follow the preceding vehicle based on the relative distance and angle between the vehicle and the preceding vehicle. The vehicle control method provided in embodiments of the present application enables vehicle following control without requiring the vehicle to be equipped with excessive sensors or to acquire excessive information, resulting in low cost and simple implementation.
[0037] A method for controlling a vehicle provided by an embodiment of the present application is described below with reference to the accompanying drawings. Figure 1 This is a flow chart of a method for controlling a vehicle provided in an embodiment of the present application. In the embodiment of the present application, after the following mode is turned on, the vehicle, such as the vehicle's control unit, periodically executes Figure 1 For example, after the following mode is turned on, the following command is executed at a preset frequency. Figure 1 The method shown is used to control the vehicle to follow the vehicle in front. The preset frequency can be, for example, 1 second / time. For another example, the preset frequency can be, for example, 0.5 seconds / time. The preset frequency can be set as needed, and the embodiment of the present application does not limit the specific value of the preset frequency. In the following mode, the vehicle can follow the vehicle in front by itself. The following model can also be called ACC mode, smart driving mode or self-driving mode, etc. Figure 1 As shown, the method includes:
[0038] S1, obtaining a first image captured by a first camera of a vehicle in front.
[0039] The first camera may be a monocular camera.
[0040] S2, obtaining a second image of the vehicle in front captured by the second camera.
[0041] The second camera may be a monocular camera.
[0042] The cameras (e.g., the first and second cameras) include components such as an image sensor, a lens, a photosensitive element, and an anti-shake motor, and are configured to convert light signals into electrical signals. For example, the cameras (e.g., the first and second cameras) generate images (e.g., the first and second images) based on the following formula.
[0043]
[0044] in, is the external parameter matrix of the camera, f x and f y are the focal lengths of the camera in the horizontal and vertical directions respectively. u0 and v0 are the optical center coordinates of the camera in the horizontal and vertical directions respectively. is the camera's intrinsic parameter matrix. For example, R is a 3×3 rotation matrix representing the camera's rotational posture. t is a 3×1 translation vector representing the camera's translational position. Both the extrinsic and intrinsic parameter matrices can be pre-stored. It is the three-dimensional coordinate of the object in the world coordinate system. For example, it can be understood as the coordinate of the object in the real world. C is the distance of the object from the camera in the world coordinate system.
[0045]
[0046] in, f x and f y The normalized focal lengths of the camera on the x-axis and y-axis are called pixels, respectively. f is the focal length of the camera, in millimeters. x d y Respectively represent the physical size of each pixel on the x-axis and y-axis, and the unit can be millimeters.
[0047] In some embodiments, the first image and the second image both include images of the preceding vehicle. The first image and the second image are images of the same scene captured by the first camera and the second camera, respectively, at the same time. In other words, the first image and the second image are images of the preceding vehicle captured by the first camera and the second camera, respectively, at the same time. The preceding vehicle can be understood as a vehicle traveling in the same direction as the vehicle and in front of the vehicle. The preceding vehicle and the vehicle are traveling in the same lane.
[0048] In some embodiments, the first image and the second image are the same size.
[0049] In some embodiments, the first camera and the second camera are positioned side by side at the front of the vehicle, and are symmetrically positioned about the vehicle's central axis. That is, when viewed from the front of the vehicle, the first camera and the second camera are positioned on either side of the vehicle's central axis, and are equidistant from the central axis. In other words, the first camera and the second camera are positioned symmetrically about the vehicle's central axis at the front of the vehicle. In some embodiments, the first camera and the second camera can be housed in the same housing for ease of installation.
[0050] The distance between the optical center of the first camera and the optical center of the second camera may be, for example, L, where L is a preset value. The optical center is the optical center of the lens of the camera (eg, the first camera and the second camera).
[0051] After acquiring the first image and the second image, the relative distance and relative angle between the vehicle and the preceding vehicle can be acquired based on the first image and the second image.
[0052] S3, obtaining a relative distance and a relative angle between the vehicle and the preceding vehicle based on the first image and the second image.
[0053] In some embodiments, the relative distance and angle between the vehicle and the preceding vehicle are obtained based on a neural network model. For example, the first image and the second image are input into the neural network model to obtain the relative distance and angle between the vehicle and the preceding vehicle. The neural network model may be, for example, a convolutional neural network model.
[0054] In other embodiments, a parallax-based depth estimation algorithm is used based on the parallax of the preceding vehicle in the first image and the second image to obtain the relative distance and relative angle between the vehicle and the preceding vehicle. Exemplarily, the relative distance and relative angle between the vehicle and the preceding vehicle are obtained based on the following method.
[0055] In a first step, a disparity of the preceding vehicle in the first image and the second image is calculated.
[0056] In some embodiments, the disparity is calculated by a feature matching method, a block matching method, an image segmentation based disparity calculation method, a deep learning based disparity calculation method, etc. For example, the result of the disparity calculation is a disparity map, which is an image with the same size as the first image or the second image. The pixel value of each pixel in the disparity map represents the disparity value of the pixel in the first image and the second image.
[0057] In a second step, a relative distance between the vehicle and the preceding vehicle is calculated based on the disparity of the preceding vehicle in the first image and the second image.
[0058] In some embodiments, the relative distance between the vehicle and the preceding vehicle is calculated by the following formula.
[0059]
[0060] In some embodiments, the depth Z of the preceding vehicle is used as the relative distance between the vehicle and the preceding vehicle. L is the distance between the optical center of the first camera and the optical center of the second camera, also known as the baseline distance. f is the focal length of the first camera or the second camera. In some embodiments, the focal length of the first camera and the second camera is f. d is the disparity of the preceding vehicle in the first image and the second image. For example, d can be the disparity value between a pixel in the preceding vehicle image in the first image and the same pixel in the preceding vehicle image in the second image.
[0061] In a third step, a relative angle between the vehicle and the preceding vehicle is calculated based on the disparity of the preceding vehicle in the first image and the second image.
[0062] In some embodiments, the relative angle between the vehicle and the preceding vehicle is determined by coordinate mapping. For example, based on the disparity of the preceding vehicle in the first image and the second image, the pixel coordinates of a target pixel in the preceding vehicle image in the first image or the second image are converted into three-dimensional coordinates in the camera coordinate system. Based on the three-dimensional coordinates, the relative angle between the vehicle and the preceding vehicle is calculated. For example, the angle between the three-dimensional coordinates and the optical center of the lens is calculated, and the angle is used as the relative angle between the vehicle and the preceding vehicle. The target pixel can be, for example, the horizontal center point of the preceding vehicle, the left edge of the preceding vehicle, or the right edge of the preceding vehicle, etc. The longitudinal direction can be the forward and backward direction of the vehicle, and the horizontal direction can be the left and right direction of the vehicle.
[0063] It should be understood that the present application does not limit the specific implementation method of obtaining the relative angle between the vehicle and the preceding vehicle. For example, the first image and / or the second image can also be input into the neural network model to obtain the relative angle between the vehicle and the preceding vehicle.
[0064] The relative distance between a vehicle and the preceding vehicle indicates the distance between them. This relative distance can be measured from the center of mass of the preceding vehicle to the center of mass of the vehicle. Alternatively, it can be measured from the front of the preceding vehicle to the front of the vehicle. The relative angle between the vehicle and the preceding vehicle indicates the lateral angle between the preceding vehicle and the preceding vehicle. This relative angle can be measured from the line connecting the centers of mass of the two vehicles to the direction of travel of the vehicle. Alternatively, it can be measured from the line connecting the front of the two vehicles to the direction of travel of the vehicle.
[0065] For example, Figure 2 As shown in (a) in FIG, the relative distance d(t) can be the distance from the center of mass of the preceding vehicle to the center of mass of the vehicle, and the relative angle θ(t) is the angle between the line connecting the centers of mass of the two vehicles and the direction of travel of the vehicle.
[0066] like Figure 2 As shown in (b) in FIG, the relative distance d(t) may be the distance from the front of the preceding vehicle to the front of the vehicle, and the relative angle θ(t) is the angle between the line connecting the fronts of the two vehicles and the direction of travel of the vehicle.
[0067] In this example, Among them, (x,y) is the coordinate of the center of mass of the front vehicle. (x L ,y L ) are the coordinates of the vehicle's center of mass. is the heading angle of the preceding vehicle. is the heading angle of the vehicle. h is the distance between the center of mass of the two vehicles and the front of the two vehicles.
[0068] After obtaining the relative distance and relative angle between the vehicle and the preceding vehicle, the vehicle is controlled to follow the preceding vehicle based on the relative distance and relative angle between the vehicle and the preceding vehicle. Exemplarily, the above method may further include:
[0069] S4: Determine whether a following vehicle condition is met based on the relative distance and relative angle between the vehicle and the preceding vehicle.
[0070] The following vehicle condition may include a first condition and a second condition. In some embodiments, the following vehicle condition may be referred to as a field of view constraint condition, or a field of view constraint model. Because cameras, such as the first camera or the second camera, are fixed to the vehicle body, their detection range and angle are subject to certain limitations. To avoid safety issues caused by collisions, field of view constraints on relative distance and relative angle are required.
[0071] The first condition is that the relative distance between the vehicle and the preceding vehicle is greater than the safety distance and less than the maximum distance that can be detected by the target camera, such as the first camera or the second camera. For example, the first condition can be expressed by the formula Indicates. Where d is the safety distance, is the maximum distance that the target camera can detect. d(t) is the relative distance between the vehicle and the preceding vehicle at any time.
[0072] The second condition is that the relative angle between the vehicle and the preceding vehicle is greater than the maximum negative angle that the target camera can detect and less than the maximum positive angle that the target camera can detect. For example, the second condition can be expressed by the formula Indicates. Among them, is the maximum negative angle that the target camera can detect, is the maximum forward angle that the target camera can detect, Less than or equal to π / 2. θ(t) is the relative angle between the vehicle and the preceding vehicle at any given moment.
[0073] Exemplarily, the following vehicle condition may be: 5 meters < d(t) < 20 meters; -90° < θ(t) < 90°.
[0074] The following condition is determined to be met if the relative distance between the vehicle and the preceding vehicle meets the first condition and the relative angle between the vehicle and the preceding vehicle meets the second condition. For example, if the following condition is: 5 meters < d(t) < 20 meters; -30° < θ(t) less than 30°, for example, if the relative distance between the vehicle and the preceding vehicle is 15 meters and the relative angle between the vehicle and the preceding vehicle is 20°, the following condition is determined to be met. If the relative distance between the vehicle and the preceding vehicle does not meet the first condition or the relative angle between the vehicle and the preceding vehicle does not meet the second condition, the following condition is determined to be unmet.
[0075] If the following vehicle condition is met, S5 is executed. If the following vehicle condition is not met, S6 is executed.
[0076] S5: When the following vehicle condition is met, the vehicle is controlled to follow the preceding vehicle based on the relative distance and relative angle between the vehicle and the preceding vehicle.
[0077] The following condition is met, indicating that the vehicle in front is within the vehicle's field of view. In this case, the vehicle is controlled to follow the vehicle in front.
[0078] S6: If the following vehicle conditions are not met, the vehicle is controlled to exit the following vehicle mode.
[0079] The following vehicle conditions are not met, indicating that the vehicle in front is no longer within the vehicle's field of view. In this case, it may not be possible to continue following the vehicle in front, and the vehicle can be controlled to exit the following mode.
[0080] As can be seen, the embodiments of the present application provide a method for controlling a vehicle that uses only two monocular cameras to acquire the relative distance and angle between the vehicle and the preceding vehicle. Furthermore, when the following vehicle conditions are met, the vehicle is controlled to follow the preceding vehicle based on the relative distance and angle between the vehicle and the preceding vehicle. This allows for vehicle-following control without requiring the vehicle to be equipped with excessive sensors or acquire excessive information, resulting in low cost and simple implementation.
[0081] In some embodiments, a driving parameter is generated based on the relative distance and relative angle between the vehicle and the preceding vehicle. The driving parameter is used to adjust the vehicle's driving speed and / or driving direction so that the relative distance between the vehicle and the preceding vehicle approaches a desired distance and / or the relative angle between the vehicle and the preceding vehicle approaches a desired angle. Based on the driving parameter, the vehicle is controlled to follow the preceding vehicle. For example, the desired distance may be, for example, d des , the desired angle may be, for example, θ in the following des .
[0082] In some embodiments, the driving parameters include torque of a left drive wheel and torque of a right drive wheel.
[0083] Figure 3 FIG. 1 is a flow chart of another method for controlling a vehicle provided in an embodiment of the present application. Figure 3 As shown, S5 may include: S101-S103.
[0084] S101: Establish a kinematic model and a dynamic model of the vehicle.
[0085] The vehicle's kinematic model is a mathematical model used to describe the changing patterns of the vehicle's state variables, such as position, velocity, and direction, during its motion. For example, the vehicle's kinematic model can be expressed using the following formula.
[0086] in, is the vehicle's heading angle. v is the vehicle's linear velocity, and w is the vehicle's angular velocity. This kinematic model can be used to characterize the vehicle's posture in the global coordinate system.
[0087] A vehicle's dynamics model is a mathematical model that describes the relationship between forces, torques, and motion states during vehicle motion. It is widely used in fields such as autonomous driving, vehicle control, and simulation. In the embodiments of this application, the vehicle's dynamics model may be, for example, an Euler-Lagrange kinematic model. The Euler-Lagrange kinematic model is briefly described below. The Euler-Lagrange equations are shown below.
[0088]
[0089] Where q is the vehicle's position, is the linear velocity and angular velocity of the vehicle, M(q) is the inertia matrix, is the Coriolis force and centrifugal force matrix, and B(q) is the input transformation matrix of the system. d is the unknown bounded disturbance of the input. τ is the motor torque. V is the desired velocity, including linear velocity and angular velocity.
[0090] S102, obtaining distance error and angle error.
[0091] The distance error is the absolute value of the difference between the relative distance between the vehicle and the preceding vehicle and the expected distance. The distance error is used to indicate the difference between the relative distance between the vehicle and the preceding vehicle and the expected distance. For example, d (t)=|d(t)-d des |. Among them, e d (t) is the distance error, d(t) is the relative distance between the vehicle and the preceding vehicle, and d des is the expected distance.
[0092] Angle error is the absolute value of the difference between the relative angle between the vehicle and the preceding vehicle and the expected angle. Angle error is used to indicate the difference between the relative angle between the vehicle and the preceding vehicle and the expected angle. For example, θ (t)=|θ(t)-θ des |. Among them, e θ (t) is the angle error, θ(t) is the relative angle between the vehicle and the preceding vehicle, θ des is the desired angle.
[0093] S103 , based on the distance error and the angle error, the driving parameters are solved in combination with the vehicle's dynamic model and kinematic model.
[0094] Optionally, S103 may be replaced by: solving driving parameters based on the distance error and the angle error in combination with the vehicle's dynamic model, kinematic model, and performance constraint model.
[0095] The performance constraint model is shown below.
[0096]
[0097] Among them, e d (t) distance error at any time, e θ (t) is the angular error at any time. ε d and ε θ is the weight coefficient. θ and β d is the performance function. This performance constraint model is used to converge the angle error to the angle error at the time when the system is stable, and to converge the distance error to the distance error at the time when the system is stable.
[0098] For example, in, It is the maximum distance that cameras such as the first camera and the second camera can detect. It is the maximum angle that cameras such as the first camera and the second camera can detect. des is the expected distance. des is the desired angle. For example, the performance function is: Among them, β d (t) distance error at the current moment; β θ (t) is the angle error at the current moment. d,0 is the distance error at time zero, β d,∞ is the distance error at the time when the system is stable. θ,0 is the angle error at time zero, β θ,∞ is the angular error at the moment the system is stable. k d and k θ Represents the rate of decrease of the performance function, and its value is greater than 0.
[0099] In this embodiment of the present application, the performance constraint model can ensure that errors (such as distance error and angle error) converge quickly within the expected range. It effectively balances the steady-state performance and transient performance of the system, ensuring the system tracking accuracy while also meeting the requirements of response speed and dynamic quality.
[0100] In some embodiments, a controller is used to solve the torque of the left drive wheel and the torque of the right drive wheel based on the distance error and the angle error. It should be understood that in this example, the controller is also called a control algorithm.
[0101] For example, the controller may be a proportional-integral-derivative controller (PID), or a linear quadratic regulator, a model predictive controller, a sliding mode controller, an adaptive controller, a fuzzy controller, a neural network controller, or any other controller.
[0102] Exemplarily, the controller is capable of outputting driving parameters based on the relative distance and angular angle between the vehicle and the preceding vehicle. The driving parameters guide the vehicle to adjust its driving speed and / or driving direction to reduce the distance error and angular error, for example, to adjust the distance error and angular error to approach zero. In other words, the driving parameters are used to control the vehicle's driving speed and / or driving direction so that the relative distance between the vehicle and the preceding vehicle approaches a desired distance and / or the relative angle between the vehicle and the preceding vehicle approaches a desired angle.
[0103] For example, after inputting the relative distance and angle between the vehicle and the preceding vehicle into the controller, the controller first calculates the distance error and angle error. The controller then generates a desired speed based on these errors. The controller then solves for τ, or motor torque, based on the desired speed, the dynamic model, and the kinematic model. Once the motor torque is determined, the torque for the left and right drive wheels is calculated based on a predefined torque distribution method.
[0104] S103: Control the vehicle based on the driving parameters so that the vehicle follows the preceding vehicle.
[0105] For example, based on the torque of the left drive wheel and the torque of the right drive wheel, the left drive wheel and the right drive wheel are driven to make the vehicle follow the preceding vehicle.
[0106] As can be seen, the embodiments of the present application utilize a monocular camera to implement vehicle-following control, which can alleviate issues such as expensive sensors and safety collisions during vehicle-following. Furthermore, the embodiments of the present application do not require the acquisition of additional information; only the relative distance and angle between the vehicle and the preceding vehicle are required to implement vehicle-following control, making implementation simple. Furthermore, the present invention ensures that errors converge rapidly within a pre-set range, guaranteeing both steady-state and transient performance of the system.
[0107] Figure 4 This is an example flow chart of another method for controlling a vehicle provided in an embodiment of the present application. Figure 4 As shown, the method includes:
[0108] S401, obtaining a first image of a leading vehicle captured by a first camera and a second image of the leading vehicle captured by a second camera.
[0109] Among them, the first camera, the second camera, the first image and the second image can be referred to in the previous introduction and will not be repeated here.
[0110] S402: Determine the relative distance and relative angle between the vehicle and the preceding vehicle based on the first image and the second image.
[0111] S403: Generate driving parameters according to the relative distance and the relative angle.
[0112] Driving parameters are used to adjust the vehicle's speed and / or direction so that the relative distance between the vehicle and the vehicle ahead approaches the desired distance and / or the relative angle between the vehicle and the vehicle ahead approaches the desired angle. Driving parameters include the torque of the left drive wheel and the torque of the right drive wheel.
[0113] S404: Based on the driving parameters, control the vehicle to follow the preceding vehicle.
[0114] The above text, in conjunction with the accompanying drawings, describes in detail the method embodiments of the present application. Below, in conjunction with the accompanying drawings, the device embodiments of the present application will be described in detail. It should be understood that the description of the device embodiments corresponds to the method embodiments. Therefore, for portions not described in detail, reference can be made to the method embodiments above.
[0115] Figure 5 5 is a schematic diagram of a structure of a vehicle control device provided in an embodiment of the present application. Exemplarily, the vehicle control device 500 includes an acquisition module 510, a determination module 520 and a control module 530.
[0116] An acquisition module 510 is configured to acquire a first image of a preceding vehicle captured by a first camera and a second image of the preceding vehicle captured by a second camera; both the first image and the second image include an image of the preceding vehicle;
[0117] A determination module 520, configured to determine a relative distance and a relative angle between the vehicle and a preceding vehicle based on the first image and the second image;
[0118] The control module 530 is used to generate driving parameters based on the relative distance and relative angle, and control the vehicle to follow the leading vehicle based on the driving parameters; wherein the driving parameters are used to adjust the vehicle's driving speed and / or driving direction so that the relative distance between the vehicle and the leading vehicle approaches the desired distance and / or the relative angle between the vehicle and the leading vehicle approaches the desired angle.
[0119] The control module 530 is also used to: establish a kinematic model of the vehicle and a dynamic model of the vehicle; obtain a distance error and an angle error; wherein the distance error is the difference between the relative distance and the expected distance; the angle error is the difference between the relative angle and the expected angle; based on the distance error and the angle error, combined with the dynamic model of the vehicle and the dynamic model of the vehicle, solve the driving parameters.
[0120] The control module 530 is also used to solve driving parameters based on the distance error, angle error, combined with the vehicle's dynamic model, the vehicle's dynamic model and the performance constraint model; wherein the performance constraint model is used to converge the angle error to the angle error at the time when the system is stable, and to converge the distance error to the distance error at the time when the system is stable.
[0121] The determination module 520 is further configured to: determine the parallax of the preceding vehicle in the first image and the second image; and determine the relative distance between the vehicle and the preceding vehicle based on the parallax and the following formula: Wherein, L is the baseline distance between the first camera and the second camera; f is the focal length of the first camera or the second camera; d is the parallax; based on the parallax, the relative angle between the vehicle and the preceding vehicle is determined through coordinate mapping.
[0122] The control module 530 is also used to generate driving parameters based on the relative distance and relative angle when the following conditions are met; the following conditions are: the relative distance is greater than the safety distance and less than the maximum distance that the target camera can detect, and the relative angle is greater than the maximum negative angle that the target camera can detect and less than the maximum positive angle that the target camera can detect; the target camera is the first camera or the second camera.
[0123] Figure 6 FIG. 6 is a schematic diagram of a vehicle control device according to an embodiment of the present application. Exemplarily, the vehicle control device 600 includes one or more processors 610 and one or more memories 620 . Figure 6 The device 600 for controlling the vehicle is used to implement the method for controlling the vehicle described in the above method embodiment. The device 600 for controlling the vehicle can be a control unit in the vehicle. The control unit can be, for example, a vehicle controller or an engine controller. Alternatively, as a possible implementation method, the control unit can also be a controller independently set up to implement the above control method.
[0124] The processor 610 can support the device 600 for controlling the vehicle to implement the method described in the above method embodiment.
[0125] The memory 620 stores a program that can be executed by the processor 610 so that the processor 610 performs the method described in the above method embodiment. The memory 620 can be independent of the processor 610 or integrated into the processor 610.
[0126] Optionally, the vehicle control device 600 may further include a transceiver 630. The processor 610 may communicate with other devices or chips via the transceiver 630. For example, the processor 610 may transmit and receive data with other devices or chips via the transceiver 630.
[0127] An embodiment of the present application provides a computer storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the steps of the method of any of the above embodiments.
[0128] It should be noted that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0129] The processor may be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, and a microprocessor. It is understood that the electronic device that implements the functions of the processor may also be other electronic devices, which are not specifically limited in the embodiments of the present application.
[0130] The computer storage medium / memory may be a read-only memory, a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface mount memory, an optical disc, or a compact disc read-only memory (CD ROM).
[0131] An embodiment of the present application provides a computer program, including computer-readable code. When the computer-readable code runs in an electronic device, a processor in the electronic device executes some or all of the steps for implementing the above method.
[0132] An embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, implements some or all of the steps in the above method. The computer program product can be implemented specifically through hardware, software, or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium. In other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc.
[0133] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned steps / processes does not mean the order of execution, and the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The above-mentioned serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.
[0134] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0135] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0136] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed across multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0137] In addition, all functional units in the embodiments of the present application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the above-mentioned integrated units can be implemented in the form of hardware or in the form of hardware plus software functional units.
[0138] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, and other media that can store program codes.
[0139] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a vehicle-mounted terminal (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods of each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0140] The above is only an embodiment of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or replacements within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
[0141] The above embodiments are only preferred embodiments for fully illustrating the present application, and the protection scope of the present application is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art based on the present application are within the protection scope of the present application.
Claims
1. A method for controlling a vehicle, characterized in that: The vehicle is in a following mode, and the method includes: Acquire a first image of a preceding vehicle captured by a first camera and a second image of the preceding vehicle captured by a second camera; determining a relative distance and a relative angle between the vehicle and the preceding vehicle based on the first image and the second image; generating a driving parameter according to the relative distance and the relative angle; Based on the driving parameters, controlling the vehicle to follow the preceding vehicle; The driving parameters are used to adjust the driving speed and / or driving direction of the vehicle so that the relative distance between the vehicle and the preceding vehicle approaches the desired distance and / or the relative angle between the vehicle and the preceding vehicle approaches the desired angle.
2. The method according to claim 1, characterized in that Generating the driving parameter according to the relative distance and the relative angle includes: Establishing a kinematic model of the vehicle and a dynamic model of the vehicle; Obtaining a distance error and an angle error; wherein the distance error is the difference between the relative distance and the expected distance; and the angle error is the difference between the relative angle and the expected angle; Based on the distance error and the angle error, the driving parameters are solved in combination with the vehicle dynamics model and the vehicle dynamics model.
3. The method according to claim 2, characterized in that The step of solving the driving parameter based on the distance error and the angle error in combination with the vehicle dynamics model and the vehicle dynamics model includes: Based on the distance error and the angle error, combined with the vehicle's dynamic model, the vehicle's dynamic model and a performance constraint model, the driving parameters are solved; wherein the performance constraint model is used to converge the angle error to the angle error at the moment the system is stable, and to converge the distance error to the distance error at the moment the system is stable.
4. The method according to any one of claims 1 to 3, characterized in that The determining, based on the first image and the second image, a relative distance and a relative angle between the vehicle and the preceding vehicle includes: determining a parallax of the preceding vehicle in the first image and the second image; According to the parallax, the relative distance between the vehicle and the preceding vehicle is determined based on the following formula: Wherein, L is the baseline distance between the first camera and the second camera; f is the focal length of the first camera or the second camera; d is the parallax; According to the parallax, a relative angle between the vehicle and the preceding vehicle is determined through coordinate mapping.
5. The method according to any one of claims 1 to 4, characterized in that Generating the driving parameter according to the relative distance and the relative angle includes: generating the driving parameter according to the relative distance and the relative angle when the vehicle-following condition is met; The following vehicle condition is: the relative distance is greater than the safety distance and less than the maximum distance that the target camera can detect, and the relative angle is greater than the maximum negative angle that the target camera can detect and less than the maximum positive angle that the target camera can detect; the target camera is the first camera or the second camera.
6. The method according to any one of claims 1 to 5, characterized in that The first camera and the second camera are symmetrically arranged on the front of the vehicle based on the central axis of the vehicle; the first camera and the second camera are both monocular cameras.
7. The method according to any one of claims 1 to 6, characterized in that The driving parameters include the torque of the left drive wheel and the torque of the right drive wheel.
8. A device for controlling a vehicle, characterized in that: The device comprises: An acquisition module, configured to acquire a first image of a preceding vehicle captured by a first camera and a second image of the preceding vehicle captured by a second camera; a determination module, configured to determine a relative distance and a relative angle between the vehicle and the preceding vehicle based on the first image and the second image; A control module is configured to generate driving parameters based on the relative distance and the relative angle, and control the vehicle to follow the leading vehicle based on the driving parameters; wherein the driving parameters are used to adjust the driving speed and / or driving direction of the vehicle so that the relative distance between the vehicle and the leading vehicle approaches a desired distance and / or the relative angle between the vehicle and the leading vehicle approaches a desired angle.
9. A device for controlling a vehicle, characterized in that: The device comprises: one or more processors; A memory for storing one or more programs, which, when executed by the one or more processors, enables the device to implement the method for controlling a vehicle as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the method for controlling a vehicle according to any one of claims 1 to 7.