Difference between revisions of "OSAM Tuning Procedure"
Revision as of 13:08, 19 August 2013
This Describes whether the IR sensor is titled at a 90 degree angle or 45 degree angle. This meaning if the nose of the plane is facing north when the sensor is at 45 degrees (equals a 1 in the airframe config) the thermopile's do not point north south east and west but rather at a 45 degree offset from those directions. This is the recommended way to configure the IR sensors.
IR_360_Lateral_Correction & IR_360_Longitudinal_Correction
Coefficient that corrects the outputs of the IR sensor and is proportional meaning that it is simply multiplied by the sensor reading. Longitudinal is the pitch and Lateral is the roll.
ADC_ROLL_NEUTRAL & ADC_PITCH_NEUTRAL & ADC_TOP_NEUTRAL
These are the readings from the sensor when it is in a neutral state. This is also characterized by having no temperature difference across each pair of sensors.
PITCH_NEUTRAL_DEFAULT & ROLL_NEUTRAL_DEFAULT
The angles which are output when the plane is in the “flat” position. This flat is also known as the angles necessary to make the plane fly flat and straight.
ROLL_PGAIN & PITCH_PGAIN
This is the proportional variable in the pitch and roll control loops.
ROLL_MAX_SETPOINT & PITCH_MAX_SETPOINT & PITCH_MIN_SETPOINT
These set the maximum and minimum of the roll and pitch. This means that the plane will not be able to roll or pitch past the maximum or minimum angle.
ALTITIUDE_PGAIN & COURSE_PGAIN
These are the proportional control variables of the altitude and course loops.
MAX_ROLL & MAX_PITCH
These are set in the AUTO1 section of the airframe file and are the maximum allowed pitch and roll in auto1 mode.. These are by default in radians.
ROLL_MAX_SETPOINT & PITCH_MAX_SETPOINT & PITCH_MIN_SETPOINT
These are set in the HORIZONTAL CONTROL section of the airframe file and are the maximum and minimum allowed pitch and roll in auto2 mode.. These are by default in radians.
Align measured and real angles from the IR sensors. The first step is to take the IR sensors and the fully encase them in foam. Then you must change the ADC neutrals to zero in the airframe file. Once this has been done the user must flash the board then get a connection to the ground station computer and the GUI. Once this has been completed launch the messages agent and view the tab called IR, record the raw sensor values shown. After that disconnect the board and power it down. Finally change the ADC neutrals in the airframe file to the recorded values and re-flash the board.
First you must set the ROLL and PITCH neutrals to zero in the airframe file and then flash the board. Next take the airframe outside with all the necessary electronics inside that are needed to fly autonomously. The area which should be used to tune is one without any buildings or large man made objects within 500-1000 ft. This will make the variables far more accurate and save time due to lack of tuning needed in the air. Now place the plane “flat” on a surface so that all the sensors have clear views (aka no man made objects), the vertical sensors should be able to see both the ground and sky. Next connect the plane to the ground station GUI and record the attitude values, once these have been found power down and add the values recorded into the ROLL and PITCH neutrals in the airframe file.
Next, place the pane at an angle of the users choosing and measure the real angle. Remember the IR sensors must have unobstructed views. Now connect the airplane to the GUI and look to see if the reported angle in the messages agent matches the recorded real angle. If these do no match the user must change the 360_Lateral and Longitudinal variables as well as the neutral values, remember the neutral values can only shift the readings so use those for asymmetrical errors. The user must changes these variables until the angles match, it should be noted however that these variables are independent of each other so they should be adjusted one at a time. In addition make sure that the D gain of the Pitch loop is set to zero.
Once the users has done this on ground stuff a couple times it may be possible to use their eye to judge angles in the sky and do all the tuning that way. Remember all of the variables can be changed in real time by utilizing the tuning.xml for the settings of the aircraft
Once the plane is at a safe height and in sight turn on the AUTO1 mode. Next look for oscillations in the roll. If there are oscillations in the roll lower the ROLL_PGAIN coefficient until these no longer exist. If there are no oscillations start to raise to coefficients until the point right before oscillations. The point of this process is to maximize the coefficient value to the point right before oscillations occur. This is the same process that is used to tune the pitch loop except for the coefficient changed is PITCH_PGAIN. However it should be noted that the pitch is far more damped than the roll so it may harder to spot oscillations. The PITCH_PGAIN value is expressed in negative terms so a -10,000 would “higher” than a -6000 variable.
The next step is to test your roll and pitch neutrals. To do this the user must turn on auto1 mode and set the throttle to the nominal throttle value in the airframe file after this is set let go of all sticks and watch to see if the plane flies flat and straight. If this is the case then all is well but if not the user must once again tune the PITCH_ NUETRAL _DEFAULT & ROLL_ NUETRAL _DEFAULT values until the plane flys straight and flat. Next the user must test the maximum and minimum set points of the pitch and roll. This is done by testing in AUTO1, the user must make the plane pitch and roll to maximum and minimum amount that the RC controller allows, this is done by pushing the right stick to its maximum's. These angles however can only be recorded by looking at the plane in the air and guessing. This is not very exact but should give a good value to compare with the user written set points. The IR_360 variables will probably have to be retuned in air during this last part due to bad sensor data on the ground.
The final step is to put the plane into auto2 mode and determine if the plane is flying its desired course and altitude correctly. If this is not the case the PGAIN variables of each must be changed to take out oscillations and maximize to right before oscillations. Remember to check your max angle set points to make sure your plane will not over pitch or roll causing instability.