mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-10-02 12:23:17 +08:00
[autopilot] convert fixedwing firmware to new AP modules
also load baro_board with ap target as a workaround until relevant modules are loaded from board XML modules
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="autopilot_gnc_fw" task="control">
|
||||
<doc>
|
||||
<description>
|
||||
Autopilot GNC specific to fixedwing part
|
||||
</description>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>autopilot_gnc</depends>
|
||||
</dep>
|
||||
<periodic fun="navigation_task()" freq="NAVIGATION_FREQUENCY" cond="FIXEDWING_FIRMWARE && !USE_GENERATED_AUTOPILOT"/>
|
||||
<periodic fun="attitude_loop()" freq="CONTROL_FREQUENCY" cond="FIXEDWING_FIRMWARE && !USE_GENERATED_AUTOPILOT && !AHRS_TRIGGERED_ATTITUDE_LOOP"/>
|
||||
<makefile target="!fbw"/>
|
||||
</module>
|
||||
|
||||
@@ -193,20 +193,6 @@ else ifeq ($(BOARD),$(filter $(BOARD),px4fmu))
|
||||
BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi4
|
||||
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE4
|
||||
endif
|
||||
# apogee baro
|
||||
else ifeq ($(BOARD), apogee)
|
||||
BARO_BOARD_CFLAGS += -DUSE_I2C1
|
||||
BARO_BOARD_SRCS += peripherals/mpl3115.c
|
||||
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
|
||||
|
||||
# Umarim
|
||||
else ifeq ($(BOARD), umarim)
|
||||
ifeq ($(BOARD_VERSION), 1.0)
|
||||
BARO_BOARD_CFLAGS += -DUSE_I2C1 -DUSE_ADS1114_1
|
||||
BARO_BOARD_CFLAGS += -DADS1114_I2C_DEV=i2c1
|
||||
BARO_BOARD_SRCS += peripherals/ads1114.c
|
||||
BARO_BOARD_SRCS += boards/umarim/baro_board.c
|
||||
endif
|
||||
|
||||
# Naze32
|
||||
else ifeq ($(BOARD), naze32)
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
<configure name="USE_BARO_BOARD" default="TRUE"/>
|
||||
<configure name="BARO_LED" default="none"/>
|
||||
<configure name="BARO_PERIODIC_FREQUENCY" default="50"/>
|
||||
<define name="USE_BARO_BOARD" value="$(USE_BARO_BOARD)"/>
|
||||
<define name="BARO_LED" value="$(BARO_LED)" cond="ifneq ($(BARO_LED),none)"/>
|
||||
<define name="BARO_PERIODIC_FREQUENCY" value="$(BARO_PERIODIC_FREQUENCY)"/>
|
||||
<file name="baro_board_common.c"/>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<configure name="WIND_INFO" value="FALSE|TRUE" description="parse WIND_INFO message (default TRUE)"/>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>system_core,autopilot_gnc,actuators_pwm</depends>
|
||||
<depends>system_core,autopilot_gnc_fw,actuators_pwm</depends>
|
||||
</dep>
|
||||
<makefile>
|
||||
<configure name="PERIODIC_FREQUENCY" default="60"/>
|
||||
|
||||
@@ -28,9 +28,11 @@
|
||||
<configure name="INTERMCU_PORT" default="UART2" case="upper|lower"/>
|
||||
<configure name="FBW_MODE_LED" default="none"/>
|
||||
<define name="FBW_MODE_LED" value="$(FBW_MODE_LED)" cond="ifneq ($(FBW_MODE_LED),none)"/>
|
||||
<define name="INTER_MCU_FBW"/>
|
||||
</makefile>
|
||||
<makefile target="ap" firmware="fixedwing">
|
||||
<configure name="INTERMCU_PORT" default="UART5" case="upper|lower"/>
|
||||
<define name="INTER_MCU_AP"/>
|
||||
</makefile>
|
||||
<makefile target="ap|fbw" firmware="fixedwing">
|
||||
<raw>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<description>AP target specific module</description>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>system_core,electrical,settings</depends>
|
||||
<depends>system_core,electrical,settings,baro_board</depends>
|
||||
</dep>
|
||||
<makefile target="ap">
|
||||
<define name="AP"/>
|
||||
|
||||
@@ -64,36 +64,12 @@ value sim_sys_time_task(value unit)
|
||||
|
||||
value sim_periodic_task(value unit)
|
||||
{
|
||||
sensors_task();
|
||||
#if USE_GENERATED_AUTOPILOT
|
||||
autopilot_periodic();
|
||||
#else
|
||||
attitude_loop();
|
||||
#endif
|
||||
reporting_task();
|
||||
modules_periodic_task();
|
||||
periodic_task_fbw();
|
||||
electrical_periodic();
|
||||
handle_periodic_tasks_ap();
|
||||
event_task_ap();
|
||||
event_task_fbw();
|
||||
return unit;
|
||||
}
|
||||
|
||||
value sim_monitor_task(value unit)
|
||||
{
|
||||
monitor_task();
|
||||
return unit;
|
||||
}
|
||||
|
||||
value sim_nav_task(value unit)
|
||||
{
|
||||
#if !USE_GENERATED_AUTOPILOT
|
||||
navigation_task();
|
||||
#endif
|
||||
return unit;
|
||||
}
|
||||
|
||||
|
||||
float ftimeofday(void)
|
||||
{
|
||||
struct timeval t;
|
||||
|
||||
@@ -103,7 +103,6 @@ void autopilot_static_init(void)
|
||||
|
||||
void autopilot_static_periodic(void)
|
||||
{
|
||||
attitude_loop();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,6 @@ extern void init_ap(void);
|
||||
extern void handle_periodic_tasks_ap(void);
|
||||
extern void event_task_ap(void);
|
||||
|
||||
extern void sensors_task(void);
|
||||
extern void monitor_task(void);
|
||||
extern void reporting_task(void);
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ void failsafe_check(void)
|
||||
radio_control.status != RC_OK &&
|
||||
#endif
|
||||
#ifdef NO_GPS_LOST_WITH_DATALINK_TIME
|
||||
datalink_time > NO_GPS_LOST_WITH_DATALINK_TIME &&
|
||||
datalink_time > NO_GPS_LOST_WITH_DATALINK_TIME &&
|
||||
#endif
|
||||
GpsIsLost()) {
|
||||
autopilot_set_mode(AP_MODE_FAILSAFE);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include BOARD_CONFIG
|
||||
|
||||
#if USE_BARO_BOARD
|
||||
PRINT_CONFIG_MSG_VALUE("USE_BARO_BOARD is TRUE, reading onboard baro: ", BARO_BOARD)
|
||||
//PRINT_CONFIG_MSG_VALUE("USE_BARO_BOARD is TRUE, reading onboard baro: ", BARO_BOARD) // FIXME debug message broken?
|
||||
#endif
|
||||
|
||||
void baro_board_init(void)
|
||||
|
||||
@@ -41,8 +41,6 @@ module Make (A:Data.MISSION) (FM: FlightModel.SIG) = struct
|
||||
|
||||
let servos_period = 1./.40. (* s *)
|
||||
let periodic_period = 1./.60. (* s *)
|
||||
let nav_period = 1./.4. (* s *)
|
||||
let monitor_period = 1. (* s *)
|
||||
let rc_period = 1./.40. (* s *)
|
||||
let sys_time_period = 1./.120. (* s *)
|
||||
|
||||
@@ -124,8 +122,6 @@ module Make (A:Data.MISSION) (FM: FlightModel.SIG) = struct
|
||||
|
||||
external sys_time_task : unit -> unit = "sim_sys_time_task"
|
||||
external periodic_task : unit -> unit = "sim_periodic_task"
|
||||
external nav_task : unit -> unit = "sim_nav_task"
|
||||
external monitor_task : unit -> unit = "sim_monitor_task"
|
||||
external sim_init : unit -> unit = "sim_init"
|
||||
external update_bat : int -> unit = "update_bat"
|
||||
external update_adc1 : int -> unit = "update_adc1"
|
||||
@@ -191,8 +187,6 @@ module Make (A:Data.MISSION) (FM: FlightModel.SIG) = struct
|
||||
let boot = fun time_scale ->
|
||||
Simlib.timer ~scale:time_scale servos_period (update_servos bat_button);
|
||||
Simlib.timer ~scale:time_scale periodic_period periodic_task;
|
||||
Simlib.timer ~scale:time_scale nav_period nav_task;
|
||||
Simlib.timer ~scale:time_scale monitor_period monitor_task;
|
||||
Simlib.timer ~scale:time_scale sys_time_period sys_time_task;
|
||||
|
||||
(* Forward or broacast messages according to "link" mode *)
|
||||
|
||||
Reference in New Issue
Block a user