VISION BASED TARGET TRACKING GUN TURRET A dissertation submitted to the Department of Electrical Engineering, University of Moratuwa in partial fulfillment of the requirements for the Degree of Master of Science by WANNIACHCHIGE INDU DILSHAN ABEYW ARDENA Supervised by: Dr. Rohan Munasinghe Department of Electrical Engineering University of Moratuwa Sri Lanka 2010 94544 Abstract This project explores the task of tracking a moving target (aircraft) and pointing an anti aircraft gun perched on a pan tilt base in a real time combat environment. The purpose of this process is to study the dynamics of the mechanism, controlling requirements, software requirements and subsystems requirements needed for the implementation of a commercially viable air defense system. A laboratory model is developed to represent the pan-tilt gun turret, dynamically analyzed, controllers designed and field testing carried out. Though the system is designed as a laboratory model, every attempt is made to reach the level of sophistication and detail required for a military grade target tracking system. The thesis formulates a clearly identifiable procedures and steps which need to be carried out in the implementation of such a system. Due to the obvious unavailability of target tracking data from a radar system, target position information from machine vision software is used. The scope of the project is limited to; designing the interface between Camera, CPU and servo-controllers, designing the mounting base for the artillery with the pan-tilt mechanism, Modeling the plant and designing the ,controller. Field testing reveals the validity of the procedures mentioned above and the satisfactory results obtained through such procedure. D E C L A R A T I O N T h e w o r k s u b m i t t e d i n t h i s d i s s e r t a t i o n i s t h e r e s u l t o f m y o w n i n v e s t i g a t i o n , e x c e p t w h e r e o t h e r w i s e s t a t e d . I t h a s n o t a l r e a d y b e e n a c c e p t e d f o r a n y d e g r e € , a n d i s a l s o n o t b e i n g c o n c u r r e n t l y s u b m i t t e d f o r a n y o t h e r d e g r e e . I " l / I '-.-~-- D i l s h a n . A b e y w a r d e n a 0 8 / 0 2 / 2 0 1 0 I e n d o r s e t h e d e c l a r a t i o n b y t h e c a n d i d a t e . .~ I . l 1 I I I ' ' 1 ' 1 J ! i I / u " - / / i { ' v ~-- · - · - - - - ; D r R o h a n M u r i a s i n g h e lia~~- D e c l a r a t i o n A b s t r a c t A c k n o w l e d g e m e n t L i s t o f F i g u r e s L i s t o f T a b l e s 1 . I n t r o d u c t i o n C O N T E N T S 1 . 1 T a r g e t T r a c k i n g F u n d a m e n t a l s 1 . 2 M o t i v a t i o n 1 . 3 G o a l s a n d A c h i e v e m e n t s 2 . T a r g e t I d e n t i f i c a t i o n a n d T r a c k i n g T e c h n i q u e s 2 0 1 S y s t e m O v e r v i e w 2 . 2 C o n t r o l T e c h n o l o g i e s 2 . 3 L i n e a r S e c o n d O r d e r S I S O M o d e l 2 . 4 M o t o r M o d e l - ' 3 . I m p l e m e n t a t i o n o f V i s i o n B a s e d T a r g e t T r a c k i n g S y s t e m 3 . 1 D e s i g n a n d C o n s t r u c t i o n o f t h e T u r r e t B a s e 3 . 1 0 1 R o t a t i o n B a s e 3 . 1 . 2 T i l t B a s e 3 . 1 . 3 M o u n t i n g P l a t e 3 . 1 . 4 T i l t M o v e m e n t G e a r B o x 3 . 1 . 5 C o m p l e t e S y s t e m 3 . 1 . 6 D e s i g n S p e c i f i c a t i o n s 3 . 1 . 7 S e l e c t i o n o f M o t o r s 3 0 1 . 8 S e l e c t i o n o f S e n s o r s 3 . 1 . 9 S y s t e m I n e r t i a C a l c u l a t i o n 3 . 2 V i s i o n S y s t e m 3 . 2 . 1 P i p e P r o g r a m 4 . C o n t r o l l e r D e s i g n 4 . 1 B a n d w i d t h C a l c u l a t i o n 4 . 1 . 1 R e q u i r e d B a n d w i d t h 4 . 1 . 2 A v a i l a b l e B a n d w i d t h 4 . 2 D e s i g n o f E l e c t r o n i c s 4 . 3 L o o p S h a p i n g a n d T r a c k i n g R e s p o n s e 4 . 4 S t a b i l i t y o f t h e S y s t e m 4 . 5 S y s t e m w i t h P o s i t i o n F e e d b a c k 4 . 6 D i g i t a l C o n t r o l l e r 4 . 7 T r a j e c t o r y P l a n n i n g I V v V I V l l 1 1 2 3 4 5 5 7 1 0 1 1 1 1 1 2 1 3 1 3 1 4 1 4 1 5 1 5 1 6 1 8 1 9 2 0 2 1 2 1 2 1 2 7 3 2 4 0 4 3 4 3 4 5 4 8 1 1 . . 5 . R e s u l t s 5 . 1 R e s p o n s e t o E x t e r n a l T a r g e t I n p u t s 5 . 2 R e s p o n s e t o S i n u s o i d a l I n p u t s 6 . C o n c l u s i o n s a n d F u r t h e r D e v e l o p m e n t s R e f e r e n c e s A p p e n d i x A C o - o r d i n a t e T r a n s f o r m a t i o n u s i n g I n v e r s e K i n e m a t i c s A p p e n d i x B P i c B a s i c P r o S o u r c e C o d e A p p e n d i x C M a t l a b f i l e f o r F F T A n a l y s i s - ' A p p e n d i x D M a t l a b f i l e f o r T F E x t r a c t i o n f r o m S i m u l i n k M o d e l A p p e n d i x E V B S c r i p P r o g r a m f o r R o b o r e a l m A p p e n d i x F Q u a d r a t u r e E n c o d e r A p p e n d i x G S i m p l e P o t e n t i o m e t e r A p p e n d i x H A b s o l u t e E n c o d e r C o n t a c t L e s s t y p e A p p e n d i x I A b s o l u t e E n c o d e r C o n t a c t t y p e 5 0 5 0 5 1 5 4 5 6 5 7 6 0 6 4 6 6 6 7 6 9 7 0 7 0 7 1 1 1 1 A c k n o w l e d g e m e n t T h a n k s a r e d u e f i r s t t o m y s u p e r v i s o r , D r R o h a n M u n a s i n g h e , f o r h i s g r e a t i n s i g h t s , p e r s p e c t i v e s a n d g u i d a n c e . M y s i n c e r e t h a n k s g o t o t h e o f f i c e r s i n t h e P o s t G r a d u a t e O f f i c e , F a c u l t y o f E n g i n e e r i n g , U n i v e r s i t y o f M o r a t u w a , S r i L a n k a f o r h e l p i n g i n v a r i o u s w a y s t o c l a r i f y t h e t h i n g s r e l a t e d t o m y a c a d e m i c w o r k s i n t i m e w i t h e x c e l l e n t c o o p e r a t i o n a n d g u i d a n c e . S i n c e r e g r a t i t u d e i s a l s o e x t e n d e d t o t h e o f f i c e r s w h o s e r v e i n t h e D e p a r t m e n t o f E l e c t r i c a l E n g i n e e r i n g o f f i c e . T h e a u t h o r e x t e n d s s i n c e r e g r a t i t u d e t o P r o f e s s o r L a n k a U d a w a t t a a n d D r . C h a n d i m a D e d d u w a P a t h i r a n a f o r t h e i r u n t i r i n g e f f o r t s i n c o o r d i n a t i n g t h e M S c i n I n d u s t r i a l a u t o m a t i o n p r o g r a m a n d e n c o u r a g i n g w o r d s i n e v e r y s t e p o f t h e w a y o f t h e a b o v e p r o g r a m . T h e a u t h o r h a d t o m a k e m a n y v i s i t s t o t h e l o c a l m a c h i n i s t i n t h e p r o c e s s o f d e s i g n i n g a n d b u i l d i n g t h e p a n - t i l t b a s e a n d w a s p l e a s a n t l y s u r p r i s e d b y t h e s k i l l a n d a p t i t u d e o f t h e s e e x p e r i e n c e d c r a f t m e n . T h e d e s i g n p r o c e s s w a s a m a r r i a g e b e t w e e n m e c h a n i c a l e n g i n e e r i n g a n d e l e c t r o n i c s e n g i n e e r i n g a m o n g o t h e r d i s c i p l i n e s , T o t h i s e n d , I m a y n o t h a v e b e e n a b l e t o f i n i s h o f f t h e m e c h a n i s m i f n o t f o r v a l u a b l e s u g g e s t i o n s f r o m w o r k e r s a t t h e l o c a l m a c h i n i s t s h o p . L a s t l y , I s h o u l d t h a n k m y f a m i l y f o r t h e i r u n d e r s t a n d i n g a n d p e r s e v e r a n c e d u r i n g t h e l a s t t w o y e a r s , f r i e n d s a n d c o l l e a g u e s w h o h a v e n o t b e e n m e n t i o n e d h e r e p e r s o n a l l y i n m a k i n g t h i s e d u c a t i o n a l p r o c e s s a s u c c e s s . I c o u l d n o t h a v e m a d e i t w i t h o u t y o u r s u p p o r t s . v L i s t o f F i g u r e s F i g u r e P a g e 2 . 1 A u t o m a t e d t a r g e t t r a c k i n g a i r d e f e n s e s y s t e m 5 2 . 2 S y s t e m m o d e l 6 2 . 3 L i n e a r s e c o n d o r d e r S I S O m o d e l o f a m a n i p u l a t o r j o i n t 7 2 . 4 M o t o r m o d e l 1 0 3 . 1 S o l i d w o r k s i m p r e s s i o n o f t h e f i n a l g u n t u r r e t s y s t e m 1 1 3 . 2 R o t a t i o n b a s e 1 2 3 . 3 F i x i n g p l a t e f o r s e n s o r p o t e n t i o m e t e r . : 1 2 3 . 4 T i l t b a s e 1 3 3 . 5 M o u n t i n g p l a t e 1 3 3 . 6 T i l t m o v e m e n t g e a r b o x 1 4 3 . 7 C o m p l e t e s y s t e m 1 4 3 . 8 C a l c u l a t i n g m o m e n t o f i n e r t i a a r o u n d y a x i s 1 8 3 . 9 R o b o r e a l m s t a r t u p s c r e e n 1 9 3 . 1 0 F l o w d i a g r a m o f p i p e p r o g r a m 2 0 4 . 1 V e l o c i t y p r o f i l e o f a n A - 1 0 t h u n d e r b o l t a t m a x i m u m a c c e l e r a t i o n 2 2 4 . 2 M o v e m e n t ( d i s t a n c e ) p r o f i l e o f a n A - 1 0 t h u n d e r b o l t a t m a x i m u m a c c e l e r a t i o n 2 3 4 . 3 M o v e m e n t o b s e r v e d f r o m a d i s t a n c e o f 3 0 0 0 m 2 4 4 . 4 V a r i a t i o n o f p a n a n g l e w h e n t h e m o v e m e n t i s o b s e r v e d f r o m 3 0 0 0 m 2 4 4 . 5 P o w e r s p e c t r u m o f t h e t a r g e t m o v e m e n t 2 5 4 . 6 V a r i a t i o n o f a n g u l a r v e l o c i t y w i t h t i m e 2 6 4 . 7 V a r i a t i o n o f a n g u l a r a c c e l e r a t i o n w i t h t i m e 2 6 4 . 8 S y s t e m r e s p o n s e t o s i n u s o i d a l i n p u t s o f i n c r e a s i n g f r e q u e n c y 2 7 - 3 1 4 . 9 G a i n v s f r e q p l o t f o r p a n m o v e m e n t 3 2 4 . 1 0 P I D c o n t r o l l e r a n d p l a n t 3 2 4 . 1 1 O v e r a l l c o n t r o l a r c h i t e c t u r e o f t h e s y s t e m 3 3 4 . 1 2 P I C 1 6 f 8 7 7 m i c r o c o n t r o l l e r s u p p o r t P C B 3 4 4 . 1 3 P I C 1 6 f 8 7 7 m i c r o c o n t r o l l e r P C B ( p o p u l a t e d w i t h c o m p o n e n t s ) 3 4 4 . 1 4 S c h e m a t i c a n d P C B o f t h e H - B r i d g e 3 5 4 . 1 5 S i m u l i n k m o d e l o f t h e c o m p l e t e s y s t e m 3 8 4 . 1 6 S i m u l i n k c l o s e d l o o p m o d e l o f t h e c o m p l e t e s y s t e m 3 9 4 . 1 7 A c t u a l s t e p r e s p o n s e v s s i m u l i n k m o d e l s t e p r e s p o n s e 3 9 4 . 1 8 V e l o c i t y s t e p r e s p o n s e o f t h e s y s t e m 4 1 4 . 1 9 B o d e p l o t o f t h e s y s t e m 4 1 4 . 2 0 B o d e p l o t w i t h c a l c u l a t e d g a i n i n f o r w a r d p a t h 4 2 4 . 2 1 P h a s e m a r g i n 4 3 4 . 2 2 S y s t e m w i t h p o s i t i o n f e e d b a c k b a c k 4 3 4 . 2 3 V e l o c i t y a n d p o s i t i o n r e s p o n s e f o r s t e p i n p u t 4 4 4 . 2 4 B l o c k d i a g r a m o f P I D i m p l e m e n t a t i o n 4 8 5 . 1 R e s p o n s e t o a r b i t r a r y e x t e r n a l t a r g e t i n p u t s 5 0 5 . 2 R e s p o n s e t o s i n u s o i d a l e x t e r n a l i n p u t s 5 1 - 5 3 V l . . . L i s t o f T a b l e s T a b l e 4 J T r u t h t a b l e f o r H - B r i d g e . . . . . . . . . . . _ . : P a g e 3 5 V l l