mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 23:49:00 +08:00
@@ -32,6 +32,7 @@ http://paparazzi.enac.fr/w/index.php?title=Theory_of_Operation
|
||||
<!-- Communication -->
|
||||
<subsystem name="telemetry" type="transparent"/>
|
||||
<subsystem name="radio_control" type="ppm"/>
|
||||
<!--subsystem name="settings" type="rc"/-->
|
||||
|
||||
<!-- Control -->
|
||||
<subsystem name="control" type="new"/>
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,18 @@
|
||||
<!--<!DOCTYPE settings SYSTEM "settings.dtd">-->
|
||||
|
||||
<!-- A conf to use to tune an A/C using only the rc -->
|
||||
|
||||
<settings>
|
||||
|
||||
<rc_settings>
|
||||
<rc_mode NAME="AUTO1">
|
||||
<rc_setting VAR="ins_pitch_neutral" RANGE="0.2" RC="gain_1_up" TYPE="float"/>
|
||||
<rc_setting VAR="ins_roll_neutral" RANGE="-0.2" RC="gain_1_down" TYPE="float"/>
|
||||
</rc_mode>
|
||||
<rc_mode NAME="AUTO2">
|
||||
<rc_setting VAR="h_ctl_course_pgain" RANGE="0.5" RC="gain_1_up" TYPE="float"/>
|
||||
<rc_setting VAR="flight_altitude" RANGE="-100" RC="gain_1_down" TYPE="float"/>
|
||||
</rc_mode>
|
||||
</rc_settings>
|
||||
|
||||
</settings>
|
||||
@@ -20,6 +20,7 @@
|
||||
<message name="CALIBRATION" period="2.1"/>
|
||||
<message name="NAVIGATION_REF" period="9."/>
|
||||
<message name="PPRZ_MODE" period="5."/>
|
||||
<message name="SETTINGS" period="5."/>
|
||||
<message name="STATE_FILTER_STATUS" period="5."/>
|
||||
<message name="DOWNLINK" period="5.1"/>
|
||||
<message name="DL_VALUE" period="1.5"/>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<message name="CALIBRATION" period="2.1"/>
|
||||
<message name="NAVIGATION_REF" period="9."/>
|
||||
<message name="PPRZ_MODE" period="5."/>
|
||||
<message name="SETTINGS" period="5."/>
|
||||
<message name="STATE_FILTER_STATUS" period="2.2"/>
|
||||
<message name="DOWNLINK" period="5.1"/>
|
||||
<message name="DL_VALUE" period="1.5"/>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<message name="CALIBRATION" period="2.1"/>
|
||||
<message name="NAVIGATION_REF" period="9."/>
|
||||
<message name="PPRZ_MODE" period="5."/>
|
||||
<message name="SETTINGS" period="5."/>
|
||||
<message name="STATE_FILTER_STATUS" period="2.2"/>
|
||||
<message name="DOWNLINK" period="5.1"/>
|
||||
<message name="DL_VALUE" period="1.5"/>
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "rc_settings.h"
|
||||
#include "generated/radio.h"
|
||||
#include "rc_settings.h"
|
||||
#include "autopilot.h"
|
||||
#include "subsystems/nav.h"
|
||||
#include "subsystems/sensors/infrared.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 */
|
||||
|
||||
|
||||
@@ -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.}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user