User/AirborneCodeReorg

From PaparazziUAV
Revision as of 03:19, 19 August 2010 by Cdewagter (talk | contribs)
Jump to navigation Jump to search

This page summarizes the changes needed to switch from the "raw makefile in airframes" to a new "xml only aiframes" syntax

Why

  • Because of its growth, paparazzi needs significant reorganization. To make this possible without breaking airframe files, the 'subsystem' idea introduced in booz is now generalized to all airframes using a nicer looking XML structure.
  • users are not required to understand Makefile's anymore in order to choose what to compile.

FixedWing

In Brief

The idea is to replace the <makefile> section with a <target> section

Typicaly, replace:

<makefile>
 CONFIG=\"tiny_0_99.h\"
 include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile
 FLASH_MODE=IAP
 ap.CFLAGS +=  -DFBW -DAP -DBOARD_CONFIG=$(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_4015_MAT_hw.h\" -DSERVOS_4015_MAT
 ap.srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c actuators.c
 ap.CFLAGS += -DRADIO_CONTROL
 ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c  
 ap.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DPPRZ_UART=Uart0 -DDATALINK=PPRZ -DUART0_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_UART1 -DGPS_LINK=Uart1 -DUART1_BAUD=B38400
 ap.CFLAGS += -DGPS_CONFIGURE -DGPS_BAUD=38400
 ap.srcs += gps_ubx.c gps.c latlong.c
 ap.CFLAGS += -DINFRARED
 ap.srcs += infrared.c estimator.c
 ap.CFLAGS += -DNAV -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN -DWIND_INFO
 ap.srcs += nav.c fw_h_ctl.c fw_v_ctl.c
 ap.srcs += nav_line.c nav_survey_rectangle.c
</makefile>

with

 <target name="fixedwing" board="tiny_2.11">
   <param name="FLASH_MODE" value="IAP"/>
   <subsystem name="autopilot"/>
   <subsystem name="radio_control" type="ppm"/>
   <subsystem name="telemetry" type="transparent">
     <param name="MODEM_BAUD" value="9600"/>
   </subsystem>
   <subsystem name="actuators" type="4017"/>
   <subsystem name="gyro"/>
   <subsystem name="attitude" type="infrared"/>
   <subsystem name="gps" type="ublox_lea4p"/>
   <subsystem name="navigation">
     <define name="AGR_CLIMB" value="1" />
     <define name="LOITER_TRIM" value="1" />
     <define name="WIND_INFO" value="1" />
   <subsystem name="testing"/>
   </subsystem>
 </target>

In details

Let's look in more detail how this is done

The first two lines of the makefile

CONFIG=\"tiny_0_99.h\"
include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile
FLASH_MODE=IAP

correspond to this

<target name="fixed_wings" board="tiny_2.11">
  <param name="FLASH_MODE" value="IAP"/>

The only field you might want to adapt depending on your configuration is the 'board one. The list of supported boards is

  • "twog_1"
  • "tiny_2.11"
  • "tiny_2.1"
  • "tiny_1.1"
  • "tiny_0.99"
  • "booz"
  • "lisa_l_1.0"


The second line of the target section

<subsystem name="autopilot"/>

brings you most of the autopilot, ie

The third line defines what kind of radio control you'll be using. Fox now fixedwing doesn't have a choice and uses ppm

<subsystem name="radio_control" type="ppm"/>

replaces

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