# Patent

## Title
Hitch angle detection for trailer backup assist system

## Abstract

A system for detecting a hitch angle between a vehicle and a trailer is provided herein. An imaging device is configured to capture images of the trailer and a controller is configured to process images captured by the imaging device. The controller derives a template image having a trailer contour and matches the template image to a search image. The hitch angle is determined based on a positional relationship between the template image and the search image.

## Background
FIELD OF THE INVENTION
The present invention generally relates to trailer backup assist systems, and more particularly, to trailer backup assist systems employing hitch angle detection through image processing.
BACKGROUND OF THE INVENTION
Reversing a vehicle while towing a trailer can be challenging for many drivers, particularly for drivers that drive with a trailer on an infrequent basis or with various types of trailers. Some systems used to assist a driver in backing a trailer rely on hitch angle measurements to determine the position of the trailer relative to the vehicle. Thus, the accuracy and reliability of the hitch angle measurements can be critical to the operation of the trailer backup assist system.
SUMMARY OF THE INVENTION
According to one aspect of the present invention, a system for detecting a hitch angle between a vehicle and a trailer is provided. An imaging device is configured to capture images of the trailer and a controller is configured to process images captured by the imaging device. The controller derives a template image having a trailer contour and matches the template image to a search image. The hitch angle is determined based on a positional relationship between the template image and the search image.
According to another aspect of the present invention, a system for detecting a hitch angle between a vehicle and a trailer is provided. An imaging device is configured to capture images of the trailer and a controller is configured to process images captured by the imaging device. The controller derives a template image having a trailer contour and rotates the template image relative to a search image about an imaged hitch point that is common to the template image and the search image. The controller determines the hitch angle based on an angle at which the template image is rotated relative to the search image to generate a match therebetween.
According to yet another aspect of the present invention, a method for detecting a hitch angle between a vehicle and a trailer is provided. The method includes the steps of capturing images of the trailer using an imaging device and providing a controller that is configured to process images captured by the imaging device. The controller derives a template image having a trailer contour and matches the template image to a search image. The hitch angle is determined based on a positional relationship between the template image and the search image.
These and other features, advantages, and objects of the present invention will be further understood and appreciated by those skilled in the art by reference to the following specification, claims, and appended drawings.



BRIEF DESCRIPTION OF THE DRAWINGS
In the drawings:
FIG. 1 is a top perspective view of a vehicle attached to a trailer with one embodiment of a hitch angle sensor for operating a trailer backup assist system;
FIG. 2 is a block diagram illustrating one embodiment of the trailer backup assist system having a steering input device, a curvature controller, and a trailer braking system;
FIG. 3 is a flow diagram of a method of detecting a hitch angle, according to one embodiment;
FIG. 4 is a captured image showing a trailer in straight alignment with a vehicle and the presence of ground noise;
FIG. 5 is an edge map of the captured image shown in FIG. 4;
FIG. 6 illustrates the blurring of ground noise in an averaged image;
FIG. 7 is an edge map of the averaged image shown in FIG. 6;
FIG. 8 illustrates a trailer contour of a template image;
FIG. 9 illustrates a template image being matched to a search image to determine a hitch angle;
FIG. 10 is a search image having a proximity zone for jackknife detection and a number of candidate hitch point locations about which a template image can be rotated to determine an actual imaged hitch point and a hitch angle;
FIG. 11 is a flow diagram of a method of detecting a hitch angle, according to another embodiment;
FIG. 12 is an edge map of a captured image showing a number of candidate lines, one of which, is selected to determine a hitch angle based on its angular position relative to a reference line;
FIG. 13 is a flow diagram of a method of locating an imaged hitch point, according to one embodiment;
FIGS. 14 and 15 are each captured images in which a trailer appears at a distinct hitch angle and a detection window is used to scan an imaged drawbar to locate an imaged hitch point;
FIG. 16 is a graph illustrating averaged pixel differences for a number of pixel positions common to the captured images shown in FIGS. 14 and 15;
FIG. 17 is a kinematic model of the vehicle and trailer shown in FIG. 1;
FIG. 18 is a flow diagram of a method of detecting a hitch angle, according to yet another embodiment; and
FIG. 19 is a flow diagram of a method of initializing hitch angle detection, according to one embodiment.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
For purposes of description herein, it is to be understood that the disclosed trailer backup assist system and the related methods may assume various alternative embodiments and orientations, except where expressly specified to the contrary. It is also to be understood that the specific devices and processes illustrated in the attached drawings, and described in the following specification, are simply exemplary embodiments of the inventive concepts defined in the appended claims. While various aspects of the trailer backup assist system and the related methods are described with reference to a particular illustrative embodiment, the disclosed invention is not limited to such embodiments, and additional modifications, applications, and embodiments may be implemented without departing from the disclosed invention. Hence, specific dimensions and other physical characteristics relating to the embodiments disclosed herein are not to be considered as limiting, unless the claims expressly state otherwise.
As used herein, the term “and/or,” when used in a list of two or more items, means that any one of the listed items can be employed by itself, or any combination of two or more of the listed items can be employed. For example, if a composition is described as containing components A, B, and/or C, the composition can contain A alone; B alone; C alone; A and B in combination; A and C in combination; B and C in combination; or A, B, and C in combination.
Referring to FIGS. 1 and 2, reference numeral 10 generally designates a trailer backup assist system for controlling a backing path of a trailer 12 attached to a vehicle 14 by allowing a driver of the vehicle 14 to specify a desired curvature of the backing path of the trailer 12. The vehicle 14 is embodied as a pickup truck that is is pivotally attached to one embodiment of the trailer 12 that has a box frame 16 with an enclosed cargo area 18, a single axle 20 operably coupled to wheels 22 and 24, and a tongue 26 longitudinally extending forward from the enclosed cargo area 18. The illustrated trailer 12 also has a trailer hitch connector in the form of a coupler assembly 28 that is connected to a vehicle hitch connector in the form of a hitch ball 30 and drawbar 31. The coupler assembly 28 latches onto the hitch ball 30 to provide a pivoting hitch point 32 that allows for articulation of a hitch angle between the vehicle 14 and the trailer 12. As defined herein, the hitch angle corresponds to the angle formed between the center longitudinal axis of the vehicle 14 and of the trailer 12 (see hitch angle γ; FIG. 17). It should be appreciated that additional embodiments of the trailer 12 may alternatively couple with the vehicle 14 to provide a pivoting connection, such as by connecting with a fifth wheel connector. It is also contemplated that additional embodiments of the trailer 12 may include more than one axle and may have various shapes and sizes configured for different loads and items, such as a boat trailer or a flatbed trailer.
The trailer backup assist system 10 also includes an imaging device 34 located at the rear of the vehicle 14 and configured to image a rear-vehicle scene. The imaging device 34 may be centrally located at an upper region of a vehicle tailgate 35 such that the imaging device 34 is elevated relative to the tongue 26 of the trailer 12. The imaging device 34 has a field of view 36 located and oriented to capture one or more images that may include the tongue 26 of the trailer 12 and the hitch ball 30, among other things. Captured images are supplied to a controller 38 of the trailer backup assist system 10 and are processed by the controller 38 to determine the hitch angle between the vehicle 14 and the trailer 12, as will be described in greater detail herein. The controller 38 is configured with a microprocessor 40 and/or other analog and/or digital circuitry for processing one or more logic routines stored in a memory 42. The logic routines may include one or more hitch angle detection routines 44 and an operating routines 46. Information from the imaging device 34 or other components of the trailer backup assist system 10 can be supplied to the controller 38 via a communication network of the vehicle 14, which can include a controller area network (CAN), a local interconnect network (LIN), or other conventional protocols used in the automotive industry. It should be appreciated that the controller 38 may be a stand-alone dedicated controller or may be a shared controller integrated with the imaging device 34 or other component of the trailer backup assist system 10 in addition to any other conceivable onboard or off-board vehicle control systems.
With respect to the present embodiment, the controller 38 of trailer backup assist system 10 may be configured to communicate with a variety of vehicle equipment. The trailer backup assist system 10 may include a vehicle sensor module 48 that monitors certain dynamics of the vehicle 14. The vehicle sensor module 48 may generate a plurality of signals that are communicated to the controller 38 and may include a vehicle speed signal generated by a speed sensor 50 and a vehicle yaw rate signal generated by a yaw rate sensor 52. A steering input device 54 may be provided to enable a driver to control or otherwise modify the desired curvature of the backing path of the trailer 12. The steering input device 54 may be communicatively coupled to the controller 38 in a wired or wireless manner and provides the controller 38 with information defining the desired curvature of the backing path of the trailer 12. In response, the controller 38 processes the information and generates corresponding steering commands that are supplied to a power assist steering system 56 of the vehicle 14. In one embodiment, the steering input device 54 includes a rotatable knob 58 operable between a number of rotated positions that each provide an incremental change to the desired curvature of the backing path of the trailer 12.
According to one embodiment, the controller 38 of the trailer backup assist system 10 may control the power assist steering system 56 of the vehicle 14 to operate the steered wheels 60 of the vehicle 14 for moving the vehicle 14 in such a manner that the trailer 12 reacts in accordance with the desired curvature of the backing path of the trailer 12. The power assist steering system 56 may be an electric power-assisted steering (EPAS) system that includes an electric steering motor 62 for turning the steered wheels 60 to a steering angle based on a steering command generated by the controller 38, whereby the steering angle may be sensed by a steering angle sensor 64 of the power assist steering system 56 and provided to the controller 38. The steering command may be provided for autonomously steering the vehicle 14 during a backup maneuver and may alternatively be provided manually via a rotational position (e.g., a steering wheel angle) of a steering wheel 66 or the rotatable knob 58. However, in some embodiments, the steering wheel 66 of the vehicle 14 may be mechanically coupled with the steered wheels 60 of the vehicle 14, such that the steering wheel 66 moves in concert with steered wheels 60 via an internal torque, thereby preventing manual intervention with the steering wheel 66 during autonomous steering of the vehicle 14. In such instances, the power assist steering system 56 may include a torque sensor 68 that senses torque (e.g., gripping and/or turning) on the steering wheel 66 that is not expected from autonomous control of the steering wheel 68 and therefore indicative of manual intervention by the driver. In some embodiments, external torque applied to the steering wheel 66 may serve as a signal to the controller 38 that the driver has taken manual control and for the trailer backup assist system 10 to discontinue autonomous steering functionality.
The controller 38 of the trailer backup assist system 10 may also communicate with a vehicle brake control system 70 of the vehicle 14 to receive vehicle speed information such as individual wheel speeds of the vehicle 14. Additionally or alternatively, vehicle speed information may be provided to the controller 38 by a powertrain control system 72 and/or the speed sensor 50, among other conceivable means. It is conceivable that individual wheel speeds may be used to determine a vehicle yaw rate, which can be provided to the controller 38 in the alternative, or in addition to, the vehicle yaw rate measured by yaw rate sensor 52 of the vehicle sensor module 48. In some embodiments, the controller 38 may provide braking commands to the vehicle brake control system 70, thereby allowing the trailer backup assist system 10 to regulate the speed of the vehicle 14 during a backup maneuver of the trailer 12. It should be appreciated that the controller 38 may additionally or alternatively regulate the speed of the vehicle 14 via interaction with the powertrain control system 72.
Through interaction with the power assist steering system 56, the vehicle brake control system 70, and/or the powertrain control system 72 of the vehicle 14, the potential for unacceptable trailer backup conditions can be reduced. Examples of unacceptable trailer backup conditions include, but are not limited to, a vehicle over-speed condition, a high hitch angle rate, hitch angle dynamic instability, a trailer jackknife condition, sensor failure, and the like. In such circumstances, the driver may be unaware of the failure until the unacceptable trailer backup condition is imminent or already happening. Therefore, it is disclosed herein that the controller 38 of the trailer backup assist system 10 can generate an alert signal corresponding to a notification of an actual, impending, and/or anticipated unacceptable trailer backup condition, and prior to driver intervention, generate a counter measure to prevent such an unacceptable trailer backup condition.
According to one embodiment, the controller 38 may communicate with one or more devices, including a vehicle alert system 74, which may prompt visual, auditory, and tactile warnings. For instance, vehicle brake lights 76 and vehicle emergency flashers may provide a visual alert and a vehicle horn 78 and/or speaker 80 may provide an audible alert. Additionally, the controller 38 and/or vehicle alert system 74 may communicate with a human machine interface (HMI) 82 of the vehicle 14. The HMI 82 may include a touchscreen vehicle display 84 such as a center-stack mounted navigation or entertainment display capable of displaying images indicating the alert. Such an embodiment may be desirable to notify the driver of the vehicle 14 that an unacceptable trailer backup condition is afoot. Further, it is contemplated that the controller 38 may communicate via wireless communication with one or more electronic portable devices such as portable electronic device 86, which is embodied as a smartphone. The portable electronic device 86 may include a display 88 for displaying one or more images and other information to a user. In response, the portable electronic device 86 may provide feedback information, such as visual, audible, and tactile alerts.
Referring to FIG. 3, a method of detecting hitch angle is illustrated. The method, also referred to herein as “the template matching method,” may be executed by the controller 38 of the trailer backup assist system 10 and is shown as one embodiment of the hitch angle detection routine 44. The template matching method generally includes processing image information to distinguish trailer contour from ground noise in images captured by the imaging device 34. The trailer contour then serves as a template and is matched to a search image to determine the hitch angle between the vehicle 14 and the trailer. 12
For purposes of illustration, a captured image 90 is exemplarily shown in FIG. 4 illustrating the trailer 12 in straight alignment with the vehicle 14 and the presence of ground noise. As defined herein, ground noise generally corresponds to any ground structure capable of interfering with image acquisition of the trailer 12. With respect to the captured image 90, potential ground noise candidates may include large stones (e.g., stone 92) and irregular ground surfaces (e.g., ground surface 94). As such, it may be difficult to accurately identify the trailer 12 when an image acquisition technique, namely edge detection, is applied to the captured image 90, as exemplarily shown in FIG. 5. With these things in mind, the template matching method described herein is able to blur out ground noise to enable identification of one or more trailer contours. Once identified, the trailer contour(s) may be stored as a template image that is matched to a search image to determine the hitch angle between the vehicle 14 and the trailer 12. In practice, the method has been found highly robust and benefits from relatively fast and straightforward computations.
The template matching method may begin at step 100, where the driver or other occupant initiates the trailer backup assist system 10. This may be achieved via user-input made through the display 84 of the vehicle 14 or other conceivable means. At step 110, the driver is instructed to pull the trailer 12 in a straight direction such that the hitch angle between the vehicle 14 and the trailer 12 is substantially zero. While the vehicle 14 and trailer 12 are engaged in the straight pull maneuver, the controller 38 derives an averaged image of all images captured by the imaging device 34 during a period of time at step 120. It has been discovered that 1-3 seconds typically suffices. Notably, the trailer 12 appears stationary within the images captured by the imaging device 34 whereas ground noise constantly changes from image to image. Thus, with respect to the averaged image, pixels associated with the trailer 12 will keep their contrast whereas pixels associated with ground noise will be blurred. To illustrate this effect, an averaged image 125 is exemplarily shown in FIG. 6.
At step 130, the controller 38 derives an edge map of the averaged image by calculating the intensity gradient for each pixel of the averaged image 125. The intensity gradient, or edge value, of each pixel may range from 0 to 255. For purposes of illustration, an edge map 135 is exemplarily shown in FIG. 7, in which the edge values of pixels associated with ground noise have been substantially weakened due to the blurring effect. At step 140, the controller 38 compares the edge value of each pixel of the edge map 135 to a threshold value (e.g., 30). Pixels having an edge value meeting or exceeding the threshold value are identified as trailer pixels whereas pixels having an edge value not meeting or exceeding the threshold value are identified as ground noise pixels. Once the trailer pixels have been identified, the controller 38 determines one or more trailer contours at step 150. The trailer contour(s) are saved to the memory 42 of the controller 38 as a template image at step 160 and may include a substantial entirety of the imaged trailer 12 or portions thereof. For purposes of illustration, a trailer contour 152 is shown in FIG. 8. As shown, the trailer contour 152 has a square shape, which is generally more computationally efficient. In its current position, the trailer contour 152 may serve as a zero hitch angle reference and enables the hitch angle between the vehicle 14 and the trailer 12 to be determined in subsequent images (i.e., search images) via template matching at step 170.
According to one embodiment, as shown in FIG. 9, the hitch angle between the vehicle 14 and the trailer 12 may be determined based on a positional relationship between a template image 158 and a search image 171. More specifically, the hitch angle may be determined by superimposing the template image 158 over the search image 171 such that the template image 158 is initially in a zero hitch angle position and subsequently rotating the template image 158 about a rotation point, preferably the imaged hitch point 172. The direction of rotation can be predicted based on information received from the steering angle sensor 64 or other sensors from which an initial assessment can be made concerning the angular position of the trailer 12 relative to the vehicle 14. Once the template image 158 has been matched to the search image 171, the angle θ at which the template image 158 is rotated relative to the zero hitch angle position can be correlated to the hitch angle between the vehicle 14 and the trailer 12.
According to one embodiment, the imaged hitch point 172 may be determined through process of elimination. For instance, as exemplarily shown in FIG. 10, the controller 38 may define a number of candidate hitch point locations 173a-173d that are positioned along a reference line 174 that extends vertically across the middle column of the search image 171. The reference line 174 is defined by the controller 38 and is assumed to coincide with the center longitudinal axis of an imaged drawbar 175 and intersect with the hitch point 172 of the imaged vehicle 14 and trailer 12. The candidate hitch point locations 173a-173d are shown evenly spaced along the reference line 174 but may vary in number and spacing in other embodiments. Once the template image 158 has been derived and the vehicle 14 and trailer 12 are moving along a curved path, the controller 38 may superimpose the template image 158 onto the search image 171 at the zero hitch angle position and rotate the template image 158 about each of the candidate hitch point locations 173a-173d in an attempt to match the template image 158 with the search image 171. Based on the match quality, a confidence score is given to each candidate hitch point location 173a-173d and the candidate hitch point location 173a-173d receiving the highest confidence score is selected as the hitch point. In the event the matching quality associated with each candidate hitch point location 173a-173d is below a predetermined threshold, the controller 38 may define additional candidate hitch point locations (not shown) along the reference line 174 in either or both directions of the candidate hitch point location 173a-173d that received the highest confidence score and execute template matching with respect to each of the additional candidate hitch point locations. This process may be iterated as many times as needed until the predetermined threshold has been met. In so doing, the location of the candidate hitch point location that is ultimately selected as the imaged hitch point will closely mirror the location of the actual hitch point 172.
While matching the template image 158 to the search image 171, the controller 38 may additionally determine the presence of an imminent jackknife scenario at step 180. With continued reference to FIG. 10, the displacement of the template image 158 may be monitored relative to a proximity zone 182 while the template image 158 is rotated about the rotation point. In the illustrated embodiment, the proximity zone 182 may be defined as the space between an imaged rear bumper 184 of the vehicle 14 and a boundary line 186 that is defined by the controller 38 and overlaid onto the search image 171. The boundary line 186 may be v-shaped and includes a pair of straight segments 188 extending outwardly at an angle from a point 189 that is located on the reference line 174 and is disposed between the imaged hitch point 172 and the imaged rear bumper 184. It should be appreciated that the boundary line 186 may assume other shapes in alternative embodiments. The location and shape of the boundary line 186 may be determined based on various considerations such as, but not limited to, vehicle speed, trailer length, drawbar length, imager characteristics, trailer contour, and vehicle contour. It is generally assumed that vehicle speed, trailer length, drawbar length, and image characteristics are known or may be otherwise measured and inputted to the trailer backup assist system 10. Vehicle contour, such as that of the imaged rear bumper 184, may be programmed at the factory.
In the event the template image 158 crosses into the proximity zone 182 of the search image 171, the controller 38 determines that an imminent jackknife scenario is present and initiates a jackknife countermeasure at step 190. Otherwise, if it is determined that an imminent jackknife scenario is not present, the controller 38 may continue to determine the hitch angle between the vehicle 14 and the trailer 12, as discussed previously with respect to step 170. The jackknife countermeasure may include generating an auditory warning via the vehicle alert system 74, generating a visual warning via the display 84, generating a braking command to the vehicle brake control system 70, reducing the torque of the powertrain control system 72, modifying the steering angle of the vehicle 14, or a combination thereof in addition to any other conceivable countermeasures. Since the trailer 12 will likely be in motion upon the controller 38 determining that an imminent jackknife scenario is present, it is generally desirable to locate and dimension the proximity zone 182 in a manner that provides sufficient time for a jackknife scenario to be detected and a countermeasure to be implemented, thereby minimizing the potential of an actual jackknifing and/or collision between the trailer 12 and the vehicle 14. Doing so also overcomes any response latency that may be inherent in the trailer backup assist system 10. While steps 170 and 180 have been illustrated in a linear fashion, it should be appreciated that both steps may be performed simultaneously.
Referring to FIG. 11, another method of detecting hitch angle is illustrated. The method, also referred to herein as “the centerline method,” may be executed by the controller 38 of the trailer backup assist system 10 and is exemplarily shown as one embodiment of the hitch angle detection routine 44. The centerline method also utilizes image information obtained by processing images captured by the imaging device 34 to determine the hitch angle between the vehicle 14 and the trailer 12. The centerline method differs from the template matching method in that the vehicle 14 and the trailer 12 need not be moving a straight direction prior to hitch angle detection, thus making the centerline method particularly useful in instances where no template image is available for the trailer 12 and the driver is prevented from pulling the trailer 12 in a straight line. When compared to the template matching method, the centerline method generally benefits from faster processing times, but is also generally less reliable. Therefore, it can be said that the centerline method provides a quick start to hitch angle detection and may be replaced at a later time by the template matching method or other suitable methods providing more reliable hitch angle measurements. Thus, for purposes of illustration, the centerline method will be described in greater detail below under the condition that no template image is available and that the vehicle 14 and trailer 12 are initially moving along a curved path.
The centerline method may begin at step 200, where the controller 38 processes successive images captured by the imaging device 34 to derive an averaged image. At step 210, the controller 38 derives an edge map by calculating an intensity gradient, or edge value, for each pixel in the averaged image. At step 220, the controller 38 identifies trailer pixels in the edge map by comparing the edge value of each pixel to a threshold value and selecting only those pixels meeting or exceeding the threshold value to correspond to trailer pixels. For purposes of illustration, an edge map 222 is exemplarily shown in FIG. 12, wherein one embodiment of the imaged trailer 12 appears slightly blurred as a result of angular displacement of the trailer 12 relative to the vehicle 14. It is contemplated that additional threshold values may be used to differentiate between trailer pixels and vehicle pixels since vehicle pixels will generally have a higher degree of contrast relative to trailer pixels due to the blurring of the trailer 12. At step 230, the controller 38 defines a number of candidate lines on the edge map 222, as exemplarily shown in FIG. 12. The candidate lines project outwardly from a common projection point, preferably the imaged hitch point 232. The direction at which the candidate lines project may vary based on a width of the rear bumper of the vehicle 14, a length of the drawbar of the vehicle 14, and a length of the tongue of the trailer 12. In the illustrated embodiment, the candidate lines may vary from −90 degrees to 90 degrees with respect to a reference line 234 that is indicative of a predetermined hitch angle (e.g., a zero hitch angle) and extends vertically across the middle column of the edge map 222 and intersects the imaged hitch point 232. While the exact location of the imaged hitch point 232 may be unknown initially, the controller 38 may assign a default projection point from which to project the candidate lines. Since it's assumed the hitch point 232 will typically be located along the reference line 234 and usually falls within a predictable range (e.g., 10-20 centimeters from the rear bumper of the vehicle 14), the selection of a default projection point meeting the foregoing criteria is generally sufficient for the purposes of initial hitch angle detection.
At step 240, the controller 38 selects the candidate line (e.g., candidate line 242) having approximately the same number of trailer pixels on each of its sides, or said differently, the candidate line, or centerline, about which the trailer pixels are substantially symmetric. Once the controller 38 has made a candidate line selection, the controller 38 may determine the hitch angle between the vehicle 14 and the trailer 12 based on the angular position of the selected candidate line 242 relative to the reference line 234 at step 250. More specifically, the angle θ between the selected candidate line 242 and the reference line 234 can be correlated to the hitch angle between the vehicle 14 and the trailer 12. As the vehicle 14 and trailer 12 continue along its course, steps 200-250 may be iterated with subsequent images captured by the imaging device 34 to continually provide hitch angle measurements.
Referring to FIG. 13, a method of locating an imaged hitch point in images captured by the imaging device 34 is illustrated. The method, also referred to herein as “the drawbar scan method,” may be executed by the controller 38 of the trailer backup assist system 10 and may be embodied as a subroutine of the hitch angle detection routine 44. The drawbar scan method generally requires the trailer 12 to be moving relative to the vehicle 14 at a non-zero hitch angle in order to identify an imaged hitch point. As such, the drawbar scan method may be executed to provide a suitable rotation point or projection point when executing the centerline method or the template matching method in instances where the vehicle 14 and trailer 12 are moving along a curved path. By identifying the imaged hitch point, more accurate hitch angle measurements can be achieved.
The drawbar scan method generally begins at step 300, where the controller 38 selects two images captured by the imaging device 34 that show the trailer 12 at distinct hitch angles. The two images may be successive or non-successive depending on the frame rate of the imaging device 34. In practice, a noticeable difference in hitch angles between the two images is generally preferred. At step 310, the controller 38 derives an edge map for both images by calculating the intensity gradient, or edge value, for each of their corresponding pixels. For purposes of illustration, FIG. 14 shows a first image 312 in which the hitch angle between the vehicle 14 and the trailer 12 is approximately zero whereas FIG. 15 shows a second image 314 in which the hitch angle between the vehicle 14 and the trailer 12 is approximately 5 degrees relative to the zero hitch angle position shown in FIG. 14. For purposes of clarity, the edge maps associated with both images 312, 314 are not shown. At step 320, the controller 38 defines a detection window 322 of variable height and width in both images 312, 314. Each detection window 322 is centered at a common pixel position, such as pixel position 324, which is located on a reference line 326 that extends vertically across the middle column of the corresponding image 312, 314. The reference line 326 is defined by the controller 38 and is assumed to coincide with the center longitudinal axis of an imaged drawbar 327 and intersect with an imaged hitch point 328 between the vehicle 14 and the trailer 12.
At step 330, the controller 38 determines an average pixel intensity of the pixels bounded by each detection window 322 when centered at the current pixel position, and at step 340, the controller 38 calculates an averaged pixel difference, which is defined herein as the absolute value of the difference between the average pixel intensities, as calculated at step 330. Once the average pixel difference has been calculated, at step 350, the controller 38 shifts each detection window 322 in an upward vertical direction (as specified by arrow 342) so that each detection window 322 is commonly centered at a new pixel position that is 1 or more pixel positions higher on the corresponding reference line 326 than the previous pixel position. Thus, by making multiple iterations of steps 330-350, the controller 38 may calculate averaged pixel differences for when each detection window 322 is commonly centered at a number of pixel positions along the reference line 326. Once this has been done, at step 360, the controller 38 extrapolates the location of the hitch point 328 based on variations in the calculated averaged pixel differences.
With respect to images 312 and 314, it is generally expected that little variation will occur between the calculated averaged pixel differences associated with pixel positions that coincide with the imaged drawbar 327 due in part to the imaged drawbar 327 appearing in a common fixed position in both images 312, 314. In contrast, it is generally expected that greater variation to occur between the calculated averaged pixel differences associated with pixel positions that are located on portions of the reference line 326 that extend beyond the imaged drawbar 327 due in part to the trailer 12 appearing in different positions in both images 312, 314. For purposes of illustration, a graph is shown in FIG. 16 illustrating calculated averaged pixel differences for a number of pixel positions along the vertical reference line 326. The pixel positions may fall within a predetermined range in which the imaged hitch point 328 is expected to be located, thereby negating the need to determine averaged pixel differences for pixel positions along the vertical reference line 326 that are unlikely to correspond to the imaged hitch point 328.
As shown in FIG. 16, the graph generally demonstrates a relatively constant averaged pixel difference between 2 and 3 when each detection window 322 is commonly centered at pixel positions 0-44 as those pixel positions coincide with the imaged drawbar 327. In contrast the graph in FIG. 15 generally demonstrates a sharp increase in averaged pixel differences when each detection window 322 is commonly centered at pixel positions 46-70 as those pixel positions are located on portions of the reference line 326 that extend past the imaged drawbar 327. Recognizing this, the controller 38 may select, as the imaged hitch point 328, one of the pixel positions (e.g., pixel position 44 or 45) leading up to the sharp increase in averaged pixel differences. According to one embodiment, the controller 38 may iterate steps 330-350 of the drawbar scan method until the averaged pixel difference meets or exceeds a predetermined threshold value (e.g., 3.5) and select, as the imaged hitch point, the pixel position associated with the calculated averaged pixel difference that meets or exceeds the threshold value. This threshold value may be determined based on a number of considerations including, but not limited to, the size of the detection window 322, properties of the imaging device 34, etc. Once identified, the selected imaged hitch point should closely mirror the actual imaged hitch point 328 and may be used for hitch angle detection pursuant to the template matching method or the centerline method.
Referring to FIG. 17, a kinematic model of the vehicle 14 and trailer 12 is shown and serves as the basis for determining hitch angle according to another method, referred to herein as “the steady state method” and described in greater detail below. As shown in FIG. 17, the kinematic model is based on various parameters associated with the vehicle 14 and the trailer 12. These parameters include:
δ: steering angle at steered wheels 60 of the vehicle 14;
α: yaw angle of the vehicle 14;
β: yaw angle of the trailer 12;
γ: hitch angle between the vehicle 14 and the trailer 12 (γ=β−α);
W: wheelbase length between a front axle 370 and a rear axle 372 of the vehicle 14;
L: drawbar length between the hitch point 32 and the rear axle 372 of the vehicle 14;
D: trailer length between the hitch point 32 and axle 20 of the trailer 12 or effective axle for a multiple axle trailer; and
v: vehicle longitudinal speed.
From the kinematic model shown in FIG. 17, the yaw rate of the vehicle 14 may be represented with the following equation:




  
    
      d
      α
    
    
      d
      t
    
  
  =
  
    
      -
      
        v
        W
      
    
    ⁢
    tan
    ⁢
    
      
    
    ⁢
    δ
  




Furthermore, the yaw rate of the trailer 12 may be represented with the following equation:




  
    
      d
      β
    
    
      d
      t
    
  
  =
  
    
      
        v
        D
      
      ⁢
      sin
      ⁢
      
        
      
      ⁢
      γ
    
    +
    
      
        Lv
        DW
      
      ⁢
      cos
      ⁢
      
        
      
      ⁢
      γ
      ⁢
      
        
      
      ⁢
      tan
      ⁢
      
        
      
      ⁢
      δ
    
  




Accordingly, when the yaw rate of the vehicle 14 and the trailer 12 become equal, the hitch angle γ and the steering angle δ will be constant. This condition, referred to herein as steady state, can occur when a steering command is steadily maintained during a backing maneuver such as when the trailer 12 is reversed in a straight line with the vehicle 14 or when the vehicle 14 and trailer 12 are turning at a constant curvature for at least a threshold period of time or over a threshold distance of motion. Under such steady state driving conditions, the resulting hitch angle γ can be described using the following equation:

c=a cos γ+b sin γ

This equation can be rewritten as follows:

c=a√{square root over (1−sin2 γ)}+b sin γ

The above equation can be rearranged into quadratic form and rewritten as follows:

c2−a2−2bc sin γ+(b2+a2)sin γ=0

Solving the quadratic equation for the hitch angle γ yields the following hitch angle equation:




  γ
  =
  
    arc
    ⁢
    
      
    
    ⁢
    sin
    ⁢
    
      
        bc
        ±
        
          a
          ⁢
          
            
              
                b
                2
              
              +
              
                a
                2
              
              -
              
                c
                2
              
            
          
        
      
      
        
          b
          2
        
        +
        
          a
          2
        
      
    
  




Where,

c=−1/W tan δ

b=1/D 

a=L/DW tan δ

Accordingly, for a particular vehicle and trailer combination, the trailer length D, the wheelbase length W, and the drawbar length L are constant and assumed known. Thus, when the steady state condition is satisfied, the hitch angle γ between the vehicle 14 and trailer 12 may be determined as a function of the trailer length D, the wheelbase length W, the drawbar length L, and the steering angle δ.
Referring to FIG. 18, the steady state method is shown according to one embodiment. The steady state method may be executed by the controller 38 of the trailer backup assist system 10 and is exemplarily shown as one embodiment of the hitch angle detection routine 44. The method includes determining a steering angle at step 400. The steering angle may be provided by the steering angle sensor 64 and may be compensated to remove any offsets associated therewith. Next, at step 410, a steering angle rate is calculated and is filtered to remove noise. At step 420, it is determined whether the absolute value of the filtered steering angle rate is less than a threshold steering angle rate (e.g., 0.5 degrees per second) required for hitch angle calculation. The method also includes obtaining a hitch angle between the vehicle 14 and trailer 12, as measured pursuant to any of the hitch angle detection methods described herein (e.g., the centerline method) at step 430. At step 440, the controller 38 calculates a filtered hitch angle rate and determines at step 450 whether the absolute value of the filtered hitch angle rate is less than a threshold hitch angle rate (e.g., 0.5 degrees per second) required for hitch angle calculation. The method further includes obtaining a vehicle speed (e.g., from speed sensor 50) at step 460, calculating a filtered vehicle speed at step 470, and then determining at step 480 whether the absolute value of the filtered vehicle speed is greater than a threshold vehicle speed (e.g., 3 kilometers per second) required for hitch angle calculation. If the conditions specified at steps 420, 450, and 480 are met at step 490, the controller 38 determines that the steady state condition has been satisfied and calculates a hitch angle at step 500 using the hitch angle equation described herein with respect to the kinematic model shown in FIG. 17. So long as the steady state condition is satisfied, the controller 38 may continue to determine hitch angle via the hitch angle equation.
Referring to FIG. 19, a method of initializing hitch angle detection is illustrated. The method, referred to herein as the “hitch angle initialization method,” may be executed by the controller 38 of the trailer backup assist system 10 and is exemplarily shown as one embodiment of the operating routine 46. The hitch angle initialization method includes selecting between the various hitch angle detection methods described previously herein, which include the template matching method, the centerline method, and the steady state method, for the purposes of hitch angle detection. As described in greater detail below, the foregoing hitch angle detection methods generally vary in processing time and reliability. Thus, the hitch angle initialization method is executed in a manner such that the “best available” hitch angle method is chosen based on considerations including the availability of a template image for the trailer 12 being towed and current driving conditions.
The hitch angle initialization method may begin at step 600, where the controller 38 determines whether a template image is available for the trailer 12 being towed. If so, the controller 38 proceeds to step 610 to determine the hitch angle via the template matching method. The template matching method may determine the hitch angle in approximately 1 second and is generally the most reliable when compared to the centerline method and the steady state method. So long as the template image remains available, the template matching method is selected as the best available hitch angle detection. In the event no template image is available or the template matching method is unable to be executed (e.g., system error), the controller 38 proceeds to step 620 to determine whether the vehicle 14 and trailer 12 are moving in a straight direction. According to one embodiment, the direction of the vehicle 14 and trailer 12 may be determined by obtaining a steering angle from the steering angle sensor 64 over a period of time. If it is determined that the vehicle 14 and trailer 12 are moving in a straight direction, the controller 38 proceeds to step 625 and processes images captured by the imaging device 34 to derive a template image of the trailer 12 before proceeding to step 610 to determine the hitch angle via the template matching method. Otherwise, the controller 38 proceeds to step 630 to determine the hitch angle via the centerline method. The centerline method may determine the hitch angle in less than 1 second but is generally less reliable when compared to the template matching method and the steady state method.
Once the centerline method is selected, the controller 38 will continue to determine the hitch angle via the centerline method until a steady state condition is satisfied at step 640. As described previously herein, the steady state condition may be satisfied when the vehicle 14 and trailer 12 are moving in a straight direction or moving along a path at constant curvature. Or in other words, the steady state condition is satisfied when the yaw rate of the vehicle 14 and the trailer 12 become equal, thereby resulting in the hitch angle and the steering angle becoming constant. If the steady state condition is satisfied, the controller proceeds to step 650, where it determines whether the hitch angle is substantially zero. In instances where the steady state condition is satisfied due to the vehicle 14 and trailer 12 moving in a straight direction at a constant zero hitch angle value (γ=0), the controller 38 proceeds to step 625 and processes images captured by the imaging device 34 to derive a template image of the trailer 12 before proceeding to step 610 to determine the hitch angle via the template matching method. Otherwise, in instances where the steady state condition is satisfied due to the vehicle 14 and trailer 12 moving along a path at a constant non-zero hitch angle value (λ≠0), the controller proceeds to step 660 to determine the hitch angle via the steady state method. The steady state method may determine the hitch angle in approximately 1-3 seconds and is generally less reliable than the template matching method but more reliable than the centerline method. So long as the steady state condition is satisfied, the controller 38 will select either the template matching method or the steady state method. If the steady state method is the currently selected hitch angle detection method and the steady state condition is no longer satisfied, the controller 38 returns to step 630 to determine the hitch angle via the centerline method.
It is to be understood that variations and modifications can be made on the aforementioned structures and methods without departing from the concepts of the present invention, and further it is to be understood that such concepts are intended to be covered by the following claims unless these claims by their language expressly state otherwise.

## Claims

1. A system for detecting a hitch angle between a vehicle and a trailer, comprising:
an imaging device configured to capture images of the trailer;
a controller configured to:
process images captured by the imaging device;
derive a template image having a trailer contour; and
match the template image to a search image;

wherein the hitch angle is determined based on a positional relationship between the template image and the search image;
wherein the controller matches the template image to the search image by rotating the template image relative to the search image about a rotation point; and
wherein the hitch angle correlates to an angle at which the template image is rotated relative to the search image to generate a match therebetween.

2. The system of claim 1, wherein the controller derives the template image by:
deriving an averaged image of all images captured by the imaging device during a period of time in which the vehicle and the trailer are moving in a straight direction;
calculating an edge value for each pixel of the averaged image;
comparing the edge value of each pixel to a threshold value to identify between trailer pixels and ground pixels; and
determining the trailer contour based on identified trailer pixels.

3. The system of claim 2, wherein pixels having edge values that meet or exceed the threshold value are identified as trailer pixels and pixels having edge values that do not meet or exceed the threshold value are identified as ground pixels.

4. The system of claim 1, wherein the controller monitors the displacement of the trailer contour relative to a proximity zone in the search image and initiates a jackknife countermeasure if the trailer contour crosses into the proximity zone.

5. The system of claim 4, wherein the proximity zone is defined as a space between an imaged rear bumper of the vehicle and a boundary line that is defined by the controller and is overlaid onto the search image.

6. The system of claim 4, wherein the jackknife countermeasure comprises generating an auditory warning via a vehicle alert system, generating a visual warning via a vehicle display, generating a braking command to a vehicle brake control system, reducing a torque of a vehicle powertrain control system, modifying a steering angle of the vehicle, or a combination thereof.

7. A system for detecting a hitch angle between a vehicle and a trailer, comprising:
an imaging device configured to capture images of the trailer;
a controller configured to:
process images captured by the imaging device;
derive a template image having a trailer contour;
rotate the template image relative to a search image about an imaged hitch point that is common to the template image and the search image; and
determine the hitch angle based on an angle at which the template image is rotated relative to the search image to generate a match therebetween.

8. The system of claim 7, wherein the controller derives the template image by:
deriving an averaged image of all images captured by the imaging device during a period of time in which the vehicle and the trailer are moving in a straight direction;
calculating an edge value for each pixel of the averaged image;
comparing the edge value of each pixel to a threshold value to identify between trailer pixels and ground pixels; and
determining the trailer contour based on identified trailer pixels.

9. The system of claim 8, wherein pixels having edge values that meet or exceed the threshold value are identified as trailer pixels and pixels having edge values that do not meet or exceed the threshold value are identified as ground pixels.

10. The system of claim 7, wherein the controller monitors the displacement of the trailer contour relative to a proximity zone in the search image and initiates a jackknife countermeasure if the trailer contour crosses into the proximity zone.

11. The system of claim 10, wherein the proximity zone is defined as a space between an imaged rear bumper of the vehicle and a boundary line that is defined by the controller and is overlaid onto the search image.

12. The system of claim 10, wherein the jackknife countermeasure comprises generating an auditory warning via a vehicle alert system, generating a visual warning via a vehicle display, generating a braking command to a vehicle brake control system, reducing a torque of a vehicle powertrain control system, modifying a steering angle of the vehicle, or a combination thereof.

13. A method for detecting a hitch angle between a vehicle and a trailer, comprising the steps of:
capturing images of the trailer using an imaging device;
providing a controller configured to:
process images captured by the imaging device;
derive a template image having a trailer contour; and
match the template image to a search image;

wherein the hitch angle is determined based on a positional relationship between the template image and the search image;
wherein the controller matches the template image to the search image by rotating the template image relative to the search image about a rotation point; and
wherein the hitch angle correlates to an angle at which the template image is rotated relative to the search image to generate a match therebetween.

14. The method of claim 13, wherein the controller derives the template image by:
deriving an averaged image of all images captured by the imaging device during a period of time in which the vehicle and the trailer are moving in a straight direction;
calculating an edge value for each pixel of the averaged image;
comparing the edge value of each pixel to a threshold value to identify between trailer pixels and ground pixels; and
determining the trailer contour based on identified trailer pixels.

15. The method of claim 14, wherein pixels having edge values that exceed the threshold value are identified as trailer pixels and pixels having edge values that do not exceed the threshold value are identified as ground pixels.

16. The method of claim 13, wherein the controller monitors the displacement of the trailer contour relative to a proximity zone in the search image and initiates a jackknife countermeasure if the trailer contour crosses into the proximity zone.

17. The method of claim 16, wherein the proximity zone is defined as a space between an imaged rear bumper of the vehicle and a boundary line that is defined by the controller and is overlaid onto the search image.

18. The method of claim 16, wherein the jackknife countermeasure comprises generating an auditory warning via a vehicle alert system, generating a visual warning via a vehicle display, generating a braking command to a vehicle brake control system, reducing a torque of a vehicle powertrain control system, modifying a steering angle of the vehicle, or a combination thereof.