From 0a65e149031343b21c8e9a2dd9d78474b4f20859 Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Sat, 6 May 2017 22:24:40 +0200 Subject: [PATCH] [autopilot] compiling generated AP for fixedwing (#2055) * [autopilot] compiling generated AP for fixedwing * update some old variable names for autopilot mode * prevent oscillation on the ground with real aircraft * add guidance loop to 'new' control all this guidance code should really be better factorized * fix rotorcraft autopilot for new API * read guidance RC if needed * use generated autopilot as soon as an autopilot file is defined * autopilot node at airframe, firmware or target level The autopilot can be specific to one of the firmware, or one of the target. At the moment, it will fail at runtime if more than one autopilot in the same airframe since server don't know which target is in use. --- conf/airframes/ENAC/hoops_gen_ap.xml | 4 +- conf/airframes/airframe.dtd | 4 +- conf/autopilot/fixedwing_autopilot.xml | 75 +++++++++++++----- conf/autopilot/rotorcraft_autopilot.xml | 40 +++++----- conf/modules/guidance_basic_fw.xml | 2 + conf/modules/guidance_full_pid_fw.xml | 2 + sw/airborne/arch/sim/sim_ap.c | 6 ++ .../firmwares/fixedwing/autopilot_firmware.h | 8 ++ .../firmwares/fixedwing/autopilot_generated.c | 12 ++- .../fixedwing/autopilot_rc_helpers.h | 61 +++++++++++++++ .../firmwares/fixedwing/autopilot_static.c | 48 ++++++------ .../firmwares/fixedwing/autopilot_static.h | 35 ++------- .../firmwares/fixedwing/autopilot_utils.h | 77 +++++++++++++++++++ .../firmwares/fixedwing/fixedwing_datalink.c | 2 +- .../fixedwing/guidance/guidance_common.h | 5 ++ .../firmwares/fixedwing/guidance/guidance_h.c | 41 ++++++++++ .../firmwares/fixedwing/guidance/guidance_h.h | 40 ++++++++++ .../firmwares/fixedwing/guidance/guidance_v.c | 39 ++++++++++ .../fixedwing/guidance/guidance_v_n.c | 44 ++++++++++- sw/airborne/firmwares/fixedwing/main_ap.c | 6 ++ sw/airborne/firmwares/fixedwing/nav.c | 2 +- sw/airborne/firmwares/fixedwing/nav.h | 2 +- .../stabilization/stabilization_adaptive.c | 8 +- sw/airborne/modules/cam_control/cam.c | 4 +- sw/airborne/modules/cam_control/point.c | 4 +- sw/airborne/modules/datalink/mavlink.c | 8 +- sw/airborne/modules/nav/takeoff_detect.c | 4 +- .../modules/switching/auto1_commands.c | 2 +- sw/ground_segment/tmtc/fw_server.ml | 2 +- sw/ground_segment/tmtc/server.ml | 6 +- sw/ground_segment/tmtc/server_globals.ml | 2 +- sw/lib/ocaml/gen_common.ml | 58 ++++++++++++-- sw/lib/ocaml/gen_common.mli | 4 +- sw/misc/rctx/main_rctx.c | 2 +- sw/tools/generators/gen_aircraft.ml | 6 ++ sw/tools/generators/gen_autopilot.ml | 3 +- sw/tools/generators/gen_settings.ml | 2 +- 37 files changed, 535 insertions(+), 135 deletions(-) create mode 100644 sw/airborne/firmwares/fixedwing/autopilot_rc_helpers.h create mode 100644 sw/airborne/firmwares/fixedwing/guidance/guidance_h.c create mode 100644 sw/airborne/firmwares/fixedwing/guidance/guidance_h.h diff --git a/conf/airframes/ENAC/hoops_gen_ap.xml b/conf/airframes/ENAC/hoops_gen_ap.xml index 2fbfa32a1d..bbbbf4ce98 100644 --- a/conf/airframes/ENAC/hoops_gen_ap.xml +++ b/conf/airframes/ENAC/hoops_gen_ap.xml @@ -10,10 +10,8 @@ - - - + diff --git a/conf/airframes/airframe.dtd b/conf/airframes/airframe.dtd index 0749957b89..70551bac10 100644 --- a/conf/airframes/airframe.dtd +++ b/conf/airframes/airframe.dtd @@ -24,8 +24,8 @@ - - + + diff --git a/conf/autopilot/fixedwing_autopilot.xml b/conf/autopilot/fixedwing_autopilot.xml index 94e6869e7a..fd5467949d 100644 --- a/conf/autopilot/fixedwing_autopilot.xml +++ b/conf/autopilot/fixedwing_autopilot.xml @@ -9,78 +9,115 @@ - + + + + + + + + + - - + + + + + + + + + + + + + + + + - + + + + + + - + + + + + - + - + -