Difference between revisions of "User:Mecevans"

From PaparazziUAV
Jump to navigation Jump to search
Line 123: Line 123:


-note: if you need any help with this ask me.
-note: if you need any help with this ask me.
==my code==
<!DOCTYPE airframe SYSTEM "airframe.dtd">
<!-- Funjet Multiplex (http://www.multiplex-rc.de/)
    Tiny 2.1 board (http://paparazzi.enac.fr/wiki/index.php/Tiny_v2)
    Tilted infrared sensor (http://paparazzi.enac.fr/wiki/index.php/Image:Tiny_v2_1_Funjet.jpg)
    Radiotronix modem
-->
<airframe name="Funjet 1 Tiny 2.1">
<!-- commands section -->
  <servos>
    <servo name="MOTOR"        no="0" min="1000" neutral="1000" max="2000"/>
    <servo name="AILEVON_LEFT"  no="2" min="1130" neutral="1500" max="1880"/>
    <servo name="AILEVON_RIGHT" no="6" min="1980" neutral="1515" max="1170"/>
  </servos>
  <commands>
    <axis name="THROTTLE" failsafe_value="0"/>
    <axis name="ROLL"    failsafe_value="0"/>
    <axis name="PITCH"    failsafe_value="0"/>
  </commands>
  <rc_commands>
    <set command="THROTTLE" value="@THROTTLE"/>
    <set command="ROLL"    value="@ROLL"/>
    <set command="PITCH"    value="@PITCH"/>
  </rc_commands>
  <section name="MIXER">
    <define name="AILEVON_AILERON_RATE" value="0.75"/>
    <define name="AILEVON_ELEVATOR_RATE" value="0.75"/>
  </section>
  <command_laws>
    <let var="aileron"  value="@ROLL  * AILEVON_AILERON_RATE"/>
    <let var="elevator" value="@PITCH * AILEVON_ELEVATOR_RATE"/> 
    <set servo="MOTOR"          value="@THROTTLE"/>
    <set servo="AILEVON_LEFT"  value="$elevator + $aileron"/>
    <set servo="AILEVON_RIGHT" value="$elevator - $aileron"/>
  </command_laws>
  <section name="AUTO1" prefix="AUTO1_">
    <define name="MAX_ROLL" value="0.85"/>
    <define name="MAX_PITCH" value="0.6"/>
  </section>
  <section name="adc" prefix="ADC_CHANNEL_">
    <define name="IR1" value="ADC_1"/>
    <define name="IR2" value="ADC_2"/>
    <define name="IR_TOP" value="ADC_0"/>
    <define name="IR_NB_SAMPLES" value="16"/>
    <define name="GYRO_ROLL" value="ADC_3"/>
    <define name="GYRO_NB_SAMPLES" value="16"/>
  </section>
  <section name="INFRARED" prefix="IR_">
    <define name="ADC_IR1_NEUTRAL" value="0"/>
    <define name="ADC_IR2_NEUTRAL" value="0"/>
    <define name="ADC_TOP_NEUTRAL" value="0"/>
    <define name="LATERAL_CORRECTION" value="1."/>
    <define name="LONGITUDINAL_CORRECTION" value="1."/>
    <define name="VERTICAL_CORRECTION" value="1.5"/>
    <define name="HORIZ_SENSOR_TILTED" value="1"/>
    <define name="IR2_SIGN" value="-1"/>
    <define name="TOP_SIGN" value="-1"/>
    <define name="ROLL_NEUTRAL_DEFAULT" value="-3.6" unit="deg"/>
    <define name="PITCH_NEUTRAL_DEFAULT" value="6" unit="deg"/>
    <define name="CORRECTION_UP" value="1."/>
    <define name="CORRECTION_DOWN" value="1."/>
    <define name="CORRECTION_LEFT" value="1."/>
    <define name="CORRECTION_RIGHT" value="1."/>
  </section>
<section name="GYRO" prefix="GYRO_">
    <define name="ADC_ROLL_NEUTRAL" value="520"/>
    <define name="ADC_TEMP_NEUTRAL" value="476"/> 
    <define name="ADC_TEMP_SLOPE" value="0"/> 
    <define name="DYNAMIC_RANGE" value="300" unit="deg/s"/>
    <define name="ADXRS300_RESISTOR_BRIDGE" value="(3.3/(3.3+1.8))"/>
    <define name="ADXRS300_SENSITIVITY" value="5" unit="mV/(deg/s)"/>
    <define name="ROLL_SCALE" value="3.3*1000./1024./(GYRO_ADXRS300_SENSITIVITY*GYRO_ADXRS300_RESISTOR_BRIDGE)" unit="deg/s/adc_unit"/>
    <define name="ROLL_DIRECTION" value="-1."/>
  </section>
  <section name="BAT">
    <define name="MILLIAMP_PER_PERCENT" value="0.86"/>
    <define name="CATASTROPHIC_BAT_LEVEL" value="9.3" unit="V"/>
  </section>
  <section name="MISC">
    <define name="NOMINAL_AIRSPEED" value="17." unit="m/s"/>
    <define name="CARROT" value="5." unit="s"/>
    <define name="KILL_MODE_DISTANCE" value="(1.5*MAX_DIST_FROM_HOME)"/>
    <define name="CONTROL_RATE" value="60" unit="Hz"/>
<!--    <define name="XBEE_INIT" value="\"ATPL2\rATRN1\rATTT80\r\""/> -->
<!--    <define name="NO_XBEE_API_INIT" value="TRUE"/> -->
    <define name="ALT_KALMAN_ENABLED" value="TRUE"/>
    <define name="TRIGGER_DELAY" value="1."/>
    <define name="DEFAULT_CIRCLE_RADIUS" value="80."/>
    <define name="MIN_CIRCLE_RADIUS" value="50."/>
  </section>
  <section name="VERTICAL CONTROL" prefix="V_CTL_">
    <define name="POWER_CTL_BAT_NOMINAL" value="11.1" unit="volt"/>
    <!-- outer loop proportional gain -->
    <define name="ALTITUDE_PGAIN" value="-0.04"/>
    <!-- outer loop saturation -->
    <define name="ALTITUDE_MAX_CLIMB" value="2."/>
    <!-- auto throttle inner loop -->
    <define name="AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE" value="0.35"/>
    <define name="AUTO_THROTTLE_MIN_CRUISE_THROTTLE" value="0.3"/>
    <define name="AUTO_THROTTLE_MAX_CRUISE_THROTTLE" value="0.80"/>
    <define name="AUTO_THROTTLE_LOITER_TRIM" value="1500"/>
    <define name="AUTO_THROTTLE_DASH_TRIM" value="-1000"/>
    <define name="AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT" value="0.1" unit="%/(m/s)"/>
    <define name="AUTO_THROTTLE_PGAIN" value="-0.02"/>
    <define name="AUTO_THROTTLE_IGAIN" value="0.1"/>
    <define name="AUTO_THROTTLE_PITCH_OF_VZ_PGAIN" value="0.1"/>
    <!-- auto pitch inner loop -->
    <define name="AUTO_PITCH_PGAIN" value="-0.05"/>
    <define name="AUTO_PITCH_IGAIN" value="0.075"/>
    <define name="AUTO_PITCH_MAX_PITCH" value="0.35"/>
    <define name="AUTO_PITCH_MIN_PITCH" value="-0.35"/>
  <define name="THROTTLE_SLEW" value="0.5"/>
  </section>
  <section name="HORIZONTAL CONTROL" prefix="H_CTL_">
    <define name="COURSE_PGAIN" value="-1.2"/>
    <define name="ROLL_MAX_SETPOINT" value="0.7" unit="radians"/>
    <define name="PITCH_MAX_SETPOINT" value="0.5" unit="radians"/>
    <define name="PITCH_MIN_SETPOINT" value="-0.5" unit="radians"/>
    <define name="PITCH_PGAIN" value="-10000."/>
    <define name="PITCH_DGAIN" value="1.5"/>
    <define name="ELEVATOR_OF_ROLL" value="2500"/>
    <define name="ROLL_ATTITUDE_GAIN" value="-7500"/>
    <define name="ROLL_RATE_GAIN" value="-1500"/>
  </section>
  <section name="NAV">
    <define name="NAV_PITCH" value="0."/>
    <define name="NAV_GLIDE_PITCH_TRIM" value="0"/>
  </section>
  <section name="AGGRESSIVE" prefix="AGR_">
    <define name="BLEND_START" value="20"/><!-- Altitude Error to Initiate Aggressive Climb CANNOT BE ZERO!!-->
    <define name="BLEND_END" value="10"/><!-- Altitude Error to Blend Aggressive to Regular Climb Modes  CANNOT BE ZERO!!-->
    <define name="CLIMB_THROTTLE" value="0.7"/><!-- Gaz for Aggressive Climb -->
    <define name="CLIMB_PITCH" value="0.25"/><!-- Pitch for Aggressive Climb -->
    <define name="DESCENT_THROTTLE" value="0.1"/><!-- Gaz for Aggressive Decent -->
    <define name="DESCENT_PITCH" value="-0.15"/><!-- Pitch for Aggressive Decent -->
    <define name="CLIMB_NAV_RATIO" value="0.8"/><!-- Percent Navigation for Altitude Error Equal to Start Altitude -->
    <define name="DESCENT_NAV_RATIO" value="1.0"/>
    </section>
  <section name="GYRO_GAINS">
    <define name="GYRO_MAX_RATE" value="200."/>
    <define name="ROLLRATESUM_NB_SAMPLES" value="64"/>
    <define name="ALT_ROLL__PGAIN" value="1.0"/>
    <define name="ROLL_RATE_PGAIN" value="1000.0"/>
    <define name="ROLL_RATE_IGAIN" value="0.0"/>
    <define name="ROLL_RATE_DGAIN" value="0.0"/>
  </section>
  <section name="FAILSAFE" prefix="FAILSAFE_">
<define name="DELAY_WITHOUT_GPS" value="1" unit="s"/>
    <define name="DEFAULT_THROTTLE" value="0.3" unit="%"/>
    <define name="DEFAULT_ROLL" value="0.3" unit="rad"/>
    <define name="DEFAULT_PITCH" value="0.5" unit="rad"/>
<define name="HOME_RADIUS" value="100" unit="m"/>
</section>
<!--
<section name="DATALINK" prefix="DATALINK_">
    <define name="DEVICE_TYPE" value="XBEE"/>
    <define name="DEVICE_ADDRESS" value="...."/>
  </section>
-->
  <section name="Digital camera telecommand">
    <!-- IOs are seen as LEDs -->
    <define name="LED_6_BANK" value="0"/>
    <define name="LED_6_PIN" value="2"/> <!-- I2C SCL -->
    <!-- ADC 5 -->
    <define name="LED_7_BANK" value="0"/>
    <define name="LED_7_PIN" value="3"/> <!-- I2C SDA -->
    <define name="DC_SHUTTER_LED" value="6"/> <!-- Grey wire -->
    <define name="DC_ZOOM_LED" value="7"/>
  </section>
<makefile>
CONFIG = \"tiny_2_1_1.h\"
include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile
FLASH_MODE=IAP
ap.CFLAGS +=  -DFBW -DAP -DCONFIG=$(CONFIG) -DLED -DTIME_LED=1
ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_fbw.c main_ap.c main.c
ap.srcs += commands.c
ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017
ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c
ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE=RC_FUTABA
ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c 
#XBEE ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B9600
#XBEE ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c xbee.c
#TRANSPARENT
ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ -DUART1_BAUD=B9600
ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c pprz_transport.c
ap.CFLAGS += -DINTER_MCU
ap.srcs += inter_mcu.c
ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3
ap.srcs += $(SRC_ARCH)/adc_hw.c
ap.CFLAGS += -DGPS -DUBX -DUSE_UART0 -DGPS_LINK=Uart0 -DUART0_BAUD=B38400 -DGPS_LED=2 -DGPS_USE_LATLONG
ap.srcs += gps_ubx.c gps.c latlong.c
ap.CFLAGS += -DINFRARED -DALT_KALMAN
ap.srcs += infrared.c estimator.c
ap.CFLAGS += -DNAV -DAGR_CLIMB -DLOITER_TRIM
ap.srcs += nav.c fw_h_ctl.c fw_v_ctl.c
ap.CFLAGS += -DGYRO -DADXRS150
ap.srcs += gyro.c nav_line.c
ap.srcs += nav_survey_rectangle.c
# chemotaxis.c anemotaxis.c discsurvey.c
########## Barometer (SPI)
#ap.CFLAGS += -DUSE_SPI -DSPI_MASTER -DUSE_SPI_SLAVE0 -DUSE_BARO_MS5534A
#ap.srcs += spi.c $(SRC_ARCH)/spi_hw.c $(SRC_ARCH)/baro_MS5534A.c
########## Chemo sensor (I2C)
#ap.srcs += i2c.c arm7/i2c_hw.c enose.c chemo_detect.c
#ap.CFLAGS += -DUSE_I2C -DENOSE
# Digital camera
# Shutter: I2C SCL
# Zoom: I2C SDA
ap.CFLAGS += -DDIGITAL_CAM
ap.srcs += dc.c
# Config for SITL simulation
include $(PAPARAZZI_SRC)/conf/autopilot/sitl.makefile
sim.CFLAGS += -DCONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN
sim.srcs += nav_line.c nav_survey_rectangle.c
# -DENOSE
# chemotaxis.c anemotaxis.c discsurvey.c $(SRC_ARCH)/sim_enose.c chemo_detect.c
sim.CFLAGS += -DDIGITAL_CAM -DPOWER_SWITCH_LED=4
sim.srcs += dc.c
# a test program to setup actuators
setup_actuators.ARCHDIR = $(ARCHI)
setup_actuators.ARCH = arm7tdmi
setup_actuators.TARGET = setup_actuators
setup_actuators.TARGETDIR = setup_actuators
setup_actuators.CFLAGS += -DFBW -DCONFIG=\"tiny.h\" -DLED -DTIME_LED=1 -DACTUATORS=\"servos_4015_hw.h\" -DSERVOS_4015 -DUSE_UART1 -DUART1_BAUD=B9600 -DDATALINK=PPRZ -DPPRZ_UART=Uart1
setup_actuators.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c pprz_transport.c setup_actuators.c $(SRC_ARCH)/uart_hw.c $(SRC_ARCH)/servos_4015_hw.c main.c
  </makefile>
</airframe>

Revision as of 21:00, 25 March 2009

Hello all, Here i will document all my progress and experiences with my Tiny 2.11. I will take pictures and document everything as much as possible to aid others interested in paparazzi. if there is writing or fact error's in this mini how to please email me at Mecevans-at-gmail.com with corrections.

My Useful Links

http://paparazzi.enac.fr/wiki/Main_Page -wiki

http://lists.nongnu.org/mailman/listinfo/paparazzi-devel -mailing list sign up

http://www.engr.usu.edu/wiki/index.php/OSAM - college paparazzi project

http://www.mannberg.co.uk/paparazzi/ - another paparazzi how to guide

http://ppzuav.com/osc/catalog/index.php -hardware

http://diydrones.com/ http://www.rcgroups.com/forums/showthread.php?t=851820 - Rcgroups paparazzi forum

http://embed.mibbit.com/?server=irc.freenode.net&channel=%23paparazzi&noServerNotices=true -paparazzi chat room(please join!)

http://paparazzi.enac.fr/wiki_images/Users_manual.pdf -field guide

Where do i start?

The first step is to sign up for the WIKI, Mailing List , and join the paparazzi Chat room.Read the entire wiki head-to-toe and then if you still have any questions ask.


Which autopilot is right for me?

After reading the entire paparazzi WIKI and saving my money I was ready to consider purchasing or building a complete system. I set a real, saved up budget of $1000US to get things going. I set curtain goal in which i wanted to achieve now, and down the road. The original thread is HERE

My goals

  • I plan to spend $1000US
  • I would like to be able to carry a video or digital camera now or in the near future
  • I would like to trigger or control the cameras with paparazzi
  • I would like long flight times (20-30 minutes or more)
  • I wanted to have everything build, tested and tuned in less than 2 months


Because of my time frame and budget i set my mind on pre-assembled and programmed autopilots from PPZUAV .the choices were the tiny 2.11 or the TWOG . I even made paper cutouts to get an idea of how amazingly small these things really are. This was not an overnight decision; I had messaged many people with all different levels of experience with paparazzi. The tiny 2.11 is a great first step into the world of UAV's and everything is one board.

Next on the list was the radio modems, either 900 MHz or 2.4 GHz from digi. Originally the kit comes with 2.4 GHz xbee pro V2 but you can request other if you like. After posting THIS thread and contacting David from PPZUAV he convinced me to try the newly released Xbee pro XSC's. My final step with the hardware side of things was to either buy or build the PPM tapped receiver. Luckily the ones pre-modded from PPZUAV were on sale. :)

Parts list

Installing and using the paparazzi GCS

While waiting for my order to come from David, I set up my laptop to run Ubuntu for paparazzi. The laptop I am going to use is a fairly new HP Pavilion DV5215US with windows already installed. The battery in the laptop only lasted 10 minutes so I ordered a replacement 8 hour battery for field use.

Making the live cd

  • plug in charger and boot windows
  • download the Latest Live Cd from the repository and saved it to the desktop
  • use your own or install THIS iso burner
  • insert a blank cd and install/run the iso burner
  • select the live cd file you just downloaded and your cd drive
  • burn (Once it’s done don't forget to label it!)


Installing or booting from the cd

  • A) to boot from the cd simply put the cd into the tray and restart. Select "try Ubuntu without any changes to your computer"
  • B) to install ubuntu onto your hard drive, click “install Ubuntu” and follow the guide. i used a partitioned space to install Ubuntu so i could also use Windows XP because you still need it. On startup it will ask what operating system you would like to boot.

Considering an airframe design

With my goals that i already set for the plane, i focused on these main things.

Goals

  • I would like long flight times (20-30 minutes or more)
  • I would like to be able to carry a video or digital camera now or in the near future


I knew that i wanted long flight times so i searched through Rcgroups for successful designs. also knowing that i wanted to have a camera now or in the future, i wanted a design which things could be easily removed or added. after searching for quite some time i found this very interesting plane, it has flight times of over and hour, quite fast, and had a very neat twist-to-lock payload section.

http://www.rcgroups.com/forums/showpost.php?p=10276474&postcount=362

and

http://www.rcgroups.com/forums/showpost.php?p=10769608&postcount=714

i hope to scratch build something off of this design, or if you have a better idea for an airframe post here

http://www.rcgroups.com/forums/showthread.php?t=995908

What to do when your waiting for your system

Setting up and Playing with the GCS

I had some free time so i decided to learn about this powerful GCS. i wanted to simulate and know how to use all the buttons and features. If you have not done so, download and/or print THIS field manual, and read through it. Here are my steps to get the GCS set up....

Setup

  • Double click on the paparazzi icon located in Applications>Other>paparazzi . i dragged the icon to the desktop to make it easy to get to. click ok.
  • Click A/C>new A/C, then name it. (ex: MecevansUAV )
  • On the airframe section click Edit, the text editor will pop up. File>Save as, and rename it.(ex: MecevansUAV )
  • SKIP FLIGHT PLAN, but rename all the others. (ex:setting=Mecevans, Radio=Optic6, Telemetry=900MhzXSC )
  • Find the coordinates of your flight area with google earth or HERE. make sure its in decimal form,and write it down.
  • now go back to paparazzi and click Flight Plan>Text Editor. Change the spaces i put words in only! (ex: latitude,longitude,max distance from home=700m,name=FortOrd ) REMEMBER EVERTHINGS IN METERS! now save as. (ex: FortOrd ).
  • A/C>Save


Simulation
  • Under target make sure SIM is selected, click build.
  • Under Session make sure Simulation is selected.Click execute!
  • when the GCS opens up click the google icon, let it load the tiles. it will automatically save them too.
  • to take off: click the runway then the green launch button, your flying!
  • mess around with the simulation untill you have a general understanding how it works.

I got all my parts! Now what?

THE FIRST THING TO DO IS ADD YOURSELF TO THE WIKI'S USER'S LIST!

-note: if you need any help with this ask me.

my code

<!DOCTYPE airframe SYSTEM "airframe.dtd">


<airframe name="Funjet 1 Tiny 2.1">

 <servos>
   <servo name="MOTOR"         no="0" min="1000" neutral="1000" max="2000"/>
   <servo name="AILEVON_LEFT"  no="2" min="1130" neutral="1500" max="1880"/>
   <servo name="AILEVON_RIGHT" no="6" min="1980" neutral="1515" max="1170"/>
 </servos>
 <commands>
   <axis name="THROTTLE" failsafe_value="0"/>
   <axis name="ROLL"     failsafe_value="0"/>
   <axis name="PITCH"    failsafe_value="0"/>
 </commands>
 <rc_commands>
   <set command="THROTTLE" value="@THROTTLE"/>
   <set command="ROLL"     value="@ROLL"/>
   <set command="PITCH"    value="@PITCH"/>
 </rc_commands>
 <section name="MIXER">
   <define name="AILEVON_AILERON_RATE" value="0.75"/>
   <define name="AILEVON_ELEVATOR_RATE" value="0.75"/>
 </section>
 <command_laws>
   <let var="aileron"  value="@ROLL  * AILEVON_AILERON_RATE"/>
   <let var="elevator" value="@PITCH * AILEVON_ELEVATOR_RATE"/>  
   <set servo="MOTOR"           value="@THROTTLE"/>
   <set servo="AILEVON_LEFT"  value="$elevator + $aileron"/>
   <set servo="AILEVON_RIGHT" value="$elevator - $aileron"/>
 </command_laws>
 <section name="AUTO1" prefix="AUTO1_">
   <define name="MAX_ROLL" value="0.85"/>
   <define name="MAX_PITCH" value="0.6"/>
 </section>
 <section name="adc" prefix="ADC_CHANNEL_">
   <define name="IR1" value="ADC_1"/>
   <define name="IR2" value="ADC_2"/>
   <define name="IR_TOP" value="ADC_0"/>
   <define name="IR_NB_SAMPLES" value="16"/>
   <define name="GYRO_ROLL" value="ADC_3"/>
   <define name="GYRO_NB_SAMPLES" value="16"/> 
 </section>
 <section name="INFRARED" prefix="IR_">
   <define name="ADC_IR1_NEUTRAL" value="0"/>
   <define name="ADC_IR2_NEUTRAL" value="0"/>
   <define name="ADC_TOP_NEUTRAL" value="0"/>
   <define name="LATERAL_CORRECTION" value="1."/>
   <define name="LONGITUDINAL_CORRECTION" value="1."/>
   <define name="VERTICAL_CORRECTION" value="1.5"/>
   <define name="HORIZ_SENSOR_TILTED" value="1"/>
   <define name="IR2_SIGN" value="-1"/>
   <define name="TOP_SIGN" value="-1"/>
   <define name="ROLL_NEUTRAL_DEFAULT" value="-3.6" unit="deg"/>
   <define name="PITCH_NEUTRAL_DEFAULT" value="6" unit="deg"/>
   <define name="CORRECTION_UP" value="1."/>
   <define name="CORRECTION_DOWN" value="1."/>
   <define name="CORRECTION_LEFT" value="1."/>
   <define name="CORRECTION_RIGHT" value="1."/>
 </section>
<section name="GYRO" prefix="GYRO_">
   <define name="ADC_ROLL_NEUTRAL" value="520"/>
   <define name="ADC_TEMP_NEUTRAL" value="476"/>   
   <define name="ADC_TEMP_SLOPE" value="0"/>  
   <define name="DYNAMIC_RANGE" value="300" unit="deg/s"/>
   <define name="ADXRS300_RESISTOR_BRIDGE" value="(3.3/(3.3+1.8))"/>
   <define name="ADXRS300_SENSITIVITY" value="5" unit="mV/(deg/s)"/>
   <define name="ROLL_SCALE" value="3.3*1000./1024./(GYRO_ADXRS300_SENSITIVITY*GYRO_ADXRS300_RESISTOR_BRIDGE)" unit="deg/s/adc_unit"/>
   <define name="ROLL_DIRECTION" value="-1."/> 
 </section>
 <section name="BAT">
   <define name="MILLIAMP_PER_PERCENT" value="0.86"/>
   <define name="CATASTROPHIC_BAT_LEVEL" value="9.3" unit="V"/>
 </section>

 <section name="MISC">
   <define name="NOMINAL_AIRSPEED" value="17." unit="m/s"/>
   <define name="CARROT" value="5." unit="s"/>
   <define name="KILL_MODE_DISTANCE" value="(1.5*MAX_DIST_FROM_HOME)"/>
   <define name="CONTROL_RATE" value="60" unit="Hz"/>
   <define name="ALT_KALMAN_ENABLED" value="TRUE"/>
   <define name="TRIGGER_DELAY" value="1."/>
   <define name="DEFAULT_CIRCLE_RADIUS" value="80."/>
   <define name="MIN_CIRCLE_RADIUS" value="50."/>
 </section>

 <section name="VERTICAL CONTROL" prefix="V_CTL_">
   <define name="POWER_CTL_BAT_NOMINAL" value="11.1" unit="volt"/>
   <define name="ALTITUDE_PGAIN" value="-0.04"/>
   <define name="ALTITUDE_MAX_CLIMB" value="2."/>
   <define name="AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE" value="0.35"/>
   <define name="AUTO_THROTTLE_MIN_CRUISE_THROTTLE" value="0.3"/>
   <define name="AUTO_THROTTLE_MAX_CRUISE_THROTTLE" value="0.80"/>
   <define name="AUTO_THROTTLE_LOITER_TRIM" value="1500"/>
   <define name="AUTO_THROTTLE_DASH_TRIM" value="-1000"/>
   <define name="AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT" value="0.1" unit="%/(m/s)"/>
   <define name="AUTO_THROTTLE_PGAIN" value="-0.02"/>
   <define name="AUTO_THROTTLE_IGAIN" value="0.1"/>
   <define name="AUTO_THROTTLE_PITCH_OF_VZ_PGAIN" value="0.1"/>
   <define name="AUTO_PITCH_PGAIN" value="-0.05"/>
   <define name="AUTO_PITCH_IGAIN" value="0.075"/>
   <define name="AUTO_PITCH_MAX_PITCH" value="0.35"/>
   <define name="AUTO_PITCH_MIN_PITCH" value="-0.35"/>
  <define name="THROTTLE_SLEW" value="0.5"/>
 </section>
 <section name="HORIZONTAL CONTROL" prefix="H_CTL_">
   <define name="COURSE_PGAIN" value="-1.2"/>
   <define name="ROLL_MAX_SETPOINT" value="0.7" unit="radians"/>
   <define name="PITCH_MAX_SETPOINT" value="0.5" unit="radians"/>
   <define name="PITCH_MIN_SETPOINT" value="-0.5" unit="radians"/>
   <define name="PITCH_PGAIN" value="-10000."/>
   <define name="PITCH_DGAIN" value="1.5"/>
   <define name="ELEVATOR_OF_ROLL" value="2500"/>
   <define name="ROLL_ATTITUDE_GAIN" value="-7500"/>
   <define name="ROLL_RATE_GAIN" value="-1500"/>
 </section>
 <section name="NAV">
   <define name="NAV_PITCH" value="0."/>
   <define name="NAV_GLIDE_PITCH_TRIM" value="0"/>
 </section>
 <section name="AGGRESSIVE" prefix="AGR_">
   <define name="BLEND_START" value="20"/>
   <define name="BLEND_END" value="10"/>
   <define name="CLIMB_THROTTLE" value="0.7"/>
   <define name="CLIMB_PITCH" value="0.25"/>
   <define name="DESCENT_THROTTLE" value="0.1"/>
   <define name="DESCENT_PITCH" value="-0.15"/>
   <define name="CLIMB_NAV_RATIO" value="0.8"/>
   <define name="DESCENT_NAV_RATIO" value="1.0"/>
   </section>


 <section name="GYRO_GAINS">
   <define name="GYRO_MAX_RATE" value="200."/>
   <define name="ROLLRATESUM_NB_SAMPLES" value="64"/>
   <define name="ALT_ROLL__PGAIN" value="1.0"/>
   <define name="ROLL_RATE_PGAIN" value="1000.0"/>
   <define name="ROLL_RATE_IGAIN" value="0.0"/>
   <define name="ROLL_RATE_DGAIN" value="0.0"/>
 </section>
 <section name="FAILSAFE" prefix="FAILSAFE_">

<define name="DELAY_WITHOUT_GPS" value="1" unit="s"/>

   	<define name="DEFAULT_THROTTLE" value="0.3" unit="%"/>
   	<define name="DEFAULT_ROLL" value="0.3" unit="rad"/>
   	<define name="DEFAULT_PITCH" value="0.5" unit="rad"/>

<define name="HOME_RADIUS" value="100" unit="m"/> </section>


 <section name="Digital camera telecommand">
   <define name="LED_6_BANK" value="0"/>
   <define name="LED_6_PIN" value="2"/> 
   <define name="LED_7_BANK" value="0"/>
   <define name="LED_7_PIN" value="3"/> 
   <define name="DC_SHUTTER_LED" value="6"/> 
   <define name="DC_ZOOM_LED" value="7"/>
 </section>

<makefile>

CONFIG = \"tiny_2_1_1.h\"

include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile

FLASH_MODE=IAP

ap.CFLAGS += -DFBW -DAP -DCONFIG=$(CONFIG) -DLED -DTIME_LED=1 ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_fbw.c main_ap.c main.c

ap.srcs += commands.c

ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c

ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE=RC_FUTABA ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c

  1. XBEE ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B9600
  2. XBEE ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c xbee.c
  1. TRANSPARENT

ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ -DUART1_BAUD=B9600 ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c pprz_transport.c


ap.CFLAGS += -DINTER_MCU ap.srcs += inter_mcu.c

ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3 ap.srcs += $(SRC_ARCH)/adc_hw.c

ap.CFLAGS += -DGPS -DUBX -DUSE_UART0 -DGPS_LINK=Uart0 -DUART0_BAUD=B38400 -DGPS_LED=2 -DGPS_USE_LATLONG ap.srcs += gps_ubx.c gps.c latlong.c

ap.CFLAGS += -DINFRARED -DALT_KALMAN ap.srcs += infrared.c estimator.c

ap.CFLAGS += -DNAV -DAGR_CLIMB -DLOITER_TRIM ap.srcs += nav.c fw_h_ctl.c fw_v_ctl.c


ap.CFLAGS += -DGYRO -DADXRS150 ap.srcs += gyro.c nav_line.c ap.srcs += nav_survey_rectangle.c

  1. chemotaxis.c anemotaxis.c discsurvey.c
                    1. Barometer (SPI)
  1. ap.CFLAGS += -DUSE_SPI -DSPI_MASTER -DUSE_SPI_SLAVE0 -DUSE_BARO_MS5534A
  2. ap.srcs += spi.c $(SRC_ARCH)/spi_hw.c $(SRC_ARCH)/baro_MS5534A.c
                    1. Chemo sensor (I2C)
  1. ap.srcs += i2c.c arm7/i2c_hw.c enose.c chemo_detect.c
  2. ap.CFLAGS += -DUSE_I2C -DENOSE
  1. Digital camera
  2. Shutter: I2C SCL
  3. Zoom: I2C SDA

ap.CFLAGS += -DDIGITAL_CAM ap.srcs += dc.c


  1. Config for SITL simulation

include $(PAPARAZZI_SRC)/conf/autopilot/sitl.makefile sim.CFLAGS += -DCONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN

sim.srcs += nav_line.c nav_survey_rectangle.c

  1. -DENOSE
  2. chemotaxis.c anemotaxis.c discsurvey.c $(SRC_ARCH)/sim_enose.c chemo_detect.c

sim.CFLAGS += -DDIGITAL_CAM -DPOWER_SWITCH_LED=4 sim.srcs += dc.c



  1. a test program to setup actuators

setup_actuators.ARCHDIR = $(ARCHI) setup_actuators.ARCH = arm7tdmi setup_actuators.TARGET = setup_actuators setup_actuators.TARGETDIR = setup_actuators

setup_actuators.CFLAGS += -DFBW -DCONFIG=\"tiny.h\" -DLED -DTIME_LED=1 -DACTUATORS=\"servos_4015_hw.h\" -DSERVOS_4015 -DUSE_UART1 -DUART1_BAUD=B9600 -DDATALINK=PPRZ -DPPRZ_UART=Uart1 setup_actuators.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c pprz_transport.c setup_actuators.c $(SRC_ARCH)/uart_hw.c $(SRC_ARCH)/servos_4015_hw.c main.c

 </makefile>

</airframe>