Merge branch 'dev' into locm3

Conflicts:
	Makefile
This commit is contained in:
Piotr Esden-Tempski
2012-02-14 13:06:39 -08:00
32 changed files with 114 additions and 78 deletions
+3 -3
View File
@@ -47,7 +47,7 @@ MISC=sw/ground_segment/misc
LOGALIZER=sw/logalizer
SIMULATOR=sw/simulator
EXT=sw/ext
MAKE:=$(MAKE) PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME)
MAKE=make PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME)
CONF=$(PAPARAZZI_SRC)/conf
STATICINCLUDE =$(PAPARAZZI_HOME)/var/include
MESSAGES_H=$(STATICINCLUDE)/messages.h
@@ -252,7 +252,7 @@ cleanspaces:
distclean : dist_clean
dist_clean :
@echo "Warning: This removes all non-repository files. This means you will loose your aircraft list, your maps, your logfiles, ... if you want this, then run: $(MAKE) dist_clean_irreversible"
@echo "Warning: This removes all non-repository files. This means you will loose your aircraft list, your maps, your logfiles, ... if you want this, then run: make dist_clean_irreversible"
dist_clean_irreversible: clean
rm -rf conf/srtm_data
@@ -270,7 +270,7 @@ test_all_example_airframes:
$(MAKE) AIRCRAFT=EasyStar_ETS clean_ac ap sim
test_all_example_airframes2:
for ap in `grep name conf/conf.xml.example | sed -e 's/.*name=\"//' | sed -e 's/"//'`; do echo "Making $$ap"; $(MAKE) -C ./ AIRCRAFT=$$ap clean_ac ap.compile || exit 1; done
for ap in `grep name conf/conf.xml.example | sed -e 's/.*name=\"//' | sed -e 's/"//'`; do echo "Making $$ap"; make -C ./ AIRCRAFT=$$ap clean_ac ap.compile || exit 1; done
commands: paparazzi sw/simulator/launchsitl
+3 -3
View File
@@ -51,7 +51,7 @@ SETTINGS_FILE=$(SETTINGS:settings%=%)
#TUNING_FILE=$(subst ,_,$(SETTINGS:settings/%.xml=%)).h
TUNING_H=$(AC_GENERATED)/tuning.h
SUPERVISION=./paparazzi
MAKE:=$(MAKE) PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME)
MAKE=make PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME)
MODULES_H=$(AC_GENERATED)/modules.h
AIRCRAFT_MD5=$(AIRCRAFT_CONF_DIR)/aircraft.md5
@@ -138,7 +138,7 @@ $(MODULES_H) : $(CONF)/$(AIRFRAME_XML) $(TOOLS)/gen_modules.out $(CONF)/modules/
$(SETTINGS_MODULES) : $(MODULES_H)
%.ac_h : $(TOOLS)/gen_aircraft.out
$(Q)if (expr "$(AIRCRAFT)"); then : ; else echo "AIRCRAFT undefined: type '$(MAKE) AIRCRAFT=AircraftName ...'"; exit 1; fi
$(Q)if (expr "$(AIRCRAFT)"); then : ; else echo "AIRCRAFT undefined: type 'make AIRCRAFT=AircraftName ...'"; exit 1; fi
@echo BUILD $(AIRCRAFT), TARGET $*
+$(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) TARGET=$* Q=$(Q) $(TOOLS)/gen_aircraft.out $(AIRCRAFT)
@@ -187,5 +187,5 @@ check_fuses_fbw: fbw.check_fuses
hard_ac ac: ac_h fbw ap
clean_ac :
$(Q)if (expr "$(AIRCRAFT)"); then : ; else echo "AIRCRAFT undefined: type '$(MAKE) AIRCRAFT=AircraftName ...'"; exit 1; fi
$(Q)if (expr "$(AIRCRAFT)"); then : ; else echo "AIRCRAFT undefined: type 'make AIRCRAFT=AircraftName ...'"; exit 1; fi
rm -fr $(PAPARAZZI_HOME)/var/$(AIRCRAFT)
+1 -6
View File
@@ -56,15 +56,10 @@ CFLAGS += $(INCLUDES)
CFLAGS += $($(TARGET).CFLAGS)
CFLAGS += $(LOCAL_CFLAGS)
CFLAGS += -O2
CFLAGS += -std=gnu99
# meschach prototypes trigger numerous warnings
ifneq ($(SIM_TYPE),BOOZ)
ifneq ($(SIM_TYPE),JSBSIM)
CFLAGS += -Wstrict-prototypes
CFLAGS += -std=gnu99
endif
endif
LDFLAGS = -lm
+2 -2
View File
@@ -50,7 +50,7 @@ ap.srcs += $(SRC_ARCH)/mcu_arch.c
#
# Math functions
#
$(TARGET).srcs += math/pprz_geodetic_int.c math/pprz_geodetic_float.c math/pprz_geodetic_double.c math/pprz_trig_int.c
ap.srcs += math/pprz_geodetic_int.c math/pprz_geodetic_float.c math/pprz_geodetic_double.c math/pprz_trig_int.c
ifeq ($(ARCH), stm32)
ap.srcs += lisa/plug_sys.c
@@ -74,7 +74,7 @@ endif
ifndef PERIODIC_FREQUENCY
PERIODIC_FREQUENCY = 512
endif
$(TARGET).CFLAGS += -DPERIODIC_FREQUENCY=$(PERIODIC_FREQUENCY)
ap.CFLAGS += -DPERIODIC_FREQUENCY=$(PERIODIC_FREQUENCY)
#
# Systime
#
@@ -56,8 +56,9 @@ $(TARGET).CFLAGS += -DTRAFFIC_INFO
#
# LEDs
#
$(TARGET).CFLAGS += -DUSE_LED
ifneq ($(ARCH), jsbsim)
$(TARGET).CFLAGS += -DUSE_LED
endif
ifneq ($(ARCH), lpc21)
ifneq ($(ARCH), jsbsim)
$(TARGET).srcs += $(SRC_ARCH)/led_hw.c
@@ -71,7 +72,8 @@ ifndef PERIODIC_FREQUENCY
PERIODIC_FREQUENCY = 60
endif
$(TARGET).CFLAGS += -DPERIODIC_FREQUENCY=$(PERIODIC_FREQUENCY)
$(TARGET).srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c
$(TARGET).srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c
$(TARGET).CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_RESOLUTION='(1./$(PERIODIC_FREQUENCY).)'
#
# InterMCU & Commands
@@ -119,11 +121,6 @@ ifneq ($(SYS_TIME_LED),none)
ns_CFLAGS += -DSYS_TIME_LED=$(SYS_TIME_LED)
endif
#
# Sys-time
#
ns_CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_RESOLUTION='(1./$(PERIODIC_FREQUENCY).)'
#
# UARTS
@@ -51,7 +51,7 @@ sim.srcs += $(NPSDIR)/nps_main.c \
$(NPSDIR)/nps_radio_control.c \
$(NPSDIR)/nps_radio_control_joystick.c \
$(NPSDIR)/nps_radio_control_spektrum.c \
$(NPSDIR)/nps_autopilot_booz.c \
$(NPSDIR)/nps_autopilot_rotorcraft.c \
$(NPSDIR)/nps_ivy.c \
$(NPSDIR)/nps_flightgear.c \
@@ -68,7 +68,7 @@ ifeq ($(TARGET), sim)
endif
sim.CFLAGS += -DPERIODIC_FREQUENCY='512.'
sim.CFLAGS += -DPERIODIC_FREQUENCY=512
#sim.CFLAGS += -DUSE_LED
sim.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c
@@ -85,9 +85,9 @@ sim.srcs += $(SRC_FIRMWARE)/commands.c
sim.srcs += $(SRC_FIRMWARE)/datalink.c
#
# Math functions
#
#
sim.srcs += math/pprz_geodetic_int.c math/pprz_geodetic_float.c math/pprz_geodetic_double.c math/pprz_trig_int.c
sim.CFLAGS += -DROTORCRAFT_BARO_LED=2
sim.srcs += $(SRC_BOARD)/baro_board.c
@@ -36,7 +36,11 @@
# imu aspirin
IMU_ASPIRIN_CFLAGS = -DUSE_IMU
# for fixedwing firmware and ap only
ifeq ($(TARGET), ap)
IMU_ASPIRIN_CFLAGS = -DUSE_IMU
endif
IMU_ASPIRIN_CFLAGS += -DIMU_TYPE_H=\"imu/imu_aspirin.h\"
IMU_ASPIRIN_SRCS = $(SRC_SUBSYSTEMS)/imu.c \
$(SRC_SUBSYSTEMS)/imu/imu_aspirin.c \
-10
View File
@@ -37,16 +37,6 @@
settings="settings/settings_booz2.xml"
gui_color="white"
/>
<aircraft
name="BOOZ2_A8"
ac_id="160"
airframe="airframes/Poine/booz2_a8.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/telemetry_test_passthrough.xml"
flight_plan="flight_plans/dummy.xml"
settings="settings/settings_test_passthrough.xml"
gui_color="white"
/>
<aircraft
name="LISA_ASCTEC_PIOTR"
ac_id="161"
+1 -1
View File
@@ -4,7 +4,7 @@
<dl_settings>
<dl_settings NAME="Sim">
<dl_setting var="nps_bypass_ahrs" min="0" step="1" max="1" module="nps/nps_autopilot_booz" shortname="bypass_ahrs" values="No|Yes"/>
<dl_setting var="nps_bypass_ahrs" min="0" step="1" max="1" module="nps/nps_autopilot_rotorcraft" shortname="bypass_ahrs" values="No|Yes"/>
</dl_settings>
</dl_settings>
@@ -28,6 +28,8 @@
#include "LPC21xx.h"
#include BOARD_CONFIG
#include "mcu_periph/sys_time.h"
/**
* On tiny (and booz) the ppm counter is running at the same speed as
* the systic counter. There is no reason for this to be true.
@@ -26,3 +26,21 @@
void sys_time_arch_init( void ) {
}
void sys_tick_handler( void ) {
sys_time.nb_tick++;
sys_time.nb_sec_rem += SYS_TIME_RESOLUTION_CPU_TICKS;
if (sys_time.nb_sec_rem >= CPU_TICKS_PER_SEC) {
sys_time.nb_sec_rem -= CPU_TICKS_PER_SEC;
sys_time.nb_sec++;
}
for (unsigned int i=0; i<SYS_TIME_NB_TIMER; i++) {
if (sys_time.timer[i].in_use &&
sys_time.nb_tick >= sys_time.timer[i].end_time) {
sys_time.timer[i].end_time += sys_time.timer[i].duration;
sys_time.timer[i].elapsed = TRUE;
if (sys_time.timer[i].cb) sys_time.timer[i].cb(i);
}
}
}
@@ -21,22 +21,24 @@
*
*/
/*
*\brief simulator dummy timing functions
*
/** @file arch/sim/mcu_periph/sys_time_arch.h
* Simulator timing functions
*/
#ifndef SYS_TIME_ARCH_H
#define SYS_TIME_ARCH_H
#include <unistd.h>
#include "std.h"
#define CPU_TICKS_OF_SEC(x) (x)
#define SIGNED_CPU_TICKS_OF_SEC(x) (x)
extern void sys_tick_handler(void);
#define SEC_OF_CPU_TICKS(st) (st)
#define MSEC_OF_CPU_TICKS(st) (st)
#define USEC_OF_CPU_TICKS(st) (st)
// simulate 1us cpu ticks
#define CPU_TICKS_OF_SEC(s) (uint32_t)((s) * 1e6 + 0.5)
#define SIGNED_CPU_TICKS_OF_SEC(s) (int32_t)((s) * 1e6 + 0.5)
#define SEC_OF_CPU_TICKS(t) ((t) / 1e6)
#define MSEC_OF_CPU_TICKS(t) ((t) / 1e3)
#define USEC_OF_CPU_TICKS(t) (t)
#define SysTimeTimerStart(_t) { }
#define SysTimeTimer(_t) (_t)
@@ -29,6 +29,8 @@
#ifndef PPM_ARCH_H
#define PPM_ARCH_H
#include "mcu_periph/sys_time.h"
/**
* On tiny (and booz) the ppm counter is running at the same speed as
* the systic counter. There is no reason for this to be true.
+1 -1
View File
@@ -142,7 +142,7 @@
#define PWM1_PINSEL_BIT 14
#define BOARD_HAS_BARO
#define BOARD_HAS_BARO 1
/*
* Modem
+1 -1
View File
@@ -34,6 +34,6 @@
#define BOARD_ADC_CHANNEL_3 ADC_Channel_0
#define BOARD_ADC_CHANNEL_4 ADC_Channel_15
#define BOARD_HAS_BARO
#define BOARD_HAS_BARO 1
#endif /* CONFIG_LISA_L_1_0_H */
+1 -1
View File
@@ -56,7 +56,7 @@
#define BOARD_ADC_CHANNEL_3 ADC_Channel_14
#define BOARD_ADC_CHANNEL_4 ADC_Channel_11
#define BOARD_HAS_BARO
#define BOARD_HAS_BARO 1
#define USE_OPENCM3 1
+1 -1
View File
@@ -76,6 +76,6 @@
#define PWM1_PINSEL_VAL 0x02
#define PWM1_PINSEL_BIT 14
#define BOARD_HAS_BARO
#define BOARD_HAS_BARO 1
#endif /* CONFIG_NAVGO_V1_0_H */
+1 -1
View File
@@ -99,6 +99,6 @@
#define SPI1_DRDY_EINT 0
#define SPI1_DRDY_VIC_IT VIC_EINT0
#define BOARD_HAS_BARO
#define BOARD_HAS_BARO 1
#endif /* CONFIG_UMARIM_V1_0_H */
@@ -245,7 +245,9 @@ extern uint8_t telemetry_mode_Ap_DefaultChannel;
#define PERIODIC_SEND_SCP_STATUS(_trans, _dev) {}
#endif
#ifdef BOARD_HAS_BARO
//FIXME: we need a better switch here...
#if BOARD_HAS_BARO && USE_BARO_AS_ALTIMETER
#include "subsystems/sensors/baro.h"
#define PERIODIC_SEND_BARO_RAW(_trans, _dev) { \
DOWNLINK_SEND_BARO_RAW(_trans, _dev, \
&baro.absolute, \
+1 -1
View File
@@ -69,7 +69,7 @@
#include "subsystems/datalink/datalink.h"
#include "subsystems/settings.h"
#include "subsystems/datalink/xbee.h"
#include "ap_downlink.h"
#include "firmwares/fixedwing/ap_downlink.h"
// modules & settings
#include "generated/modules.h"
+17 -14
View File
@@ -58,7 +58,7 @@
#include "firmwares/rotorcraft/main.h"
#ifdef SITL
#include "nps_autopilot_booz.h"
#include "nps_autopilot_rotorcraft.h"
#endif
#include "generated/modules.h"
@@ -70,7 +70,6 @@ static inline void on_baro_dif_event( void );
static inline void on_gps_event( void );
static inline void on_mag_event( void );
#ifndef SITL
tid_t main_periodic_tid; ///< id for main_periodic() timer
tid_t failsafe_tid; ///< id for failsafe_check() timer
@@ -79,22 +78,12 @@ tid_t electrical_tid; ///< id for electrical_periodic() timer
tid_t baro_tid; ///< id for baro_periodic() timer
tid_t telemetry_tid; ///< id for telemetry_periodic() timer
#ifndef SITL
int main( void ) {
main_init();
while(1) {
if (sys_time_check_and_ack_timer(main_periodic_tid))
main_periodic();
if (sys_time_check_and_ack_timer(radio_control_tid))
radio_control_periodic_task();
if (sys_time_check_and_ack_timer(failsafe_tid))
failsafe_check();
if (sys_time_check_and_ack_timer(electrical_tid))
electrical_periodic();
if (sys_time_check_and_ack_timer(baro_tid))
baro_periodic();
if (sys_time_check_and_ack_timer(telemetry_tid))
telemetry_periodic();
handle_periodic_tasks();
main_event();
}
return 0;
@@ -146,6 +135,20 @@ STATIC_INLINE void main_init( void ) {
telemetry_tid = sys_time_register_timer((1./60.), NULL);
}
STATIC_INLINE void handle_periodic_tasks( void ) {
if (sys_time_check_and_ack_timer(main_periodic_tid))
main_periodic();
if (sys_time_check_and_ack_timer(radio_control_tid))
radio_control_periodic_task();
if (sys_time_check_and_ack_timer(failsafe_tid))
failsafe_check();
if (sys_time_check_and_ack_timer(electrical_tid))
electrical_periodic();
if (sys_time_check_and_ack_timer(baro_tid))
baro_periodic();
if (sys_time_check_and_ack_timer(telemetry_tid))
telemetry_periodic();
}
STATIC_INLINE void main_periodic( void ) {
+2 -1
View File
@@ -31,9 +31,10 @@
#endif
STATIC_INLINE void main_init( void );
STATIC_INLINE void main_periodic( void );
STATIC_INLINE void main_event( void );
STATIC_INLINE void handle_periodic_tasks( void );
STATIC_INLINE void main_periodic( void );
STATIC_INLINE void telemetry_periodic(void);
STATIC_INLINE void failsafe_check( void );
+1 -1
View File
@@ -169,7 +169,7 @@
} \
}
#elif defined IMU_B2_MAG_TYPE && IMU_B2_MAG_TYPE == IMU_B2_MAG_HMC5843
include "peripherals/hmc5843.h"
#include "peripherals/hmc5843.h"
#define foo_handler() {}
#define ImuMagEvent(_mag_handler) { \
MagEvent(foo_handler); \
+1 -1
View File
@@ -32,7 +32,7 @@ LD =ld
LDFLAGS =-lm
HOSTCC =gcc
CC =gcc
MAKE :=$(MAKE)
MAKE =make
CPP =$(CC) -E
AR =ar
STRIP =strip
+1
View File
@@ -13,6 +13,7 @@ extern struct NpsAutopilot autopilot;
extern void nps_autopilot_init(enum NpsRadioControlType type, int num_script, char* js_dev);
extern void nps_autopilot_run_step(double time);
extern void nps_autopilot_run_systime_step(void);
#endif /* NPS_AUTOPILOT_H */
@@ -1,4 +1,4 @@
#include "nps_autopilot_booz.h"
#include "nps_autopilot_rotorcraft.h"
#include "firmwares/rotorcraft/main.h"
#include "nps_sensors.h"
@@ -8,6 +8,7 @@
#include "subsystems/sensors/baro.h"
#include "baro_board.h"
#include "subsystems/electrical.h"
#include "mcu_periph/sys_time.h"
#include "actuators/supervision.h"
@@ -32,6 +33,10 @@ void nps_autopilot_init(enum NpsRadioControlType type_rc, int num_rc_script, cha
}
void nps_autopilot_run_systime_step( void ) {
sys_tick_handler();
}
#include <stdio.h>
#include "subsystems/gps.h"
@@ -66,7 +71,7 @@ void nps_autopilot_run_step(double time __attribute__ ((unused))) {
sim_overwrite_ahrs();
}
main_periodic();
handle_periodic_tasks();
if (time < 8) { /* start with a little bit of hovering */
int32_t init_cmd[4];
+4 -2
View File
@@ -54,7 +54,7 @@ void cont_hdl (int n __attribute__ ((unused))) {
printf("Press <enter> to continue.\n");
}
double time_to_double(timeval *t) {
double time_to_double(struct timeval *t) {
return ((double)t->tv_sec + (double)(t->tv_usec * 1e-6));
}
@@ -80,7 +80,7 @@ static void nps_main_init(void) {
nps_main.sim_time = 0.;
nps_main.display_time = 0.;
timeval t;
struct timeval t;
gettimeofday (&t, NULL);
nps_main.scaled_initial_time = time_to_double(&t);
nps_main.host_time_factor = HOST_TIME_FACTOR;
@@ -114,6 +114,8 @@ static void nps_main_init(void) {
static void nps_main_run_sim_step(void) {
// printf("sim at %f\n", nps_main.sim_time);
nps_autopilot_run_systime_step();
nps_fdm_run_step(autopilot.commands);
nps_sensors_run_step(nps_main.sim_time);
+2 -2
View File
@@ -78,8 +78,8 @@ void autopilot_init(void) {
}
void autopilot_periodic_task(void) {
periodic_task_ap();
periodic_task_fbw();
handle_periodic_tasks_ap();
handle_periodic_tasks_fbw();
}
void autopilot_event_task(void) {
+9
View File
@@ -80,6 +80,9 @@ static void sim_init(void) {
// main AP init (feed the sensors once before ?)
autopilot_init();
printf("sys_time resolution: %f\n", SYS_TIME_RESOLUTION);
printf("sys_time period in msec: %d\n", SYSTIME_PERIOD);
}
static gboolean sim_periodic(gpointer data __attribute__ ((unused))) {
@@ -116,6 +119,11 @@ static gboolean sim_periodic(gpointer data __attribute__ ((unused))) {
return result;
}
static gboolean systime_periodic(gpointer data __attribute__ ((unused))) {
sys_tick_handler();
return true;
}
int main ( int argc, char** argv) {
@@ -129,6 +137,7 @@ int main ( int argc, char** argv) {
GMainLoop *ml = g_main_loop_new(NULL, FALSE);
g_timeout_add(JSBSIM_PERIOD, sim_periodic, NULL);
g_timeout_add(SYSTIME_PERIOD, systime_periodic, NULL);
g_main_loop_run(ml);
+3
View File
@@ -32,6 +32,7 @@
#include "std.h"
#include "generated/airframe.h"
#include "generated/flight_plan.h"
#include "mcu_periph/sys_time.h"
#include <Ivy/ivy.h>
@@ -43,6 +44,8 @@
#endif
#define DT (JSBSIM_PERIOD*1e-3) ///< JSBSim timestep in seconds
#define SYSTIME_PERIOD ((uint32_t)(SYS_TIME_RESOLUTION * 1000)) ///< in msec
#define RAD2DEG 57.29578
#define FT2M 0.3048
+1 -1
View File
@@ -207,7 +207,7 @@ let () =
let errors = "red", ["error"; "no such file"; "undefined reference"; "failure"]
and warnings = "orange", ["warning"]
and info = "green", ["message"; "info"] in
and info = "green", ["pragma message"] in
let color_regexps =
List.map (fun (color, strings) ->