GettingStarted
From Paparazzi
Contents |
Getting Started with Tiny v2.11
This getting started guide will assume that you have working hardware. It will not go into troubleshooting hardware that is malfunctioning. It will also assume the you already have the bootloader installed.
Step 1
FIRST REMOVE THE PROPELLER FROM THE MOTOR IF YOU HAVE MOUNTED ONE!
Radio Settings, PPM
I started by creating a new model in my rc tx (mc4000 and/or Royal Evo 12) with single aileron, no aileron differential, no aileron to rudder mix and in general no mixing what so ever, that uses the 3 position flight mode switch in order to change between the three flight phases, MANUAL AUTO1 AUTO2 and also assigned channel 9 to it so it's 3 positions make channel 9 (the MODE change channel) to change between 1000 1500 and 2000 microseconds.
This way the same switch changes flight phases in the tx (so each phase can have its own trimming, dual rates and expo) and changes the flight mode of the Paparazzi autopilot. I also set the shift to "-" for Futaba style receivers in the US and edited the airframe file makefile section in order to use the Futaba negative shift (-DRADIO_CONTROL_TYPE=RC_FUTABA).
Futaba uses negative shift in US and positive in EU where JR always use positive shift so RC_FUTABA is negative shift and RC_JR is positive shift.
A few words now about the radio file and the PPM pulse train:
In the radio file the order of channels dictates the place that the Paparazzi board will find the servo pulse in the PPM pulse train, what control or switch is used for that channel at the tx side is irrelevant and not taken in to account by the software.
The "function" name given to that channel, "MODE" in this case denotes it's function. In my radio file the "MODE" channel is 9th (last) which means that I will use channel 9 for MODE change.
You cannot define 5 channel lines in the radio.xml file and intend to use channels 1,2,3,4 and 9 at your rc transmitter. If you want to use channel 9 you have to define 9 channel lines in the radio.xml file describing 9 channels although in this case the channels 5,6,7 and 8 will be more or less dummy channel definitions just to fill the gap between channel 1,2,3,4 and channel 9 definitions.
Check your transmitter owner's manual to see what pulse timing is used for the channels used in order to enter them in the radio.xml file in case there is no ready made radio.xml file for your transmitter.
My Royal Evo 12 normally uses 1000 to 2000 microsecond pulses with 1500 being the neutral. Some transmitters although they are 9 channel they output a PPM pulse train composed by as many channels are currently used in the active airplane model and not the full 9 channel PPM pulse train and that's why it is important to declare all number of channels that the tx is capable off in the radio file and also assign a servo to the last channel of the tx thus forcing the tx to output the full PPM pulse train.
For example my Royal Evo 12 is set to use the PPM9 mode (I can select either PPM9 or PPM12) but if I only use 5 channels (aileron, elevator,throttle, rudder, MODE) the tx will output a PPM pulse train that has 5 servo timing slots and the reset pulse and this might confuse the Paparazzi board since I have declared 9 channels in the radio file (as I should).
The PPM signal in this case would look like this:
1 aileron 2 elevator 3 throttle 4 rudder 5 MODE and finally the reset pulse.
I suspect but (I am not sure) that many fewer than 9 channel transmitters might do this or the opposite!
For example a 7 channel tx might actually output a valid PPM9 signal with 9 servo slots and in case you have declared 7 channels in the radio file you might suddenly find that nothing works.
The valid PPM formats that i know of are the PPM5, PPM9 and PPM12.
Now let's continue the setup:
Then I made sure that all trims and sub trims were at neutral in every flight mode and the ATV or whatever you call the servo max movement adjustment to 100% for all servos.
Sub trim must not be used for any servo, you must adjust the flight surfaces to neutral mechanically not electronically through the rc transmitter.
In the MANUAL flight phase I can use trim settings, dual rates and expo but as I switch to AUTO1 or AUTO2 trims are in neutral and dual rates as expo also are deactivated (must be like that). Sub trim is not allowed in any mode.
Then I edited the mc3030.xml to reflect the channel assignment and saved it as mc4000 and RoyalEvo12.xml
I used the versatile.xml flight plan, the basic.xml tuning file and the default.xml telemetry file in a new aircraft I created in Paparazzi Center named EasyGlider.
I chose to modify the funjet1.xml airframe with the help of the minimag1.xml which uses dual aileron servos with differential and aileron to rudder mixing and then i saved the file as easyglider.xml
Mixing must not be used in the rc transmitter, the only way to use mixing like aileron differential is from inside the airframe file.
I learned much about how the airframe file works by examining those two airframe files. I also had to edit the tiny_2_1.h file located in the conf/autopilot directory and change the #define VoltageOfAdc(adc) definition in order to make the battery indication of the GCS to show the correct value. (#define VoltageOfAdc(adc) (0.0247311828*adc) )
Serial Connection And Firmware Uploading
I used the transparent serial connection set at 9600 bps at the tiny 2.11 side and the "Flight USB-Serial@9600" session in the Paparazzi center in order to establish a direct serial connection of the tiny 2.11 and my laptop using the FTDI USB to Serial cable.
One thing to watch for is that you have to connect the tiny 2.11 rx to the FTDI's tx and the tiny 2.11 tx to the FTDI's rx (crossed connections) for the connection to work.
Then I compiled my first flight plan with the TARGET set to "ap" and uploaded it to the tiny 2.11 using the USB cable.
In order to upload the firmware first power off the tiny 2.11 board, connect the tiny 2.11 board to the laptop with the USB cable and then power on the tiny board again. This will put the tiny 2.11 board in programming mode and you can now upload the firmware from Paparazzi center.
Every time you upload the firmware you should reboot the tiny 2.11 board by powering off, removing the usb cable and powering on again.
In order to check that the tiny 2.11 board is working see if the led on the tiny 2.11 board is blinking. If it is everything is fine but if it is permanently on or off something is wrong, most probably you used an airframe file that was not mend for the tiny 2.11 board.
Currently the only airframe suitable for the tiny 2.11 is the funjet1.xml and of course the easyglider.xml attached in this post.
Step 2
After I finished installing the autopilot on the EasyGlider from Multiplex making sure that I used twisted cables (or twist the existing ones) and fitted ferrite rings everywhere near the tiny 2.11 board, it was time to check everything for correct operation.
Sure that everything was hooked up correctly and the laptop was connected to the tiny 2.11 using the direct serial connection with the FTDI cable, I powered up the tiny 2.11 board and started the Paparazzi center.
GREAT!!! everything was working and I could see activity coming from the tiny 2.11 board in the GCS. I didn't used the modems during those initial steps in order to keep things simple and to eliminate any modem related problems but it proved that the Xbee modems are so easy to setup that I know feel that I should had used them from the start (of course i didn't had them back then).
I decided to keep things simple for now and used the factory default Xbee serial settings (9600 bps).
I left all settings in the airframe like they were for transparent operation at 9600 Baud with direct connection using the FTDI cable and I just added the modems, one Xbee with the USB adapter board for the laptop and one Xbee on the plane.
One thing to watch for is that for the airplane modem you have to connect the tiny 2.11 rx to the Xbee tx and the tiny 2.11 tx to the Xbee rx (crossed) for the modem to work (just like when i used the FTDI cable).
At the Paparazzi center I used the the standard "Flight USB-serial@9600" Session like when i was using the FTDI cable directly connected to the tiny 2.11.
The Xbee modems are great! Have a look in the easyglider.xml (it is attached in this post) in order to see the serial settings i used in the makefile section of the airframe file.
IR Sensors
Next comes the XY Infrared sensor positioning. First click the messages from the tools menu of Paparazzi center then click the IR_SENSORS in order to watch the IR sensor readings while you orient the XY sensor.
The messages we are interested in are the "int16 ir1", "int16 ir2" and "int16 vertical".
Make sure that you use the "ALIGNED" mode in the airframe file, you can change that to "TILTED" later, that the LONGITUDINAL, LATERAL and VERTICAL corrections are set to 1 and that this operation is performed in a room with closed windows not in the field so your finger has enough heat compared to the environment.
Remember that every time you change anything in any of the configuration files or any other file in the Paparazzi/conf directory like the airframe file for example, in order for the changes to take effect you have to recompile the firmware and then Upload the firmware to the tiny 2.11. (First "clean" then "build" and finally "upload" the firmware).
Now perform the IR sensor zeroing procedure as described in the wiki's tuning page and when your done you are ready for the XY sensor positioning procedure.
The Z sensor is easy, just orient the thermopile that gives a positive value to the "int16 vertical" message when you touch your finger on its window, to look down.
If the wiring exit is a problem, mount the Z sensor so the thermopile that gives a positive value looks up and then change the "TOP_SIGN" from "-1" to "1" in the airframe file.
Since you can not change the sign of the IR1 axis only the IR2 axis (I may be wrong about that), start with the IR1 orientation.
Orient the IR1 thermopile couple in a way that the thermopile that gives a positive value to the "int16 ir1" message is looking to the right when viewing the aircraft from behind.
The IR1 axis is the lateral axis that it is parallel to the wings. Secure the sensor temporarily in that position and then touch the thermopile that looks to the back of the airplane with your finger and check the "int16 ir2" message to see if it is positive.
If it is then everything is fine but if it is negative then either flip the XY sensor keeping the IR1 axis steady or edit the airframe file in order to change the "IR2_SIGN" polarity to "1" from "-1".
What you will do depends mostly on where you want the cables to be located.
Finally if you want the "TILTED" mode just rotate the XY sensor 45 degrees counterclockwise
when viewing the sensor from above and make sure that both the right side oriented thermopiles
produce positive values for the IR1 and IR2 messages when you touch them.
Don't forget to clean the thermopile windows with pure alcohol and cotton when you finish.
Step 3
Check Radio Communication
Then i checked that I could change mode (it is shown in the GCS lower left corner) because that means that my rx is working and the tiny receives the channel information alright. If needed you can reverse the MODE channel from the transmitter.
Now was the time to test all flight surfaces and infrared sensors for correct operation by going out in the field for further tests and adjustments.
At the field start Paparazzi center and the GCS program and connect to the TINY 2.11 via the modem connection.
Artificial Horizon
Then engage the AUTO1 mode and go to the "PFD" screen in order to check that the artificial horizon indicates the correct attitude when you move the plane with you hand.
It is essential that the PFD (artificial horizon) indicates the correct attitude, don't worry about the servo movements right now.
One way to do that is to hold the plane with your hand level in a position where the IR sensors cannot see you or can hardly see you. (Grabbing the plane from the fuselage close to the tail and holding it in front and above you with the nose pointed away from you will do the trick)
If you lower the right wing (roll to the right) the artificial horizon's horizontal line should move counterclockwise (the rotation of the artificial horizon is opposite to the wing rotation and this might confuse you) and if you lower the nose the brown background of the artificial horizon will move upwards filling the PFD.
The Artificial horizon is an instrument that shows the attitude of the plane compared to the earth and sky. It has a ball inside (much like those water filled spherical compasses) stabilized by gyroscopes with a brown colored hemisphere and a blue colored hemisphere.
The brown area represents the earth and the blue the sky. The line that separate those two areas is the horizon line.
Now because the earth does not rotate the plane does, you must imagine that the ball inside is steady and the laptop is rotating(rolls).
To get the feeling of how it works make sure that nobody is watching you and lean your head until you see the Horizon line level, the laptop then will have an apparent angle analogous with the wings of the aircraft when viewed from behind.
All possible movements should be checked (i.e. roll plane to the left etc.)
If the PFD doesn't indicate the correct attitude when you move the airplane with your hand then probably your IR sensors are not positioned correctly, go to step 2 again and recheck the IR ADC readings.
Check Rudder Movements
Now it is time to check that the flight control surfaces move the correct way in order to stabilize the plane in AUTO1 mode.
Looking from behind the plane, if you lower the right wing the right aileron should go down and the other up with the elevator not moving and if you lower the nose of the plane the elevator should go up but the ailerons should not move.
If an aileron or the elevator does not move the correct way simply edit the "servo" section in the airframe file and swap the affected servo's min and max values.
This will effectively reverse the servo's direction of movement when Paparazzi commands the plane, but not when the rc transmitter is in command.
Again as before all possible movements should be checked (i.e. roll plane to the left etc.)
When I felt that everything was correct I tried moving the sticks (in AUTO1)
and see if the ailerons, elevator and rudder were moving in the correct direction
and if the motor was correctly operating when I moved the throttle stick.
To do this hold the plane in front and above you with the nose away from you and while looking the plane from behind move the aileron stick to the right and check if the right aileron goes up and the left down.
Next pull the elevator stick back and check if the elevator moves upwards. Finally move the rudder stick to the right and check if the rudder moves to the right.
The opposite movements should be checked also (i.e. aileron stick to the left etc.)
If a surface or the motor does not react the way it should, simply reverse the affected channel from the rc transmitter. Very often Futaba transmitter owners need to reverse the throttle channel.
If you can't reverse a servo from the transmitter then you can swap the "min" and 'max values in the radio file in order to achieve the same effect.
One thing to watch for is the throttle channel as in electric flight the "min" value must be the same as the "neutral" value as no idle position in electric motors is needed unlike the fuel engines that do need an idle setting.
NOW MOUNT THE PROPELLER ON THE MOTOR.
Just before the maiden flight I rechecked that all flight surfaces were at neutral (ailerons were in line with the trailing edge etc.) and mechanically adjusted any surface that needed adjustment.
A good way to test that everything works well before the actual flight is to engage MANUAL mode, hold the airplane with your hand level in a way that the sensors cannot see you and engage the AUTO1 mode.
If the ailerons and the elevator remain very close to where they were in MANUAL mode or don't move at all then you are good to go.
Don't forget to perform a range check in MANUAL mode.
During this first flight I trimmed the plane in MANUAL for a level flight, landed and while i was always in MANUAL mode I mechanically adjusted the flight surfaces in such a way that the surfaces kept their trimmed positions but the trims in the transmitter were reset to neutral.
For example in order to adjust the elevator simply use an aluminum strip of about 2 inches long, about 1/3 inch wide and about 0.04 inches thick, bend it in order to follow the elevator - horizontal fin angle and tape it on the horizontal fin and elevator surface.
That will keep the elevator surface steady while you disconnect the mechanical link so the elevator is decoupled from the servo, set the elevator trim at the rc transmitter back to neutral again and finally adjust and connect the mechanical link again.
(Remember that we trimmed in MANUAL mode, in AUTO1 and AUTO2 flight modes the trims are in neutral, and must be there always!)
Went airborne again, checked that the plane flies straight and level in MANUAL mode with the trims now in neutral and then engaged the AUTO1 mode and rechecked that the plane flies level and that i can steer the plane in all directions (left-right-up-down) and landed in order to edit the airframe file changing the ROLL_NEUTRAL_DEFAULT and the PITCH_NEUTRAL_DEFAULT so my plane can fly straight and level.
In my case the plane was leaning to the right a bit and also was loosing altitude which means that -3 degrees ROLL and 3 degrees PITCH were needed in my case.
-3 means that the plane should think that it flies with an attitude of 3 degrees roll to the left but in fact it is now going straight.
This happens because the XY sensor might not be mounted exactly level or the thermopiles don't have all the same spatial response.
Then I got airborne again engaged AUTO1 and rechecked for a level and straight flight and engaged the AUTO2 watching my plane do what was exactly programmed to do.
It is a wise thing to read and perform the tuning procedure described in the wiki and in Danstah's page
(the link is at the end of the tuning page in the wiki).
Attached are my configuration files for the Multiplex EasyGlider which is a superb and stable platform for the Paparazzi autopilot.
The SEF_final.xml flight plan is a simple return home flight plan that does not even needs the modems or the laptop. It sets the power on position as ground altitude and as the home waypoint and when the radio signal of the rc transmitter is lost, Paparazzi will go to AUTO2 mode and the plane will return and circle home on it's own keeping a height of 25 meters from ground.
Of course you can engage AUTO2 any time making the plane return and circle home whenever and as many times as you like.
In fact you can engage the AUTO2 mode while the plane is on the ground, leave the tx down, run holding the plane above your head until the motor kicks in (when you reach a speed of 11 km/hour the motor will start) and throw it away.
I updated the flight plan file in the zip archive, the only modification is that i added the alt="ground_alt+25" in the "Return_home" block.

