|
|
|
|
|
Paparazzi, the RTF Autopilot?
Well, I'm starting a build log here. I'm building a small UAV based on Paparazzi Project autopilot.
My Background (i.e. suggested skills): Reasonably intelligent Some RC Experience Some Programming Experience Ability to read and follow directions Goal: To build an autonomous flying small model aircraft (Foam FunJet) capable of following set GPS coordinates for fun. Obsticals to overcome: 1. There were no companies I could buy assembled Tiny Autopilots. I would have to have my own PCB fabricated and autopilot assembled from the plans off the Paparazzi Wiki site: http://paparazzi.enac.fr/ 2. I needed to convert the BOM into part numbers I could order from a company like DigiKey or Mouser 3. Often a part is out of stock or no longer stocked I had to find equivalent parts without having any electronic experience. So you must learn to convert the "jargon" of a BOM into something you can order from an electronics supplier Ok, so lets get to building... FWIW: If you want to skip to the end take a look at this video: http://www.youtube.com/user/ppzuav#p/a/u/2/fljaSyM-Ewg That's our Tiny2.11 autopilot based Paparazzi piloted flying wing. At the end I give a description of everything. |
|
|
|
|
|
|
|
Autopilot Configuration
DISCLAIMER: This build thread is intended only to detail my build experience with the Paparazzi autopilot. It is not intended for anything but helping others to do the same in a lawful way. You are responsible for your actions and knowing the laws where you live and following them.
Round 1) Build my own by hand: Well, my first Tiny1.3 autopilot was hand soldered by an EE friend. I had now two Tiny1.3 autopilots. Now what? Time to read the wiki. Things that must be done: 1. The LPC processor needs to be loaded with the code so that the autopilot can be programmed via USB. 2. A program called the "tunnel" must be loaded so via the serial connector you can directly communicate with the GPS module. 3. The GPS module must be programmed. 4. The LPC must be programmed so the autopilot can fly the aircraft. This is done with the tools provided. The paparazzi software. REQUIRES: - adapter to allow your Windows PC to connect to the Tiny as a TTY serial device. These exist on Sparkfun and elsewhere as boards or cables. http://www.sparkfun.com/commerce/pro...roducts_id=718 http://www.sparkfun.com/commerce/pro...oducts_id=8772 This will be used to load the boot code, allow you to program the GPS and to allow you to connect directly to the autopilot with the paparazzi software without using RF modems for bench testing. - PC with I suggest Windows XP installed. Download from the u-blox.com website their u-center installer and install it. Download the latest firmware for your GPS module (LEA-5H or LEA-4P) from the same site and install it in the same directory. Install the FTDI drivers for your cable/board (usually given from the same place you buy it as a link). - An 8-pin molex cable to connect your cable/board to the Tiny autopilot. Make it per the wiring pinout given with your cable/board and the Paparazzi Wiki (see URL above). Remember Tx on one end goes to Rx on the other. Power must be 3.3v. - A USB to 8-pin molex adapter to allow you to connect a USB cable to the "USB" port on the autopilot - A 7-pin adapter to connect the FTDI to serial TTY adapter cable/board to the "download" connector. - molex connectors to connect your ESC, Servos and Rx to the autopilot. Or desolder the molex connectors and simply solder a female adapter wire to the autopilot so you can connect them using their native connector. I chose to buy the 200.00 crimper and make my own molex connectors for everything. - Laptop running a Debian Linux (I suggest Ubuntu 8.04). This will be the ground station. For an overview of all you need and theory see this page on the Wiki. I would even suggest this is required before you buy anything or even start to understand these pages well. http://paparazzi.enac.fr/wiki/Overview and http://paparazzi.enac.fr/wiki/FAQ STEPS for Boot Code loading: http://paparazzi.enac.fr/wiki/USB_Boot_Loader STEPS for loading the "tunnel" program: http://paparazzi.enac.fr/wiki/Tunnel STEPS for GPS programming: http://paparazzi.enac.fr/wiki/GPS_CONFIG or http://paparazzi.enac.fr/wiki/GPS#GP...using_U-Center At this point you are ready to configure and load the program for your aircraft into the autopilot.... |
|
|
|
|
|
The steps with photos
There are many reasons things might not work as expected. I like most everyone checked things and then concluded it must be faulty hardware. Over time I can say it's usually not the hardware. Just experience has shown this autopilot to survive many of my own attempts to kill it (crossed wires usually). In the end I find it's simply wiring or a configuration on the computer not the autopilot that must be corrected. So, patience is key here. It will help you to assume the autopilot is just fine and you are simply not doing something right or the PC/Laptop is not configured or working properly.
USEFUL INFO: 1. The term "holding a pin low" means to ground it to a common ground. So in programming "holding pin P0.14 low" means connect it to a common ground. I use the ground on the adapter board/cable. 2. P0.14 must be held low from power up to the end of the boot program process. Until you see Sector1 and Sector2 programmed successfully in (6 or 7) seconds hold it low (for the boot code loading step). 3. The USB programming requires the processor (herby simply called LPC) to have a signal wire fed 3.3v (5v tolerant) at power on. At that time the LPC will load the USB boot code and wait for programming over the USB port on the LPC (accessed via the USB connector on the autopilot). Failure in any way to send this voltage to the LPC at power on will fail to send it into this USB programming mode. 4. Even if #3 above is satisfied your PC/Laptop must also now recognize and load the proper driver to now communicate with the autopilot over USB. So if the Tx and Rx pins on your cable are crossed the autopilot will still go into USB program mode but you will not be able to communicate with it. 5. Your program must be configured properly or the software on the autopilot won't work properly. There is no blue screen it just won't work. All you can need to know at this point to properly edit/configure is found here: http://paparazzi.enac.fr/wiki/index...._Configuration Trust me it's there. This is not RTF you have to read and understand this stuff. MORE GTK THINGS: Here is what you should see on the screen during a successful boot programming: 1. I open a terminal and type: tail -f /var/log/messages to watch system messages during this. Why? Because I need to know when the FTDI serial adapter cable is recognized and when the Tiny is in USB boot mode that the computer recognizes it as a USB device (i.e. ready for the USB programming). So, first during boot loading. When I plug in the FTDI cable you should see this in the log (or 'dmesg' command output): Apr 19 09:52:47 ppzuav-desktop kernel: [ 2001.949231] usb 3-2: new full speed USB device using uhci_hcd and address 6 Apr 19 09:52:47 ppzuav-desktop kernel: [ 2002.149803] usb 3-2: configuration #1 chosen from 1 choice Apr 19 09:52:47 ppzuav-desktop kernel: [ 2002.152867] ftdi_sio 3-2:1.0: FTDI USB Serial Device converter detected Apr 19 09:52:47 ppzuav-desktop kernel: [ 2002.152903] /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/ftdi_sio.c: Detected FT232RL Apr 19 09:52:47 ppzuav-desktop kernel: [ 2002.153167] usb 3-2: FTDI USB Serial Device converter now attached to ttyUSB0 That tells me it is seen as /dev/ttyUSB0 If it is not unplug your other USB devices and try again (i.e. unplug and re-plug in the FTDI cable) until it is seen as /dev/ttyUSB0. If it just won't you can edit the Makefile but PM me I will give you those details offline. 2. Plug in the adapter and then into the Tiny2.11 "download" connector. Ground should be the very outmost wire and the Yellow wire (Rx) from the FTDI cable eventually makes it to the 2nd most inward pin and the orange from the FTDI (Tx) makes it to the very inward pin (Rx on the download connector). 3. Now connect (via jumper wire the negative pole on the PCB input (yes where you plug in the power) and the other end to the 3rd inmost pin (next to the yellow wire from the FTDI on the Tx on the "download" connector. This is directly routed to pin 61 on the CPU inside the PCB. So, in effect you are setting that pin on the CPU to the ground shared by everything on the Tiny2.11. 4. Power on (i.e. I use a 100.00 from Fry's 1A limiting power supply with jumper to the + and - on the PCB at this stage). Your power supply if it has a meter showing power draw should show 0.04A, then after and after resetting the power on the TIny (without the jumper) it should read 0.06A for a Tiny2.11 with a GPS module and Antenna and only the USB boot code. 5. The command to send the USB boot code into the Tiny2.11: ppzuav@ppzuav-desktop:~/paparazzi3$ make upload_bl PROC=GENERIC 6. The output: cd sw/airborne/arm7/test/bootloader; make clean; make rm -f usbstack.a usbhw_lpc.o usbcontrol.o usbstdreq.o usbinit.o usbdescrip.o rm -f bl.hex bl.elf crt.o startup.o printf.o console.o bootloader.o *.lst bl.dmp bl.map rm -f bl_ram.hex bl_ram.elf bl_ram.dmp bl_ram.map . . <snip> <--yes I cut out a bunch of stuff that scrolls past . . ...copying arm-elf-objcopy -O ihex bl_ram.elf bl_ram.hex arm-elf-objdump -x --syms bl_ram.elf > bl_ram.dmp lpc21isp -control sw/airborne/arm7/test/bootloader/bl.hex /dev/ttyUSB0 38400 12000 lpc21isp version 1.27 File sw/airborne/arm7/test/bootloader/bl.hex: loaded... converted to binary format... image size : 7304 <snip again> . . Read bootcode version: 2.12.0 Read part ID: LPC2148, 512 kiB ROM / 40 kiB SRAM (67305253) Sector 0: .................................................. ............................................. Sector 1: .................................................. ......................... Download Finished... taking 6 seconds Now launching the brand new code ioctl get failed ioctl set ok, status = 2 ioctl get failed ioctl get failed ioctl set ok, status = 186A0 ioctl get failed Result is from above it did program then reset. This is why you see the "failed" at the end is the code is uploaded but the CPU resets so you see the ioctl getting those last messages as the CPU is not responding during this time (just a guess correct me if I am wrong someone). Maybe it's me but the above seems to imply a momentary grounding. Anyhow, cool, bootloader loaded. Now if you read the programming page on the Wiki they tell you how you likely don't even need to do that. However, remember, no one (at that time, they do now) sells these assembled. So how many people reading that Wiki will have had someone else do that for them? Yep, sort of wish the would re-order that Wiki in the real order someone really programs these. The true order is this: 1. load the boot loader code 2. use the USB programming cable (custom made) to load the "Tunnel" a. Plug in the USB cable w/adapter into the "usb" connector (with Tiny powered off). Now power on the Tiny 2.11. b. the output of the system messages file should show (or dmesg command): Apr 19 10:44:34 ppzuav-desktop kernel: [ 5101.453832] usb 3-2: new full speed USB device using uhci_hcd and address 7 Apr 19 10:44:34 ppzuav-desktop kernel: [ 5101.621497] usb 3-2: configuration #1 chosen from 1 choice That above says my system (Linux) detected the Tiny2.11 as a new USB device c. Now send this command to load the "tunnel": make AIRCRAFT=PPZ1 tunnel.upload d. The output: cd sw/lib/ocaml; make PAPARAZZI_SRC=/home/ppzuav/paparazzi3 PAPARAZZI_HOME=/home/ppzuav/paparazzi3 make[1]: Nothing to be done for `all'. cd sw/supervision; make make[1]: Nothing to be done for `all'. cd /home/ppzuav/paparazzi3/sw/tools; make make[1]: Nothing to be done for `all'. <snip> cd sw/airborne; make PAPARAZZI_SRC=/home/ppzuav/paparazzi3 PAPARAZZI_HOME=/home/ppzuav/paparazzi3 TARGET=tunnel upload /home/ppzuav/paparazzi3/sw/ground_segment/lpc21iap/lpc21iap /home/ppzuav/paparazzi3/var/PPZ1/tunnel/tunnel.elf . Found USB device BootROM code: 2.12 Part ID: 0x0402FF25 (LPC2148, 512k Flash, 32k+8k RAM) BootLoader version: 1.3 # Starting software at 0x00004000 Cool, now the "tunnel" is loaded. This "tunnel" connects the GPS module to the serial1 port/connector on the Tiny2.11 NOTE: when in USB bootloader mode my Tiny2.11 is drawing 0.09A of current. 3. Using the cable used to load the boot loader, with a new custom adapter you have to make (8pin not 7pin), to a different port (this time really serial1) you program the GPS module to communicate with the paparazzi software correctly. This is called u-center and I downloaded it from the u-blox website and installed it on my Linux system (Yes, you can run "Windows" apps under Linux). So, now using u-center and that cable on serial1 you upload a configuration file from the Paparazzi Wiki (under GPS and configuring GPS). *Now with the GPS configured we are ready to program the Tiny for aour aircraft. Power off and power on the Tiny2.11 and you should see it is using 0.07A or 0.08A of current with the "tunnel" loaded and running. 4. Using the USB programming cable you now (either with GUI or command line commands) compile and upload an "airframe" file into the Tiny2.11 autopilot. Templates are given but each file is unique to your aircraft. Now if you build one exactly like one someone uses already you may find a template that requires only slight modification. So, ok, I have the bootloader loaded, I loaded the "tunnel" and programmed the GPS...I truly now believe I have a valid working ready to go Tiny2.11...ok, well someone else does. I used a brand-new fresh from the Assembly company Tiny2.11 for that. Next person who buys a Tiny2.11 from the Web Store (PPZUAV) gets this one that is ready to go (i.e. putting it back in the anti-static bag ready to sell) see image below the GPS is up and running and configured. I will reload the funjet1.xml aircraft file into it. Oh, FWIW that looks like this: Found USB device BootROM code: 2.12 Part ID: 0x0402FF25 (LPC2148, 512k Flash, 32k+8k RAM) BootLoader version: 1.3 ######################## Starting software at 0x00004000 SUCCESS!!!
|
|
|
|
|
|
What you should have now
What I know now...moving forward...
So, at this point you should have a programmed autopilot with your groundstation and be ready to fly. So, what do you do now to fly? I suggest: 1. Fly your aircraft as an RC aircraft first. Just verify it will fly (seems obvious but hey gotta say it). 2. Take the time to fly it. Make notes of trims required for stable flight. Then land and adjust the linkages to compensate. Repeat until with near zero trim it's flying steady and smooth. 3. On the ground with the motor disconnected power everything up and flip the mode switch (3-pos switch on the Tx) to AUTO1 and now standing in an open area orientate the aircraft nose up/down roll right/left and verify the control surfaces compensate to correct that motion. If not you need to correct it in software in the airframe configuration file. Then re-program the new program into the autopilot and repeat this test. Verify again the IR sensors are orientated correctly. Until you get this right the autopilot will not be able to fly the aircraft so this is a show stopper until corrected. Verify the same thing in AUTO2. 4. Create a simple flight plan to simply circle your location at say 100m (300' ish). Launch and while in straight and level flight at approx 100m flip into AUTO1 and observe the aircraft behavior. It should not do anything drastic and simply stabilize the aircraft and start to fly the programmed route at the programmed altitude. If all is going well flip to AUTO2. It should now be circling overhead at 100m altitude in no time. Now the above is edited after my experience to save someone new to this thread from having to read many many many pages to get to the meat of what this is about. Feel free to browse this thread and read what all went into the above but it's not required. The URL and info above should get you flying. If not dig in and see if you had any of the same issues I did or others who joined in. ![]() References: Paparazzi Wiki: http://paparazzi.enac.fr/wiki/index.php/Get_Hardware |
|
|
|
|
|
Me too. Really. If I could have bought all this RTF I would have done so. But, I suppose like most things in life worth doing, I now wouldn't have wished it any other way. I'm enjoying the challenge.
It's nice now to have the light-bulb in my head getting brighter. I really felt like a complete idiot when I first started this project. I'm feeling a lot more in control now. While it is fresh in my head I just figure I'll post what I've done here. Oh, Photos, ok, I do have photos. I'll put them either on my blog here or somewhere. I don't see any way to attach them to this post yet... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ NOTICE: Below in post #7 the URL has moved and now should be: www.ppzuav.com/osc/catalog (I can't edit the post by zlite so I will add the info here) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
|
|
|
|
Here is a photo. Fortunately for me the Paparazzi does have very good documentation of where things are. Just not in a true follow these exact steps, in the order to do them, way...yet.
So, attached is also a picture with labels from the documentation. The USB boot loader code has been loaded using the "download" connector (see the other image with labeled connectors). Now all programming is done using this cable. What you do is (High Level): 1. put Tiny2.11 in USB programming mode (i.e. power on with the USB cable connected) 2. send the aircraft file to the Tiny with either the GUI (paparazzi) or command line: make AIRCRAFT=ppzuav1 clean_ac ap.upload Last few lines should (output) look like: . Found USB device BootROM code: 2.12 Part ID: 0x0402FF25 (LPC2148, 512k Flash, 32k+8k RAM) BootLoader version: 1.3 ######################## Starting software at 0x00004000 That's it. Ready to fly well, that is if everything is configured properly...Lower Level step by step: 1. Run the GUI '~/paparazzi3/paparazzi' 2. In the GUI select the funjet1.xml aircraft file. 3. there is a button to EDIT the file. In my case I bought the same things as the person who created the funjet1.xml (except the chemical sensor) to make it easy on myself. 4. Once edited there is a compile button 5. Once compiled you are ready to send the program to the Tiny2.11 power on the Tiny2.11 with the USB cables connected. The Tiny2.11 will sense the 5v power coming from the USB and go into programming mode and wait for the program. 6. Now click the UPLOAD button. The code will be sent to the Tiny2.11 and it will automatically reset itself. Now that is simplistic and best case. At this time all peripherals (RF Modem, Gyro, ESC, servos, Receiver, IR sensors) can be connected to the Tiny and checked. The reality is that you can do this likely your equipment will need to be "tuned" for your aircraft. There is thankfully a page of documentation (documentation=Wiki) For URL see my above posts where I give the URL to the Wiki...ok, here's the page: http://paparazzi.enac.fr/wiki/index...._Configuration All configuration of your aircraft is done via edits to XML files. What is interesting to me about this is that at work I work with programmers who are Java/C++ programmers and they do this same thing. All configurations for everything (and I'm talking about Video over cell phones system here...very complex and millions of dollars in software and equipment) are done the same exact way. Using an editor to configure XML and that in turn generates configuration files and code. Just interesting that half way around the world the Paparazzi Team is doing the same thing. That is nice. If you would rather edit hard-coded values in your code that's fine. But XML is easy to learn and if you learn it you learn a skill useful in not just Paparazzi but other places as well. |