330 likes | 595 Views
Tom Pittenger - California State University, Fresno tpittenger@gmail.com Dr. Gregory Kriehn – Advisor gkriehn@csufresno.edu. Unmanned Aerial System (UAS) Internet Based Flight Control System 12/15/2010. Goals. - Fly an R/C airplane to anywhere from anywhere*
E N D
Tom Pittenger - California State University, Fresno tpittenger@gmail.com Dr. Gregory Kriehn – Advisor gkriehn@csufresno.edu Unmanned Aerial System (UAS)Internet Based Flight Control System12/15/2010
Goals - Fly an R/C airplane to anywhere from anywhere* - Use the internet and be fly-able in any latency - Cheap and easy to implement - Leverage code reuse and open source community
Motivation Project sponsored by Edwards Air Force Base - CSUF-UAV Ground Targeting project - Some R&D done under that project Problems encountered with that project: - Short-ish range data link - Multi-person ground station needed - Remote piloting requires video
Motivation @ Edwards Air Force Base Same Problems Their Solution? - Long range communication via satelite - Big satelite dish - Massive ground station infrastructure - Always autonomous, no need for video
Motivation @ Edwards Air Force Base Same Problems Their Solution? - Long range communication via satelite - Big satelite dish - Massive ground station infrastructure - Fully autonomous, no need for video Expensive! Expensive! Expensive!
New Communication Idea Use the cellular phone network. It works almost everywhere!
But How? Add some sensors and a brain
Hardware UAV Dev Board (UDB)by Bill Premerlani - Acceleromeer: MMA7260 (3-Axis x 1) - CPU: Microchip dsPIC30F4011 - Gyro: IXZ500 (1-Axis x 3) - GPS: EM-406A SiRF III - Up to 4 PWM inputs - Up to 6 PWM outputs - Firmware is Open-Source - @ Sparkfun for $150, 1200+ sold
The Hookup dsPIC processor to WiFi to cell phone - WiFi Tether on Google Android ver 2.2 - dsPIC gets a mobile 3G internet connection
Hardware - WiFi Embedded 802.11b 2.4 GHz WiFi - Interface: SPI @ 25MHz - Throughput: up to 1000 Kbps - Low power: Rx=85mA, Tx=154mA - Built-in AES encryption - Relatively low cost: $30
Hardware - WiFi WiFI Module: - 36 Pins - Only need 6!
Hardware - WiFi WiFI Module: - 36 Pins - Only need 6!
School Time! Serial Protocol Refresher
SPI – Random Read Example 1) Instruction (Random Read) 2) Write Address 3) Read data
RS232 - UART 1/t = Baud rate 1/104us = 9600 Baud rate mismatch
Firmware - Matrix Pilot Library called Matrix Pilot (aka gentlenav) - Open source code written in C is under GNU Public License - Download at http://code.google.com/p/gentlenav Servo control: - Mode: Manual Flight (passthrough) - Mode: Pilot Assist - Mode: Waypoint (Full auto-pilot) Aircraft Failsafe: - Return-to-Launch (Auto-Waypoint mode when no signal) Other Goodies: - Camera tracking of ground target - Inverted auto-pilot, inverted stabilized - Many body types: Flying-wing, V-tail, Car, Helicopter - Autonomous Hovering (feel free to read that again) - On-Screen Display (OSD)
dsPIC30 series is obsolete dsPIC30 series not supported by Microchip's TCP/IP Library - Only chip not supported Workaround: - Use a PIC32 to run the library, treat as RS232 to TCP converter - Worked on first compile AS IT SHOULD!
Base Station – TCP/IP Server Uploads joystick data Forwards TCP to RS232 Visual Studio 2008 C# Port: 304 ('T'+'o'+'m') Flight Mode: - Manual - Stabilized - Waypoint (Autopilot) DirectX for joystick Joystick override option
Base Station – TCP/IP Server Uploads joystick data Forwards TCP to RS232 Visual Studio 2008 C# Port: 304 ('T'+'o'+'m') Flight Mode: - Manual - Stabilized - Waypoint (Autopilot) DirectX for joystick Joystick override option
Ground Control Station Google Earth Camera options - Chase cam - First person - Overhead Great sensor visuals Only accepts RS232 input data Open-source! Single author: Paul Mather (aka HappyKillmore)
But GCS only accepts RS232! Workaround: - TCP Server must output RS232 and loop it back - FTDI232R USB to RS232 convert ( x2)
Communication Protocol Downlink Telemetry Example: F2:T207968500:S110:N614773312:E-20950234:A7547:W0: a16304:b1614:c-46:d-1616:e16298:f-454:g2:h456:i16378:c4990: s1:cpu10:bmv0:as1:wvx0:wvy0:wvz0:ma0:mb0:mc0:svs7:hd7: p1i3033:p2i3050:p3i2273:p4i2289:p5i3142: p1o3033:p2o3050:p3o2274:p4o3142:p5o3040:p6o3800: imx0:imy0:imz0:fgs1000: Whew! All data ends with : and starts with header letter, all ASCII text. Throughput: 270bytes * 8bits * 4 Hz = 8640 bps Lets translate some: N614773312:E-20950234:A7547: means Lat 61.447, Lat=2.095, Alt=75m a,b,c,d.. are values from 3x3 direction matrix p1i,p2i..p1op2o.. are PWM timer values for PWM1 In or P2 Out ect
Communication Protocol Uplink Joystick Transmit Example: Binary data with ASCII header Data packet: [0,1,2,3] = 'WiFi' [4] = Aileron.MSB [5] = Aileron.LSB [6,7] = Elevator (MSB first) [8,9] = Mode [10,11] = Rudder [12,13] = Throttle [14,15] = '\r\n' Throughput: 16 bytes * 8 bits * 10Hz = 1280bps
Communication Protocol Uplink Joystick Receive Example: Packet synconization // If 'W' is not found, ignore inbound data until found to re-sync if (rxdata_index_is_lost) // search for start of header packet "WiFi" { rxdata_index = 0; if (rxchar == 'W') { // wait for 'W' rxdata_index_is_lost = 0; rxdata[rxdata_index++] = rxchar; } } else if (rxdata_index < RXDATA_SIZE) { // Check for 'WiFi' header and \r\n termination rxdata[rxdata_index++] = rxchar; if ((rxdata[LENGTH_OF_PACKET-1] == '\r') && (rxdata[LENGTH_OF_PACKET] == '\n') && (rxdata[0] == 'W') )//&& (rxdata[1] == 'i') && (rxdata[2] == 'F') && (rxdata[3] == 'i')) { // Proper header and \r\n found! Processes joystick packet tempPWM = (unsigned short)rxdata[rxdata_index++] << 8; tempPWM |= rxdata[rxdata_index++]; udb_pwIn[AILERON_INPUT_CHANNEL] = tempPWM; // .... ect } } else { // buffer overflow, if so something is wrong. rxdata_index_is_lost = 1; rxdata_index = 0; }
Results Latency: Joystick to servos via hardline ~50 - 100ms Joystick to servos via Internet ~750 - 1500ms Round trip data: ~1500-3000ms Joystick - TCPserver - Internet – phone - WiFi – RS232 –b servo - sensor – RS232 – WiFi – phone - Internet - TCPserver - USB/RS232 - RS232/USB – GCS Occasional pauses in data traffic – Not good!
Trouble Items X-Plane - not too friendly with GPS assignments - without X-Plane, no incentive for HILsim Ground Control System (GCS) - Written in Visual Basic - Needs IP Interface TCP Server - Needs to be UDP dsPIC30 Processor - Little program memory, but TCP/IP Library fits (barely!) - Obsolete part, dsPIC33 is current - Not supported by Microchip TCP/IP Library - 5V vs 3.3V - PIC32 workaround to be incoporated into dsPIC33
Conclusion No flights were allowed without COA permit from FAA so some results are interpretive. Permit is pending. Flyability: - Not possible in manual mode - Pilot Assist mode compenstes for lag, stable flights possible - Failsafe Return-to-Launch or Waypoint for connetcion loss Hardware: - dsPIC30 is obsolete and not supported by Microchip. New dsPIC33 is already in the works for new UDB version. -This system is being incorporated into the Matrix Pilot firmware feature list
dsPIC33FJ128MC204 Attempt - Faster CPU - More RAM - More Program Memory - Matrix Pilot Libary not that modular
Firmware – AutoPilot Direction Cosine Matrix (DCM) - Designed by Bill Premerlani - 3 x 3 matrix - Gyro based - Updates @ 50Hz