diff --git a/conf/airframes/flixr_discovery.xml b/conf/airframes/flixr_discovery.xml index 15e4822406..2f4019f0cc 100644 --- a/conf/airframes/flixr_discovery.xml +++ b/conf/airframes/flixr_discovery.xml @@ -32,6 +32,7 @@ http://paparazzi.enac.fr/w/index.php?title=Theory_of_Operation + diff --git a/conf/autopilot/subsystems/fixedwing/settings_rc.makefile b/conf/autopilot/subsystems/fixedwing/settings_rc.makefile new file mode 100644 index 0000000000..c372f43b17 --- /dev/null +++ b/conf/autopilot/subsystems/fixedwing/settings_rc.makefile @@ -0,0 +1,6 @@ +# Hey Emacs, this is a -*- makefile -*- + +# change settings via Remote Control, e.g. tune your aircraft + +$(TARGET).srcs += rc_settings.c +$(TARGET).CFLAGS += -DRADIO_CONTROL_SETTINGS diff --git a/conf/settings/tuning_ins_rc.xml b/conf/settings/tuning_ins_rc.xml new file mode 100644 index 0000000000..2249537bd2 --- /dev/null +++ b/conf/settings/tuning_ins_rc.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/conf/telemetry/default.xml b/conf/telemetry/default.xml index 33e5b3119c..6cde67ad03 100644 --- a/conf/telemetry/default.xml +++ b/conf/telemetry/default.xml @@ -20,6 +20,7 @@ + diff --git a/conf/telemetry/default_fixedwing_imu.xml b/conf/telemetry/default_fixedwing_imu.xml index 28e3f604b0..f1a70731a9 100644 --- a/conf/telemetry/default_fixedwing_imu.xml +++ b/conf/telemetry/default_fixedwing_imu.xml @@ -20,6 +20,7 @@ + diff --git a/conf/telemetry/default_fixedwing_imu_9k6.xml b/conf/telemetry/default_fixedwing_imu_9k6.xml index 0a0b6c80d9..02087f6deb 100644 --- a/conf/telemetry/default_fixedwing_imu_9k6.xml +++ b/conf/telemetry/default_fixedwing_imu_9k6.xml @@ -20,6 +20,7 @@ + diff --git a/sw/airborne/rc_settings.c b/sw/airborne/rc_settings.c index 91cdc614e7..d64857a4b4 100644 --- a/sw/airborne/rc_settings.c +++ b/sw/airborne/rc_settings.c @@ -25,8 +25,8 @@ #include -#include "rc_settings.h" #include "generated/radio.h" +#include "rc_settings.h" #include "autopilot.h" #include "subsystems/nav.h" #include "subsystems/sensors/infrared.h" diff --git a/sw/airborne/rc_settings.h b/sw/airborne/rc_settings.h index 0cbd78de78..2fd8677e25 100644 --- a/sw/airborne/rc_settings.h +++ b/sw/airborne/rc_settings.h @@ -28,11 +28,8 @@ * * The 'rc_control' section of a XML flight plan allows the user to change the * value of an autopilot internal variable through the rc transmitter. - * C code is generated from this XML code (var/AC/inflight_calib.h). This - * module handles the control of this setting mode. + * This module handles the control of this setting mode. * - * Note that this functionnality is deprecated since datalink use is a lot more - * easier ('dl_settings' section) */ #ifndef RC_SETTINGS_H @@ -46,6 +43,10 @@ #define RC_SETTINGS_MODE_DOWN 1 #define RC_SETTINGS_MODE_UP 2 +extern uint8_t rc_settings_mode; + +void rc_settings(bool_t mode_changed); + #define RcSettingsOff() (rc_settings_mode==RC_SETTINGS_MODE_NONE) #define RC_SETTINGS_MODE_OF_PULSE(pprz) (pprz < TRESHOLD1 ? RC_SETTINGS_MODE_DOWN : \ @@ -55,9 +56,6 @@ #define RcSettingsModeUpdate(_rc_channels) \ ModeUpdate(rc_settings_mode, RC_SETTINGS_MODE_OF_PULSE(_rc_channels[RADIO_CALIB])) -extern uint8_t rc_settings_mode; -void rc_settings(bool_t mode_changed); - #else /* RADIO_CALIB && defined RADIO_CONTROL_SETTINGS */ diff --git a/sw/ground_segment/tmtc/aircraft.ml b/sw/ground_segment/tmtc/aircraft.ml index 773637af6c..b65a7a11f6 100644 --- a/sw/ground_segment/tmtc/aircraft.ml +++ b/sw/ground_segment/tmtc/aircraft.ml @@ -61,6 +61,12 @@ let svinfo_init = fun () -> age = 0 } +type inflight_calib = { + mutable if_mode : int; (* DOWN|OFF|UP *) + mutable if_val1 : float; + mutable if_val2 : float + } + type horiz_mode = Circle of Latlong.geographic * int | Segment of Latlong.geographic * Latlong.geographic @@ -151,7 +157,8 @@ type aircraft = { mutable survey : (Latlong.geographic * Latlong.geographic) option; mutable last_msg_date : float; mutable time_since_last_survey_msg : float; - mutable dist_to_wp : float + mutable dist_to_wp : float; + inflight_calib : inflight_calib } let max_nb_dl_setting_values = 256 (** indexed iwth an uint8 (messages.xml) *) @@ -181,5 +188,6 @@ let new_aircraft = fun id name fp airframe -> horiz_mode = UnknownHorizMode; horizontal_mode = 0; waypoints = Hashtbl.create 3; survey = None; last_msg_date = 0.; dist_to_wp = 0.; - time_since_last_survey_msg = 1729. + time_since_last_survey_msg = 1729.; + inflight_calib = { if_mode = 1 ; if_val1 = 0.; if_val2 = 0.} } diff --git a/sw/ground_segment/tmtc/aircraft.mli b/sw/ground_segment/tmtc/aircraft.mli index 24a810a3e4..236d10ba9b 100644 --- a/sw/ground_segment/tmtc/aircraft.mli +++ b/sw/ground_segment/tmtc/aircraft.mli @@ -30,6 +30,12 @@ type ac_cam = { mutable target : (float * float) (* meter*meter relative *) } +type inflight_calib = { + mutable if_mode : int; + mutable if_val1 : float; + mutable if_val2 : float; + } + type rc_status = string type rc_mode = string type fbw = { mutable rc_status : rc_status; mutable rc_mode : rc_mode; mutable rc_rate : int; mutable pprz_mode_msgs_since_last_fbw_status_msg : int; } @@ -117,7 +123,8 @@ type aircraft = { mutable survey : (Latlong.geographic * Latlong.geographic) option; mutable last_msg_date : float; mutable time_since_last_survey_msg : float; - mutable dist_to_wp : float + mutable dist_to_wp : float; + inflight_calib : inflight_calib } val new_aircraft : string -> string -> Xml.xml -> Xml.xml -> aircraft diff --git a/sw/ground_segment/tmtc/fw_server.ml b/sw/ground_segment/tmtc/fw_server.ml index e03687d8c9..d734a6873e 100644 --- a/sw/ground_segment/tmtc/fw_server.ml +++ b/sw/ground_segment/tmtc/fw_server.ml @@ -206,6 +206,7 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values -> a.gaz_mode <- check_index (ivalue "ap_gaz") gaz_modes "AP_GAZ"; a.lateral_mode <- check_index (ivalue "ap_lateral") lat_modes "AP_LAT"; a.horizontal_mode <- check_index (ivalue "ap_horizontal") horiz_modes "AP_HORIZ"; + a.inflight_calib.if_mode <- check_index (ivalue "if_calib_mode") if_modes "IF_MODE"; let mcu1_status = ivalue "mcu1_status" in (** c.f. link_autopilot.h *) if a.fbw.pprz_mode_msgs_since_last_fbw_status_msg < 10 then @@ -263,6 +264,9 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values -> if !Kml.enabled then Kml.update_horiz_mode a | _ -> () end + | "SETTINGS" -> + a.inflight_calib.if_val1 <- fvalue "slider_1_val"; + a.inflight_calib.if_val2 <- fvalue "slider_2_val"; | "SURVEY" -> begin a.time_since_last_survey_msg <- 0.; diff --git a/sw/ground_segment/tmtc/server.ml b/sw/ground_segment/tmtc/server.ml index c2a1049608..82964a1be8 100644 --- a/sw/ground_segment/tmtc/server.ml +++ b/sw/ground_segment/tmtc/server.ml @@ -182,6 +182,14 @@ let send_cam_status = fun a -> "cam_target_long", Pprz.Float ((Rad>>Deg)twgs84.posn_long)] in Ground_Pprz.message_send my_id "CAM_STATUS" values +let send_if_calib = fun a -> + let if_mode = get_indexed_value if_modes a.inflight_calib.if_mode in + let values = ["ac_id", Pprz.String a.id; + "if_mode", Pprz.String if_mode; + "if_value1", Pprz.Float a.inflight_calib.if_val1; + "if_value2", Pprz.Float a.inflight_calib.if_val2] in + Ground_Pprz.message_send my_id "INFLIGH_CALIB" values + let send_fbw = fun a -> let values = [ "ac_id", Pprz.String a.id; "rc_mode", Pprz.String a.fbw.rc_mode; @@ -384,6 +392,7 @@ let send_aircraft_msg = fun ac -> Ground_Pprz.message_send my_id "AP_STATUS" values; send_cam_status a; + send_if_calib a; send_fbw a; send_svsinfo a; send_horiz_status a; diff --git a/sw/ground_segment/tmtc/server_globals.ml b/sw/ground_segment/tmtc/server_globals.ml index 900e103b01..9eea214c71 100644 --- a/sw/ground_segment/tmtc/server_globals.ml +++ b/sw/ground_segment/tmtc/server_globals.ml @@ -13,6 +13,7 @@ let state_filter_modes = [|"UNKNOWN";"INIT";"ALIGN";"OK";"GPS_LOST";"IMU_LOST";" let _3D = 3 let gps_hybrid_modes = [|"OFF";"ON"|] let horiz_modes = [|"WAYPOINT";"ROUTE";"CIRCLE";"ATTITUDE"|] +let if_modes = [|"OFF";"DOWN";"UP"|] let string_of_values = fun values -> String.concat " " (List.map (fun (_, v) -> Pprz.string_of_value v) values)