Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Vehicle Targeting System: A Computer Engineering Design Project - Prof. Roy Czernikowski, Study Guides, Projects, Research of Electrical and Electronics Engineering

A vehicle targeting system designed by students at the rochester institute of technology. The project involves several aspects, including i/o considerations, mechanical considerations, and image processing. The system uses a kalman filter for target prediction and a dart launching mechanism. Details on command parameters, the kalman filter algorithm, and timing considerations.

Typology: Study Guides, Projects, Research

2009/2010

Uploaded on 03/28/2010

koofers-user-i4f-1
koofers-user-i4f-1 ๐Ÿ‡บ๐Ÿ‡ธ

3

(1)

10 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ROCHESTER INSTITUTE OF TECHNOLOGY
Vehicle Targeting System
Individual Investigations
Katie Dellaquila
ked6943@rit.edu
I/O Consi derati ons an d Targ et Pre dictio n
Jeremy Nelson
jsn7699@rit.edu
Mechanical Considera tions
Khiem T ong
kd t8 917 @r it .ed u
Image Processing
2/18/20 09
Computer Engineering Design Projects
Dr. Czernikowski
0306-654-01
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Vehicle Targeting System: A Computer Engineering Design Project - Prof. Roy Czernikowski and more Study Guides, Projects, Research Electrical and Electronics Engineering in PDF only on Docsity!

ROCHESTER INSTITUTE OF TECHNOLOGY

Vehicle Targeting System

Individual Investigations

Katie Dellaquila ked6943@rit.edu I/O Considerations and Target Prediction Jeremy Nelson jsn7699@rit.edu Mechanical Considerations Khiem Tong kdt8917@rit.edu Image Processing 2/18/ Computer Engineering Design Projects Dr. Czernikowski 0306 - 654 - 01

Investigation Description This investigation involves several different areas of concern, including various I/O considerations and target prediction/timing. It is necessary to verify that the communication between the components is plausible, as well as the calculations based off of measured data. Microcontroller The Freescale HCS12 microcontroller board was selected to be the microcontroller for this project. The alternative being considered was an Arduino microcontroller. The Arduino has a lot to offer in terms of PWM channels and useful libraries to help with this. The following table describes the major pros and cons of the two microcontrollers. The HCS12 will be used because the team is familiar with it and it is available to use right away. Arduino Freescale HCS Pros Libraries for PWM and serial communication available. We have this microcontroller available in the Computer Engineering Department. Team members are already familiar with the component. The component has enough PWM channels, serial port, and digital I/O ports available. Cons We do not currently have this component. Team members are unfamiliar with the component. There are no specific libraries available like in the Arduino, but controlling the PWM ports seems to be relatively simple, as demonstrated in the independent projects. Serial Connection from Microcontroller to PC Because the laptop computer to be used with this project does not have a serial port, the USB port must be emulated as a virtual COM port. There are a number of free software downloads that can run as a background process, creating virtual COM ports that are connected directly to the USB device. Once this is established, the laptop can send commands and receive data back from the microcontroller. The laptop will be handling the user interface and the image processing. The images from the camera will be analyzed for image processing along with the distance measure

If this method does not prove to be accurate enough for the system, the ultrasound sensor will be configured for use instead. The ultrasound sensor is fairly simple to use. The sensor is capable of returning the distance to the closest object at a minimum rate of ten times per second. At this rate, the major acoustic reverberations will stop before taking the next measurement. To take a measurement from the sensor, a ping pulse needs to be generated with a pulse width of at least 10 microseconds. The output from the sensor is returned in the form of a positive pulse with duration between 18 and 100 milliseconds. This duration is equal to the round-trip propagation time of the ping pulse to reach the target and to return. This pulse duration must then be divided by two to get the one-way distance to the target. To get the actual distance that corresponds with this time, the speed of sound in air at room temperature is used. The ultrasound sensor has not yet been obtained, but the same model was used in a previous course. This component will be borrowed from the Computer Engineering Department. Target Prediction Because the mechanical components will take a relatively long time to respond, it is required that the position of the target be predicted in order to successfully hit the target with a dart. For example, if the position of the target in 2.0 seconds can be predicted accurately, then this will give the pan and tilt mechanism enough time to rotate to face this predicted position and shoot a dart so that it intersects that position in exactly 2. seconds. To predict the path of the target, an algorithm must be implemented that uses the previously known positions of the target over a certain time interval. One such algorithm is the Kalman filter. This filter is a recursive estimator. This means that it only needs the previous time step measurement and current measurement to compute the next position. The Kalman Filter is commonly referred to as the linear quadratic estimation (LQE) in control theory. This filter is very often used in determining the next position of an object in computer vision, so it fits this project very nicely. It takes error into account, which is something that is likely to amount due to the unpredictable behavior in position, velocity, and acceleration of the target. The filter works in two phases: Predict and Update. The predict phase (also called time update) calculates the next state of the system from the calculation of the previous state. The update phase uses data from the current state to adjust the calculation to a more accurate estimate of the true value. The pseudo-code for this algorithm is displayed below:

predicted = initially known position while ( running ) { Get current measurements difference = (predicted - measured) Kalman gain = function of (predicted, measured) predicted = function of (current value, Kalman gain) } This filter has some very complex math and control theory that goes along with it. The following diagram shows the states needed to successfully use the filter. Figure 1 : Kalman Filter states The open source computer vision libraries (OpenCV) support the Kalman filter. It requires enough knowledge of controls to set up the state, measurement, and control vectors. Once these are known, then cvCreateKalman can be called to automatically initialize everything with the libraries. When the next value is needed to be predicted, the cvKalmanPredict function is called. When in the update phase, cvKalmanCorrect is called. All of these functions return matrices of type CvMat*. These functions make using the filter a feasible task for this project, as they greatly simplify the coding algorithm. Even though these libraries simplify the Kalman filter algorithm, it still may prove to be too complex for our needs. If this is the case, a simpler algorithm will be used in place.

be derived so that an accurate time can be accounted for no matter what distance to the target may be. This may be a linear relationship or something more complex. Wait Time The wait time refers to the amount of time that the mechanism will remain idle before shooting a dart. This time is necessary to ensure that the target has enough time to move to the predicted location before the dart hits it. The following equation will be used to determine the wait time: ๐‘ค๐‘ค๐‘ก๐‘ก๐‘‡๐‘‡๐‘ข๐‘ข ๐‘ข๐‘ข๐‘‡๐‘‡๐‘‡๐‘‡๐‘‡๐‘‡ = ๐‘‡๐‘‡๐‘‡๐‘‡๐‘‡๐‘‡๐‘‡๐‘‡ ๐‘ข๐‘ข๐‘ข๐‘ข๐‘ข๐‘ข๐‘‡๐‘‡๐‘ข๐‘ข ๐‘ข๐‘ข๐‘ก๐‘ก๐‘ก๐‘ก๐‘ก๐‘ก๐‘‡๐‘‡๐‘ข๐‘ข ๐‘‡๐‘‡๐‘–๐‘– โ„Ž๐‘‡๐‘‡๐‘ข๐‘ข โˆ’ ๐‘๐‘๐‘ก๐‘ก๐‘ข๐‘ข & ๐‘ข๐‘ข๐‘‡๐‘‡๐‘ข๐‘ข๐‘ข๐‘ข ๐‘ข๐‘ข๐‘‡๐‘‡๐‘‡๐‘‡๐‘‡๐‘‡ โˆ’ ๐‘‘๐‘‘๐‘ก๐‘ก๐‘ก๐‘ก๐‘ข๐‘ข ๐‘ข๐‘ข๐‘ก๐‘ก๐‘ก๐‘ก๐‘ก๐‘ก๐‘‡๐‘‡๐‘ข๐‘ข ๐‘ข๐‘ข๐‘‡๐‘‡๐‘‡๐‘‡๐‘‡๐‘‡ In coding, this time will most likely also include the pan and tilt time. Timing Example A constant of 2.0 seconds is used for the โ€˜time until target is hitโ€™ field. This means that the dart will intersect the target in exactly 2.0 seconds. Using the Kalman filter or another technique, the predicted position of the target in 2. seconds is calculated. The distance from the turret is found to be 60 inches. Next, the dart travel time is calculated using the known corresponding equation. With a distance of 60 inches, the travel time may be 0.6 seconds. The pan & tilt mechanism is given the maximum time necessary to rotate to the correct position and aim a dart. For this example, this maximum time is 0.8 seconds. These variables leave a necessary wait time of 0.6 seconds for the system before firing a dart. The data is summarized in the table below. Table 1 : Timing Example Field Time Pan & Tilt time 0.8 s Dart Travel Time 0.6 s Remaining wait Time 0.6 s Time until target is hit 2.0 s

Appendix OpenCV - The following documentation refers to the OpenCV Kalman filter libraries. All of these functions would be used to implement the filter accurately. typedef struct CvKalman { int MP; /* number of measurement vector dimensions / int DP; / number of state vector dimensions / int CP; / number of control vector dimensions / / backward compatibility fields / #if 1 float PosterState; /* =state_pre->data.fl / float PriorState; /* =state_post->data.fl / float DynamMatr; /* =transition_matrix->data.fl / float MeasurementMatr; /* =measurement_matrix->data.fl / float MNCovariance; /* =measurement_noise_cov->data.fl / float PNCovariance; /* =process_noise_cov->data.fl / float KalmGainMatr; /* =gain->data.fl / float PriorErrorCovariance;/* =error_cov_pre->data.fl / float PosterErrorCovariance;/* =error_cov_post->data.fl / float Temp1; /* temp1->data.fl / float Temp2; /* temp2->data.fl / #endif CvMat state_pre; /* predicted state (x'(k)): x(k)=Ax(k-1)+Bu(k) / CvMat state_post; /* corrected state (x(k)): x(k)=x'(k)+K(k)(z(k)-Hx'(k)) / CvMat transition_matrix; /* state transition matrix (A) / CvMat control_matrix; /* control matrix (B) (it is not used if there is no control)/ CvMat measurement_matrix; /* measurement matrix (H) / CvMat process_noise_cov; /* process noise covariance matrix (Q) / CvMat measurement_noise_cov; /* measurement noise covariance matrix (R) / CvMat error_cov_pre; /* priori error estimate covariance matrix (P'(k)): P'(k)=AP(k-1)At + Q)/ CvMat gain; /* Kalman gain matrix (K(k)): K(k)=P'(k)Htinv(HP'(k)Ht+R)/ CvMat error_cov_post; /* posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)H)P'(k) / CvMat temp1; /* temporary matrices / CvMat temp2; CvMat* temp3; CvMat* temp4; CvMat* temp5; } CvKalman; The structure CvKalman is used to keep Kalman filter state. It is created by cvCreateKalman function, updated by cvKalmanPredict and cvKalmanCorrect functions and released by cvReleaseKalman functions. Normally, the structure is used for standard Kalman filter (notation and the formulae below are borrowed from the excellent Kalman tutorial [Welch95]):

KalmanCorrect - Adjusts model state const CvMat* cvKalmanCorrect( CvKalman* kalman, const CvMat* measurement ); #define cvKalmanUpdateByMeasurement cvKalmanCorrect kalman Pointer to the structure to be updated. measurement Pointer to the structure CvMat containing the measurement vector.

Resources Kalman Filter http://www.cs.brown.edu/stc/education/course95-96/Kalman-Filters/kalman.html OpenCV data http://opencv.willowgarage.com/wiki/CvReference#Estimators