diff --git a/conf/airframes/OPENUAS/openuas_eflite_t28.xml b/conf/airframes/OPENUAS/openuas_eflite_t28.xml index 36c7dc3e32..cc00855cf9 100644 --- a/conf/airframes/OPENUAS/openuas_eflite_t28.xml +++ b/conf/airframes/OPENUAS/openuas_eflite_t28.xml @@ -7,18 +7,18 @@ E-Flite T28 Trojan fully equiped with Retractable gear and flap + Autopilot: PX4FMU 4.0 aka Pixracer v1.0 + Actuators: Regular digital servos - + GPS: Ublox M8N GNSS - + RCRX: DSMX R110 Receiver - + AIRSPEED: Eagletree via I2C - + TELEMETRY: Si10xx Chip based with custom firmware - + CURRENT: A standard V/I sensor on the analog ports + + GPS: Ublox M8N GNSS + + RCRX: DSMX R110 Receiver + + AIRSPEED: Eagletree via I2C + + TELEMETRY: Si10xx Chip based with custom firmware + + CURRENT: A standard V/I sensor on the analog ports + RANGER: MAXBOTICS LV1 Ultrasonic sensor analog on RSSI pin NOTES: + Using Enahanced Total Energy control as control loop in Final AC + Servo pins point to tail of airframe + Engine battery voltage and amp values via separate sensor - + Flashing the firmware is done via original PX4 bootloader... + + Flashing the firmware is done via original PX4 bootloader... Simple, USB cable in, upload.. voila PPRZ aircraft on a Pixracer... + A GNSS device with ANOTHER magneto on it is used, external... on the board Replaced HMC8853 with HMC8953 to test benefit from temperature compensated values @@ -26,7 +26,7 @@ NOTES: + NO buzzer (yet..) + SD SRTM via onboard storage not implemented (yet..) + NO Sleep mode on (yet..) - + If testing "Classic" (as in not ETECS..) make sure to disable the settings/estimation/ac_char Disable at first no airspeed tests Use also flightplan Versatile if no airspeed sensor is ues and use @@ -36,7 +36,7 @@ NOTES: - + @@ -46,12 +46,12 @@ NOTES: - + - + @@ -63,17 +63,17 @@ NOTES: --> - - + + - - - - + + + + @@ -84,107 +84,111 @@ NOTES: - + - + - + - - + + - + - + - + - + - - + - - + - + - - - + + + - + - + - - + + - - + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -192,21 +196,21 @@ NOTES: - + - - + - + - - - + @@ -283,13 +287,13 @@ NOTES: - - + + - + - - + + - + - + + --> @@ -345,7 +349,7 @@ NOTES: - + - +
@@ -384,7 +388,7 @@ NOTES:
- + @@ -399,7 +403,7 @@ NOTES: - + @@ -414,7 +418,7 @@ NOTES: --> - + - + @@ -442,7 +446,7 @@ NOTES: - + @@ -450,7 +454,7 @@ NOTES: - +
@@ -487,14 +491,14 @@ NOTES: - + - +
- +
@@ -505,18 +509,18 @@ NOTES: --> - + - +
- + --> - +
- @@ -568,21 +572,21 @@ NOTES: - +
- + - + - + @@ -592,7 +596,7 @@ NOTES: - + @@ -602,42 +606,42 @@ NOTES: - + - + - + - - + + - + - + - +
- +
@@ -672,29 +676,29 @@ NOTES:
-
+
- + - + - + - + - + - + - + @@ -707,7 +711,7 @@ NOTES: or fly a long range mission you define the wanted mode behaviour here. If you do not define it, it defaults to flying to the flightplan HOME --> - + @@ -716,21 +720,21 @@ NOTES: -
- +
+ - - + +
- +
- +
@@ -739,7 +743,7 @@ NOTES:
- +
diff --git a/conf/airframes/OPENUAS/openuas_parrot_disco.xml b/conf/airframes/OPENUAS/openuas_parrot_disco.xml index 5e7c53f52b..ced225b1cc 100644 --- a/conf/airframes/OPENUAS/openuas_parrot_disco.xml +++ b/conf/airframes/OPENUAS/openuas_parrot_disco.xml @@ -9,38 +9,36 @@ + GPS: Default uBlox M8N GNSS + AIRSPEED: Default MS4515DO + TELEMETRY: Default WiFi - + CURRENT: Build in current sensing - + RC RX: Added a Spektrum DSMX Orange RX620R Receiver with SBUS out, can be any receiver ofcourse + + CURRENT: Default Build in V/A sensing + + RC RX: Added a Spektrum DSMX Orange R620X Receiver with SBUS out, can be any receiver ofcourse NOTES: - + It flies well but still not all gains are tunde to optimum, WIP - + Hey, calibrate your magneto! Yes, you too ;) - + https://fccid.io/2AG6I-DISCO + + + Hey, calibrate your magneto! Yes, you too ;), unit UKF auto works... + + All kinds of info https://fccid.io/2AG6I-DISCO + Uses PAPARAZZI "standard" radio channel settings, see TU Delft Devo 10 output + One could make a flightplan mimicing exact default behaviour of Parrot assisted flight - + Tested with Firmware v1.4.1 v1.7.0, v1.7.1 - + Can use Enhanced Total Energy Control System as control loop in Final AC, not tuned just yet + + Tested with Firmware v1.7.1, should work on v1.4.1 and v1.7.0 + + Uses Enhanced Total Energy Control System (ETECS) for control + Flash the firmware via WiFi or USB + Enlarged battery bay ,and option fit a 5200 mAh 3S battery. The all-up weight (AUW)) of the airframe will be ~150g more Center of gravity still the same, flighttime doubles... + Regular Telemetry is possible via USB to FTDI serial to Modem, added kernel drivers in another OpenUAS project + Bottom camera can used just for some mapping, not high resolution but still fun... + The Parrot C.H.U.C.K. can be removed and placed in a regular plane also - - ETECS: - If flying "Classic" (as in not ETECS..) make sure to disable the settings/estimation/ac_char - Set the define USE_AIRSPEED should be set to FALSE for the first without airspeed in loop tests - Use also flightplan Versatile if no airspeed sensor is ues and use - flightplan versatile_airspeed only with enabled airspeed sensor + + If you change your control from ETECS to Classic or New make sure to disable the settings/estimation/ac_char + + Added 12c 5200mAh battery, expect flighttimes of 52minutes at 15m/s + + PPRZLink v2 advised for tcas fun WIP: - + The front cam is not yet supported with internal, succes video recording already with and external process - + Sonar needs some TLC and then put to good use, eg, landing + + It flies well, still not all gains are tuned to optimum, feel free to enhance and a PR... + + The front cam is not yet supported with internal code, however successful video recording, streaming already possible with current module + + Sonar needs some TLC and then put to good use e.g. last part of flare in landing + + Investigate effectiveness scheduling for (high)speed adjustments on non transitional fixedwing RC: - The Receiver R620R make sure to set modeswitch to Auto2 on your TX when binding! + The RC receiver Orange R620X make sure to set modeswitch to Auto2 on your TX when binding! else if one would lose RC or switch of transmitter during Auto2 flight, it will hop to manual.. very bad... - This receiver probbably does not set the SBus lost frames bits correctly sadly. Well it is cheap and has diversity A PPM receiver could theoretically be used, only for Linux ARCH no software to handle it is written (hint!) SUMD also. For the PPRZ Spektum could also, but not if you also want to fly it with RC but without PPRZ as AP only original @@ -63,9 +61,18 @@ Motor off in manual mode SW? - + + + + + + @@ -83,16 +90,18 @@ - + + - - - - + + + + + @@ -103,58 +112,63 @@ - - - + + - - + + + + - + - - + + + + + + + + + + - - - + + - - + - - + - + + + + + + - - - - - - - - + @@ -162,13 +176,13 @@ - - + + - + @@ -179,7 +193,7 @@ - @@ -207,26 +221,26 @@ (differential) pressure sensor module publishing the BARO_DIFF ABI message. Make sure to disable other modules which otherwise directly set the airspeed in the state interface. E.g. when using the airspeed_ms45xx.xml module, - define USE_AIRSPEED or USE_AIRSPEED_MS45XX to FALSE. - + define USE_AIRSPEED or USE_AIRSPEED_MS45XX to FALSE only when Airdata is set to TRUE Sometimes one just wants to measure, and not yet use the airspeed in a final navigational solution then also set it to FALSE --> - + - + + - + - + @@ -237,40 +251,47 @@ - - + + + + + + - - + + - + - + + - + + + + - - - - + - + - + + + - + @@ -280,15 +301,29 @@ - - + + - + + + + + + + + + + + + + + @@ -299,20 +334,12 @@ - + - - - + + + + + + --> - + + + + + + + + + + + + + @@ -345,11 +395,24 @@ - - - + + + + +
+ + + + + + + + + + +
@@ -380,19 +443,21 @@ - + + - + + + @@ -407,36 +472,36 @@
- - + +
- +
- - + +
- - + +
- - - + + + - - - + + + @@ -469,12 +534,13 @@ The most crucial part for the magnetometer calibration: + - +
@@ -489,40 +555,49 @@ The most crucial part for the magnetometer calibration:
- +
- - - + + + - - + + - +
- - - + + + +
+ + +
+ + + + + + +
- - - - - + + + - - - + + + - - - - + + + + - - - - - - + + + + + + - +
@@ -571,41 +646,39 @@ The most crucial part for the magnetometer calibration: - - + - - - - - + + + - + - - + + - + + - + - - - - + + + + - + @@ -615,52 +688,51 @@ The most crucial part for the magnetometer calibration: - - - + + + - + - - + + - + - - + + - + - + - + - - - + + - - - + + +
- - - - - - + + + + + +
@@ -677,39 +749,40 @@ The most crucial part for the magnetometer calibration: - +
- + - - - - - - + + + + + + + - - - + + + - + - + - + - + @@ -725,47 +798,38 @@ The most crucial part for the magnetometer calibration:
- - -
- - - - - - - - - -
-
- - - - - - - - + + + + - - - - + + + + + + + + + + +
+
- - + + - +
@@ -801,5 +865,4 @@ The most crucial part for the magnetometer calibration:
- - + \ No newline at end of file diff --git a/conf/flight_plans/OPENUAS/openuas_versatile.xml b/conf/flight_plans/OPENUAS/openuas_versatile.xml index a9a85da2d5..1d9e5b3114 100644 --- a/conf/flight_plans/OPENUAS/openuas_versatile.xml +++ b/conf/flight_plans/OPENUAS/openuas_versatile.xml @@ -1,6 +1,14 @@ +
@@ -31,13 +39,6 @@ #define LINE_STOP_FUNCTION dc_autoshoot = DC_AUTOSHOOT_STOP; #endif -//Enable energy control commands from within flightplan -//Uncomment as needed if ETECS is used -// #include "firmwares/fixedwing/guidance/energy_ctrl.h" - -// States -// #define AircraftIsBooting() LessThan(nav_block,4) // LessThan(nav_block,IndexOfBlock('Mission.ReadyForDeparture')) - #endif
@@ -51,26 +52,25 @@ - + - - - + - - - - + + + + @@ -89,7 +89,7 @@ - + @@ -99,18 +99,18 @@ - + - - - - - + + + + + @@ -119,18 +119,18 @@ - + - + @@ -138,71 +138,67 @@ - - - - + + + + - - - - - + + + + - + - + + + - - - - - + + + + - + - + - - + + - + - + - + - + - - - + + + + + - + @@ -245,21 +241,22 @@ - + - + - + - + + @@ -271,33 +268,33 @@ - + - - + + - - + + - - + + - - + + - + @@ -305,7 +302,7 @@ - + diff --git a/conf/flight_plans/OPENUAS/openuas_versatile_unified.xml b/conf/flight_plans/OPENUAS/openuas_versatile_unified.xml new file mode 100644 index 0000000000..abcc2e19d5 --- /dev/null +++ b/conf/flight_plans/OPENUAS/openuas_versatile_unified.xml @@ -0,0 +1,402 @@ + + + + + +
+ +#ifndef FLIGHTPLAN_HEADER_DEFINES +#define FLIGHTPLAN_HEADER_DEFINES + +//Set Generic options + #include "autopilot.h" +//Enable AHRS Health test functions + #include "subsystems/ahrs/ahrs_aligner.h" +//Enable advanced electrical power functions + #include "subsystems/electrical.h" +//Enable datalink tests + #include "subsystems/datalink/datalink.h" + +// PHOTOGRAMMETRY settings + #define PHOTOGRAMMETRY_OVERLAP 30 // 1-99 Procent + #define PHOTOGRAMMETRY_SIDELAP 20 // 1-99 Procent + #define PHOTOGRAMMETRY_RESOLUTION 50 // mm pixel projection size + +// Include airframe.h To be able to use specific variables + #include "generated/airframe.h" + +// Extras for Photoscan + #ifdef DC_AUTOSHOOT_PERIOD + //TODO make shooting distance not periodic + #define LINE_START_FUNCTION dc_autoshoot = DC_AUTOSHOOT_PERIODIC; + #define LINE_STOP_FUNCTION dc_autoshoot = DC_AUTOSHOOT_STOP; + #endif + +#endif + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/conf/gcs/OPENUAS/openuas_bottom_settings.xml b/conf/gcs/OPENUAS/openuas_bottom_settings.xml new file mode 100644 index 0000000000..9f6b15b26b --- /dev/null +++ b/conf/gcs/OPENUAS/openuas_bottom_settings.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/gcs/OPENUAS/openuas_horizontal.xml b/conf/gcs/OPENUAS/openuas_horizontal.xml new file mode 100644 index 0000000000..481da975cd --- /dev/null +++ b/conf/gcs/OPENUAS/openuas_horizontal.xml @@ -0,0 +1,18 @@ + + + + + " + + + + + + + + + + + + + diff --git a/conf/gcs/OPENUAS/openuas_papgets.xml b/conf/gcs/OPENUAS/openuas_papgets.xml index 5c2eb1c29b..19101ef7de 100644 --- a/conf/gcs/OPENUAS/openuas_papgets.xml +++ b/conf/gcs/OPENUAS/openuas_papgets.xml @@ -60,6 +60,11 @@ + + " + + + diff --git a/conf/gcs/OPENUAS/openuas_video.xml b/conf/gcs/OPENUAS/openuas_video.xml new file mode 100644 index 0000000000..14e9ab980f --- /dev/null +++ b/conf/gcs/OPENUAS/openuas_video.xml @@ -0,0 +1,20 @@ + + + + + + " + + + + + + + + + + + + + + diff --git a/conf/modules/dc_ctrl_parrot_mykonos.xml b/conf/modules/dc_ctrl_parrot_mykonos.xml new file mode 100644 index 0000000000..70caaec830 --- /dev/null +++ b/conf/modules/dc_ctrl_parrot_mykonos.xml @@ -0,0 +1,61 @@ + + + + + Control the Parrot Bebop, Bebop2 and Disco cameras via native Parrot IMaging Process(PIMP). + It can trigger photos based on distance, time or circle radius in both fixedwings and rotorcraft. + One can start to record onboard videos and start and stop streaming of live video. + Show it in your GCS via mplayer plugin or e.g. + gst-launch-1.0 udpsrc port=55004 ! "application/x-rtp, payload=96" ! rtph264depay ! avdec_h264 ! autovideosink + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + digital_cam,digital_cam_servo,digital_cam_i2co,digital_cam_i2c,digital_cam_video +
+ + +
+ + + + + + + + + + + + +
diff --git a/conf/modules/flight_benchmark.xml b/conf/modules/flight_benchmark.xml index d561af883d..96a5da09b8 100644 --- a/conf/modules/flight_benchmark.xml +++ b/conf/modules/flight_benchmark.xml @@ -3,16 +3,16 @@ -Flight benchmark. -This module allows a quantitative assessment of the flight. It calculates the sum of squared error of the two-dimensional course (x / y), the altitude and true airspeed. The sum of squared error of the course and altitude were separated, because they are regulated separately, and so they dependent on various parameters. The module was written to optimize the control parameters and has already been used successfully. +Flight benchmark for fixedwing. +This module allows a quantitative assessment of a flight. It calculates the sum of squared error of the two-dimensional course (x / y), the altitude and true airspeed. The sum of squared error of the course and altitude were separated, because they are regulated separately, and so they dependent on various parameters. The module was written to optimize the control parameters and has already been used successfully. -The measurement is not started until about the variable benchm_go is set to 1. +The measurement is not started until about the variable benchm_go is set to 1. Could also be set from within a flightplan for automated Becnhmarking. -The sum of squared error can by reseted by changing the boolean variable benchm_reset to zero (will turn back to 1 automatically after it has done the reset). This can also be used in a flight plan, which allows a flight plan with auto-reset. So it is possible to fly an oval or a eight figure with a sum of squared error that will be reseted at the very same point of the figure. +The sum of squared error can by reseted by changing the boolean variable benchm_reset to zero. It will turn back to 1 automatically after it has done the reset). This can also be used in a flight plan, which allows a flight plan with auto-reset. So it is possible to fly an oval or a eight figure with a sum of squared error that will be reseted at the very same point of the figure. - - - + + + diff --git a/conf/telemetry/OPENUAS/openuas_fixedwing_imu.xml b/conf/telemetry/OPENUAS/openuas_fixedwing_imu.xml index 9d6bedf063..6d9228ae7d 100644 --- a/conf/telemetry/OPENUAS/openuas_fixedwing_imu.xml +++ b/conf/telemetry/OPENUAS/openuas_fixedwing_imu.xml @@ -4,6 +4,7 @@ + @@ -34,7 +35,7 @@ - + @@ -61,12 +62,14 @@ + + diff --git a/conf/userconf/OPENUAS/openuas_conf.xml b/conf/userconf/OPENUAS/openuas_conf.xml index 3e129b7260..7e72a6138e 100644 --- a/conf/userconf/OPENUAS/openuas_conf.xml +++ b/conf/userconf/OPENUAS/openuas_conf.xml @@ -5,11 +5,11 @@ airframe="airframes/OPENUAS/openuas_parrot_disco.xml" radio="radios/OPENUAS/openuas_sbus_out.xml" telemetry="telemetry/OPENUAS/openuas_fixedwing_imu.xml" - flight_plan="flight_plans/OPENUAS/openuas_versatile.xml" - settings="settings/fixedwing_basic.xml" - settings_modules="modules/digital_cam_video.xml modules/video_capture.xml modules/photogrammetry_calculator.xml modules/nav_smooth.xml modules/nav_survey_poly_osam.xml modules/geo_mag.xml modules/air_data.xml modules/nav_basic_fw.xml modules/guidance_full_pid_fw.xml modules/stabilization_adaptive_fw.xml modules/ahrs_float_cmpl_quat.xml modules/ahrs_int_cmpl_quat.xml modules/gps.xml modules/flight_benchmark.xml modules/airspeed_ms45xx_i2c.xml modules/gps_ubx_ucenter.xml modules/imu_common.xml" + flight_plan="flight_plans/OPENUAS/openuas_versatile_unified.xml" + settings="settings/fixedwing_basic.xml settings/control/ctl_energyadaptive.xml settings/estimation/ac_char.xml settings/control/ctl_adaptive_h_ff.xml" + settings_modules="modules/digital_cam_video.xml modules/dc_ctrl_parrot_mykonos.xml modules/video_capture.xml modules/photogrammetry_calculator.xml modules/nav_smooth.xml modules/nav_survey_poly_osam.xml modules/geo_mag.xml modules/air_data.xml modules/nav_basic_fw.xml modules/guidance_energy.xml modules/stabilization_adaptive_fw.xml modules/ahrs_float_cmpl_quat.xml modules/tune_airspeed.xml modules/ahrs_int_cmpl_quat.xml modules/gps.xml modules/airspeed_ms45xx_i2c.xml modules/gps_ubx_ucenter.xml modules/imu_common.xml" gui_color="#f39cf39cf39c" - release="5a6b25fcd07ac1277f008c15ae3aef71870e9ce4" + release="8e50f043b163f2b838dadaf1740a3e17b292505b" /> diff --git a/conf/userconf/OPENUAS/openuas_control_panel.xml b/conf/userconf/OPENUAS/openuas_control_panel.xml index 0e847490d4..d2e0da1c62 100644 --- a/conf/userconf/OPENUAS/openuas_control_panel.xml +++ b/conf/userconf/OPENUAS/openuas_control_panel.xml @@ -23,7 +23,6 @@ - @@ -37,14 +36,8 @@ - - - - - - - - + + @@ -66,20 +59,6 @@
- - - - - - - - - - - - - - @@ -123,32 +102,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -213,59 +166,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -290,35 +194,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -329,20 +204,6 @@ - - - - - - - - - - - - - - @@ -389,74 +250,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - + @@ -484,26 +284,10 @@ - - - - - - - - - - - - - - - - - + @@ -584,9 +368,6 @@ - - - @@ -603,59 +384,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -664,7 +392,7 @@ - + diff --git a/sw/airborne/boards/bebop.h b/sw/airborne/boards/bebop.h index 4ade6fc957..06ceb261b9 100644 --- a/sw/airborne/boards/bebop.h +++ b/sw/airborne/boards/bebop.h @@ -31,9 +31,24 @@ /** uart connected to GPS internally */ #define UART1_DEV /dev/ttyPA1 + #define GPS_UBX_ENABLE_NMEA_DATA_MASK 0xff -/** FTDI cable for stereoboard or external GPS */ + +/** For using serial devices via USB to serial converter electronics + * E.g. a XBee modem, a 3DR radio modem, Serial Stereocam etc. etc. + */ +#ifndef UART2_DEV #define UART2_DEV /dev/ttyUSB0 +#endif +#ifndef UART4_DEV +#define UART4_DEV /dev/ttyUSB1 +#endif +#ifndef UART5_DEV +#define UART5_DEV /dev/ttyACM0 +#endif +#ifndef UART6_DEV +#define UART6_DEV /dev/ttyACM1 +#endif /* Default actuators driver */ #define DEFAULT_ACTUATORS "boards/bebop/actuators.h" diff --git a/sw/airborne/boards/disco.h b/sw/airborne/boards/disco.h index ba6cde4631..4a9968d773 100644 --- a/sw/airborne/boards/disco.h +++ b/sw/airborne/boards/disco.h @@ -31,13 +31,31 @@ #include "boards/bebop/mt9f002.h" -/** uart connected to GPS internally */ +/** UART connected to GPS internally */ #define UART1_DEV /dev/ttyPA1 + #define GPS_UBX_ENABLE_NMEA_DATA_MASK 0xff -/** FTDI cable for stereoboard or external GPS */ + +/** For using serial devices via USB to serial converter electronics + * E.g. a XBee modem, a 3DR radio modem, Serial Stereocam etc. etc. + */ +#ifndef UART2_DEV #define UART2_DEV /dev/ttyUSB0 +#endif +#ifndef UART4_DEV +#define UART4_DEV /dev/ttyUSB1 +#endif +#ifndef UART5_DEV +#define UART5_DEV /dev/ttyACM0 +#endif +#ifndef UART6_DEV +#define UART6_DEV /dev/ttyACM1 +#endif + /** uart connected to SBUS input */ +#ifndef UART3_DEV #define UART3_DEV /dev/uart-sbus +#endif /* Default actuators driver */ #define DEFAULT_ACTUATORS "boards/disco/actuators.h" @@ -79,8 +97,14 @@ struct mt9f002_t mt9f002; #define MS45XX_OUTPUT_TYPE 1 #define MS45XX_PRESSURE_OUTPUT_TYPE_InH2O 1 #define MS45XX_AIRSPEED_SCALE 1.6327 +#ifndef USE_AIRSPEED_LOWPASS_FILTER #define USE_AIRSPEED_LOWPASS_FILTER 1 +#endif +//#if USE_AIRSPEED_LOWPASS_FILTER +#ifndef MS45XX_LOWPASS_TAU #define MS45XX_LOWPASS_TAU 0.15 +#endif +//#endif /* To be flexible and be able to disable use of airspeed in state this could have been in the airframe file ofcourse * but most users just want to have perfectly flying Disco, so enable per default... */ diff --git a/sw/airborne/firmwares/fixedwing/guidance/energy_ctrl.c b/sw/airborne/firmwares/fixedwing/guidance/energy_ctrl.c index abd5cbd14d..0012608a98 100644 --- a/sw/airborne/firmwares/fixedwing/guidance/energy_ctrl.c +++ b/sw/airborne/firmwares/fixedwing/guidance/energy_ctrl.c @@ -132,6 +132,7 @@ pprz_t v_ctl_throttle_setpoint; pprz_t v_ctl_throttle_slewed; float v_ctl_pitch_setpoint; +uint8_t v_ctl_speed_mode; //To be compatible with universal flightplan, not used for etecs static struct FloatQuat imu_to_body_quat; static struct Int32Vect3 accel_imu_meas; @@ -143,7 +144,7 @@ static abi_event body_to_imu_ev; ///////////// DEFAULT SETTINGS //////////////// #ifndef V_CTL_ALTITUDE_MAX_CLIMB #define V_CTL_ALTITUDE_MAX_CLIMB 2; -INFO("V_CTL_ALTITUDE_MAX_CLIMB not defined - default is 2m/s") +INFO("V_CTL_ALTITUDE_MAX_CLIMB not defined - default is 2 , indicating 2 m/s") #endif #ifndef STALL_AIRSPEED INFO("No STALL_AIRSPEED defined. Using NOMINAL_AIRSPEED") @@ -157,7 +158,7 @@ INFO("V_CTL_GLIDE_RATIO not defined - default is 8.") #define AIRSPEED_SETPOINT_SLEW 1 #endif #ifndef V_CTL_MAX_ACCELERATION -#define V_CTL_MAX_ACCELERATION 0.5 +#define V_CTL_MAX_ACCELERATION 0.5 //G #endif #ifndef V_CTL_ENERGY_IMU_ID @@ -217,6 +218,7 @@ void v_ctl_init(void) { /* mode */ v_ctl_mode = V_CTL_MODE_MANUAL; + v_ctl_speed_mode = V_CTL_SPEED_THROTTLE; //There is only one, added here to be universal in flightplan for different control modes /* outer loop */ v_ctl_altitude_setpoint = 0.; diff --git a/sw/airborne/firmwares/fixedwing/guidance/energy_ctrl.h b/sw/airborne/firmwares/fixedwing/guidance/energy_ctrl.h index 18bb371888..ccf68f293d 100644 --- a/sw/airborne/firmwares/fixedwing/guidance/energy_ctrl.h +++ b/sw/airborne/firmwares/fixedwing/guidance/energy_ctrl.h @@ -30,6 +30,15 @@ #include "firmwares/fixedwing/guidance/guidance_common.h" +//To be unified with control NEW, these can be used in a unified flightplan +//but ETECS has no use of it ofcourse, speed mode always V_CTL_SPEED_AIRSPEED +//FIXME An idea to move it to guidance_common +#define V_CTL_SPEED_THROTTLE 0 +#define V_CTL_SPEED_AIRSPEED 1 +#define V_CTL_SPEED_GROUNDSPEED 2 + +extern uint8_t v_ctl_speed_mode; + /* outer loop */ // extern float v_ctl_altitude_error; ///< in meters, (setpoint - alt) -> positive = too low extern float v_ctl_altitude_setpoint; ///< in meters above MSL diff --git a/sw/airborne/modules/benchmark/flight_benchmark.c b/sw/airborne/modules/benchmark/flight_benchmark.c index 24b9e6b5e5..39d6e3c654 100644 --- a/sw/airborne/modules/benchmark/flight_benchmark.c +++ b/sw/airborne/modules/benchmark/flight_benchmark.c @@ -18,8 +18,6 @@ // For Downlink - - float SquareSumErr_airspeed; float SquareSumErr_altitude; float SquareSumErr_position; @@ -29,11 +27,8 @@ float TolerancePosition; bool benchm_reset; bool benchm_go; - //uint8_t numOfCount; - - void flight_benchmark_init(void) { SquareSumErr_airspeed = 0; diff --git a/sw/airborne/modules/digital_cam/dc_ctrl_parrot_mykonos.c b/sw/airborne/modules/digital_cam/dc_ctrl_parrot_mykonos.c new file mode 100644 index 0000000000..140873041f --- /dev/null +++ b/sw/airborne/modules/digital_cam/dc_ctrl_parrot_mykonos.c @@ -0,0 +1,311 @@ +/* + * Copyright (C) 2018 OpenUAS + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +/** + * NOTES: For now only the front cam is used, feel free to extend. + * Reason is that bottom_cam is normally in use for mapping or Optic flow and the like. + * See: https://github.com/Parrot-Developers/disco-opensource/ + */ + +#include "modules/digital_cam/dc_ctrl_parrot_mykonos.h" +#include "generated/modules.h" +#include "generated/airframe.h" +#include "mcu_periph/sys_time.h" +// Include Standard Camera Control Interface +#include "modules/digital_cam/dc.h" + +/** Time in seconds to start/stop recording or take a picture */ +#define DC_CTRL_PARROT_MYKONOS_RECORD_DELAY 0.05 + +/** delay in milli-seconds before logging after a shot in ms */ +#define DC_CTRL_PARROT_MYKONOS_LOG_DELAY 50 + +/** Get timer from delay based on periodic freq from modules.h */ +#define DC_CTRL_PARROT_MYKONOS_TIMER_OF_DELAY(_delay) ((uint32_t)(_delay * DC_CTRL_PARROT_MYKONOS_PERIODIC_FREQ)) + +/** autoshoot timer delay based on periodic freq from modules.h */ +#ifndef DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_DELAY +#define DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_DELAY 5.0 +#endif +#define DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_TIMER_OF_DELAY(_delay) ((uint32_t)(_delay * DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_FREQ)) + +/** Send report */ +#if DC_CTRL_PARROT_MYKONOS_SYNC_SEND + +#include "pprzlink/messages.h" +#include "subsystems/datalink/downlink.h" +#include "state.h" +#include "subsystems/gps.h" + +#include "subsystems/datalink/telemetry.h" //? or just downlink.h should be enough + +static inline void dc_ctrl_parrot_mykonos_send_shot_position(void) +{ + // angles in decideg + int16_t phi = DegOfRad(stateGetNedToBodyEulers_f()->phi * 10.0f); + int16_t theta = DegOfRad(stateGetNedToBodyEulers_f()->theta * 10.0f); + int16_t psi = DegOfRad(stateGetNedToBodyEulers_f()->psi * 10.0f); + // course in decideg + int16_t course = DegOfRad(stateGetHorizontalSpeedDir_f()) * 10; + // ground speed in cm/s + uint16_t speed = stateGetHorizontalSpeedNorm_f() * 10; + + DOWNLINK_SEND_DC_SHOT(DefaultChannel, DefaultDevice, + &dc_ctrl_parrot_mykonos.photo_nr, + &stateGetPositionLla_i()->lat, + &stateGetPositionLla_i()->lon, + &stateGetPositionLla_i()->alt, + &gps.hmsl, + &phi, + &theta, + &psi, + &course, + &speed, + &gps.tow); +} +#endif + + +/* + The pimpctl command is available per default on a Disco and can be used for + triggering various camera related tasks: + + Possible arguments for pimpctl command + list-cameras = print the list of available cameras + stream-start front
= start streaming video + stream-stop front = stop streaming video + take-picture = ehh, take a photo indeed + recording-start = start recording video + recording-stop = stop recording video + set-controller = set a new camera controller + 0 -> USER FLAT (yaw axis is free) + 1 -> USER ABSOLUTE (fully stabilized) + 2 -> USER FPV (fixed relatively to the drone)) + 3 -> AUTOPILOT + cam-orientation

= set camera orientation (in degree CCW) + y -> yaw pitch rotatio (psi euler angle) + p -> pitch rotation (theta euler angle) + r -> roll rotation (phi euler angle) +*/ + +#if DC_CTRL_PARROT_MYKONOS_LOG +#include "state.h" +#include "subsystems/gps.h" +#endif + +struct Dc_Ctrl_Parrot_Mykonos dc_ctrl_parrot_mykonos; + +void dc_ctrl_parrot_mykonos_init(void) +{ + // Call common DC init + dc_init(); + + dc_ctrl_parrot_mykonos.status = DC_CTRL_PARROT_MYKONOS_NONE; + dc_ctrl_parrot_mykonos.timer = 0; + dc_ctrl_parrot_mykonos.photo_nr = 0; + dc_ctrl_parrot_mykonos.autoshoot = 0; + dc_ctrl_parrot_mykonos.log_delay = 0; + +#ifndef SITL + int ret __attribute__((unused)); + //ret = system("kk"); //No need kill original AP proceess since new AP is already running and that killed original process + + //TIP: With media-ctl much more can be done for the parameters of the camera only basics are set. + ret = system("media-ctl -l \'\"mt9f002 0-0010\":0->\"avicam.0\":0[1]\'"); + ret = system("media-ctl -l \'\"avicam_dummy_dev.0\":0->\"avicam.0\":0[0]\'");//No bottomcam, used internaly in AP + + ret = system("prestart dxowrapperd"); + ret = system("prestart pimp"); // pimp = Parrot IMaging Process + //ret = system("pimpctl list-cameras"); //TODO look for 1 or more then define a variable to use or not +#if DC_CTRL_PARROT_MYKONOS_STREAM_AT_STARTUP + dc_ctrl_parrot_mykonos_command(DC_CTRL_PARROT_MYKONOS_STREAM_START); +#endif + +#else + //Start your local processes so simulated flight with sim shooting can be perfromed + //E.g. using a tile map interface of a pre-recorded stream or a 3D generated image + //FIXME: make a complete example, he, it's opensouce and involves your work indeed... + //ret = system("whateveryouwantotstartlocallyaddithere"); +#endif +} + +void dc_ctrl_parrot_mykonos_periodic(void) +{ + //Nice 'n ugly use of True/False + if (dc_ctrl_parrot_mykonos.timer) { + dc_ctrl_parrot_mykonos.timer--; + } else { + dc_ctrl_parrot_mykonos_command(DC_CTRL_PARROT_MYKONOS_SHOOT); + } + // test log delay if set + if (dc_ctrl_parrot_mykonos.log_delay) { +#ifndef SITL + if (get_sys_time_msec() > dc_ctrl_parrot_mykonos.log_delay) { //FIXME: Could also happen in SITL... +#endif +#if DC_CTRL_PARROT_MYKONOS_LOG + dc_ctrl_parrot_mykonos_log_shot_position(); +#endif + +#if DC_CTRL_PARROT_MYKONOS_SYNC_SEND + dc_ctrl_parrot_mykonos_send_shot_position(); +#endif + // increment photo number + dc_ctrl_parrot_mykonos.photo_nr++; + // unset log delay + dc_ctrl_parrot_mykonos.log_delay = 0; +#ifndef SITL + } +#endif + } + + // Common DC Periodic task + dc_periodic(); +} + +//FIXME muiltiple cams and same DC cam API do no go together, +// so for the time being not used here, also one needs to add SITL options + +/* Command the Camera + * Intermidate function so the universal PPRZ Camra API can be used + * No need to change flightplan, script or otherwhise + * should work on both Fixedwing and Rotorcraft +*/ + +#ifdef SITL +void dc_send_command(uint8_t cmd) +{ + //Nothing yet, empty framework here so sim compiles + switch (cmd) { + default: + break; + } +} +#endif + + +/* Execute the Shoot, Record and Stream commands */ +void dc_ctrl_parrot_mykonos_command(enum dc_ctrl_parrot_mykonos_status cmd) +{ + int ret __attribute__((unused)); + + dc_ctrl_parrot_mykonos.status = cmd; + switch (cmd) { + case DC_CTRL_PARROT_MYKONOS_RECORD_START: +#ifndef SITL + ret = system("pimpctl recording-start front"); +#else + //ret = system("addyourlocalsitlcommandshere"); +#endif + break; + case DC_CTRL_PARROT_MYKONOS_RECORD_STOP: + dc_ctrl_parrot_mykonos.timer = DC_CTRL_PARROT_MYKONOS_TIMER_OF_DELAY(DC_CTRL_PARROT_MYKONOS_RECORD_DELAY); +#ifndef SITL + ret = system("pimpctl recording-stop front"); +#else + //ret = system("addyourlocalsitlcommandshere"); +#endif + break; + case DC_CTRL_PARROT_MYKONOS_SHOOT: +#ifndef SITL + ret = system("pimpctl take-picture front"); +#else + //ret = system("addyourlocalsitlcommandshere"); +#endif + + break; + case DC_CTRL_PARROT_MYKONOS_STREAM_START: + /* + * Note that while .0 as destination IP works multicasting it introduces latency. + To avoid this use the real target IP of the video viewer device e.g. the GCS + quick and dirty; get ip from latest lease: ./data/lib/misc/dhcp_eth0.leases + and look for the name of your host you want to target. + + TIP: Example to view stream on Host PC: + + gst-launch-1.0 udpsrc port=55004 ! "application/x-rtp, payload=96" ! rtph264depay ! avdec_h264 ! autovideosink + + But there are many ways to Rome... + + */ +#ifndef SITL + ret = system("pimpctl stream-start front 192.168.42.0 55004");//FIXME: Option to target only IP, for less delay +#else +//ret = system("addyourlocalsitlcommandshere"); +#endif + break; + case DC_CTRL_PARROT_MYKONOS_STREAM_STOP: +#ifndef SITL + ret = system("pimpctl stream-stop front 192.168.42.0 55004"); +#else +//ret = system("addyourlocalsitlcommandshere"); +#endif + break; + case DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_START: + dc_ctrl_parrot_mykonos.timer = DC_CTRL_PARROT_MYKONOS_TIMER_OF_DELAY(DC_CTRL_PARROT_MYKONOS_RECORD_DELAY); +#ifndef SITL + ret = system("pimpctl take-picture front"); +#else +//ret = system("addyourlocalsitlcommandshere"); +#endif + dc_ctrl_parrot_mykonos.log_delay = get_sys_time_msec() + DC_CTRL_PARROT_MYKONOS_LOG_DELAY; + dc_ctrl_parrot_mykonos.last_shot_pos = *stateGetPositionEnu_f(); + break; + case DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_STOP: + //nix + break; + default: + break; + } +} + +void dc_ctrl_parrot_mykonos_autoshoot(void) +{ +// Wait a minimum time between two shots + if (dc_ctrl_parrot_mykonos.autoshoot) { + dc_ctrl_parrot_mykonos.autoshoot--; + } else { + // test distance if needed + // or take picture if first of the sequence +#ifdef DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_DIST + struct EnuCoor_f pos = *stateGetPositionEnu_f(); + struct FloatVect2 d_pos; + d_pos.x = pos.x - dc_ctrl_parrot_mykonos.last_shot_pos.x; + d_pos.y = pos.y - dc_ctrl_parrot_mykonos.last_shot_pos.y; + if (VECT2_NORM2(d_pos) > (DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_DIST * DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_DIST) + || dc_ctrl_parrot_mykonos.status == DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_START) { +#endif + // take a picture + dc_ctrl_parrot_mykonos_command(DC_CTRL_PARROT_MYKONOS_SHOOT); + // reset timer + dc_ctrl_parrot_mykonos.autoshoot = DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_TIMER_OF_DELAY(DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_DELAY); +#ifdef DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_DIST + } +#endif + } +} + +void dc_ctrl_parrot_mykonos_autoshoot_start(void) +{ + // Start taking a picture immediately + dc_ctrl_parrot_mykonos.autoshoot = 0; + dc_ctrl_parrot_mykonos.status = DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_START; +} diff --git a/sw/airborne/modules/digital_cam/dc_ctrl_parrot_mykonos.h b/sw/airborne/modules/digital_cam/dc_ctrl_parrot_mykonos.h new file mode 100644 index 0000000000..8961e2018c --- /dev/null +++ b/sw/airborne/modules/digital_cam/dc_ctrl_parrot_mykonos.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2018 OpenUAS + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + + +/** @file modules/digital_cam/dc_ctrl_parrot_mykonos.h + * @brief Digital video/photo recorder control for Parrot Mykonos Platform, + * For others that is: control the camera of the Disco and if one manages to + * add pimpctl onto a Bebop or Bebop2, should work also on those + * + * Provides the control of the Camera start and stop of video recording, + * Taking photos and switch video streaming on and off + * This module starts the camera in standby mode and triggers starting + * of recording or take a picture. + * Minimum time between two pictures is 1 second. + * + */ + +#ifndef DC_CTRL_PARROT_MYKONOS_H +#define DC_CTRL_PARROT_MYKONOS_H + +#include "std.h" +#include "math/pprz_geodetic_float.h" + +// Include Standard Camera Control Interface +// Note: Standard DC nneds to be unified and enhance for multicam support +#include "dc.h" + +#include BOARD_CONFIG + +enum dc_ctrl_parrot_mykonos_status { + DC_CTRL_PARROT_MYKONOS_NONE, + DC_CTRL_PARROT_MYKONOS_RECORD_START, + DC_CTRL_PARROT_MYKONOS_RECORD_STOP, + DC_CTRL_PARROT_MYKONOS_SHOOT, + DC_CTRL_PARROT_MYKONOS_STREAM_START, + DC_CTRL_PARROT_MYKONOS_STREAM_STOP, + DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_START, + DC_CTRL_PARROT_MYKONOS_AUTOSHOOT_STOP +}; + +struct Dc_Ctrl_Parrot_Mykonos { + enum dc_ctrl_parrot_mykonos_status status; + uint32_t timer; + int16_t photo_nr; + uint32_t autoshoot; + struct EnuCoor_f last_shot_pos; + uint32_t log_delay; +}; + +extern struct Dc_Ctrl_Parrot_Mykonos dc_ctrl_parrot_mykonos; + +extern void dc_ctrl_parrot_mykonos_init(void); +extern void dc_ctrl_parrot_mykonos_periodic(void); +extern void dc_ctrl_parrot_mykonos_autoshoot(void); +extern void dc_ctrl_parrot_mykonos_autoshoot_start(void); +extern void dc_ctrl_parrot_mykonos_command(enum dc_ctrl_parrot_mykonos_status cmd); + +// macro for setting handler +#define dc_ctrl_parrot_mykonos_SendCmd(cmd) dc_ctrl_parrot_mykonos_command(cmd) + +#endif // DC_CTRL_PARROT_MYKONOS_H diff --git a/sw/airborne/modules/nav/takeoff_detect.c b/sw/airborne/modules/nav/takeoff_detect.c index 67c2257d9f..8066bd0f08 100644 --- a/sw/airborne/modules/nav/takeoff_detect.c +++ b/sw/airborne/modules/nav/takeoff_detect.c @@ -87,11 +87,19 @@ void takeoff_detect_periodic(void) // Run detection state machine here switch (takeoff_detect.state) { case TO_DETECT_ARMED: - // test for "nose up" + AP in AUTO2 (+ GPS OK ? FIXME) - if (stateGetNedToBodyEulers_f()->theta > TAKEOFF_DETECT_LAUNCH_PITCH - && autopilot_get_mode() == AP_MODE_AUTO2) { + // test for "nose up" + AP in AUTO2, optionally AUTO1 not default since risky if one does not know what it does + if (stateGetNedToBodyEulers_f()->theta > TAKEOFF_DETECT_LAUNCH_PITCH) + { +#ifndef TAKEOFF_DETECT_ALSO_IN_AUTO1 + if (autopilot_get_mode() != AP_MODE_AUTO2) +#else + if ((autopilot_get_mode() != AP_MODE_AUTO2) || (autopilot_get_mode() != AP_MODE_AUTO1)) +#endif + { takeoff_detect.timer++; - } else { + } + } + else { // else reset timer takeoff_detect.timer = 0; } @@ -102,13 +110,21 @@ void takeoff_detect_periodic(void) takeoff_detect.timer = 0; } break; + case TO_DETECT_LAUNCHING: // abort if pitch goes below threshold while launching - if (stateGetNedToBodyEulers_f()->theta < TAKEOFF_DETECT_ABORT_PITCH - || autopilot_get_mode() != AP_MODE_AUTO2) { - // back to ARMED state - autopilot.launch = false; - takeoff_detect.state = TO_DETECT_ARMED; + if (stateGetNedToBodyEulers_f()->theta < TAKEOFF_DETECT_ABORT_PITCH) + { +#ifndef TAKEOFF_DETECT_ALSO_IN_AUTO1 + if (autopilot_get_mode() != AP_MODE_AUTO2) +#else + if ((autopilot_get_mode() != AP_MODE_AUTO2) || (autopilot_get_mode() != AP_MODE_AUTO1)) +#endif + { + // back to ARMED state + autopilot.launch = false; + takeoff_detect.state = TO_DETECT_ARMED; + } } // increment timer and disable detection after some time takeoff_detect.timer++; @@ -116,10 +132,12 @@ void takeoff_detect_periodic(void) takeoff_detect.state = TO_DETECT_DISABLED; } break; + case TO_DETECT_DISABLED: // stop periodic call takeoff_detect_takeoff_detect_periodic_status = MODULES_STOP; break; + default: // No kidding ?! takeoff_detect.state = TO_DETECT_DISABLED; diff --git a/sw/airborne/modules/sonar/sonar_bebop.c b/sw/airborne/modules/sonar/sonar_bebop.c index 428b488e10..46bd39c282 100644 --- a/sw/airborne/modules/sonar/sonar_bebop.c +++ b/sw/airborne/modules/sonar/sonar_bebop.c @@ -38,7 +38,7 @@ #include "mcu_periph/spi.h" #include "subsystems/abi.h" #include -#include "subsystems/datalink/downlink.h" +#include "subsystems/datalink/downlink.h"//FIXME, include only when link need #include "filters/median_filter.h" diff --git a/sw/airborne/subsystems/ahrs/ahrs_aligner.c b/sw/airborne/subsystems/ahrs/ahrs_aligner.c index de8dfcc221..1b0919523a 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_aligner.c +++ b/sw/airborne/subsystems/ahrs/ahrs_aligner.c @@ -36,12 +36,14 @@ struct AhrsAligner ahrs_aligner; -#define SAMPLES_NB 100 +#ifndef AHRS_ALIGNER_SAMPLES_NB +#define AHRS_ALIGNER_SAMPLES_NB 100 +#endif static struct Int32Rates gyro_sum; static struct Int32Vect3 accel_sum; static struct Int32Vect3 mag_sum; -static int32_t ref_sensor_samples[SAMPLES_NB]; +static int32_t ref_sensor_samples[AHRS_ALIGNER_SAMPLES_NB]; static uint32_t samples_idx; #ifndef AHRS_ALIGNER_IMU_ID @@ -117,25 +119,25 @@ void ahrs_aligner_run(void) RunOnceEvery(50, {LED_TOGGLE(AHRS_ALIGNER_LED);}); #endif - if (samples_idx >= SAMPLES_NB) { + if (samples_idx >= AHRS_ALIGNER_SAMPLES_NB) { int32_t avg_ref_sensor = accel_sum.z; if (avg_ref_sensor >= 0) { - avg_ref_sensor += SAMPLES_NB / 2; + avg_ref_sensor += AHRS_ALIGNER_SAMPLES_NB / 2; } else { - avg_ref_sensor -= SAMPLES_NB / 2; + avg_ref_sensor -= AHRS_ALIGNER_SAMPLES_NB / 2; } - avg_ref_sensor /= SAMPLES_NB; + avg_ref_sensor /= AHRS_ALIGNER_SAMPLES_NB; ahrs_aligner.noise = 0; int i; - for (i = 0; i < SAMPLES_NB; i++) { + for (i = 0; i < AHRS_ALIGNER_SAMPLES_NB; i++) { int32_t diff = ref_sensor_samples[i] - avg_ref_sensor; ahrs_aligner.noise += abs(diff); } - RATES_SDIV(ahrs_aligner.lp_gyro, gyro_sum, SAMPLES_NB); - VECT3_SDIV(ahrs_aligner.lp_accel, accel_sum, SAMPLES_NB); - VECT3_SDIV(ahrs_aligner.lp_mag, mag_sum, SAMPLES_NB); + RATES_SDIV(ahrs_aligner.lp_gyro, gyro_sum, AHRS_ALIGNER_SAMPLES_NB); + VECT3_SDIV(ahrs_aligner.lp_accel, accel_sum, AHRS_ALIGNER_SAMPLES_NB); + VECT3_SDIV(ahrs_aligner.lp_mag, mag_sum, AHRS_ALIGNER_SAMPLES_NB); INT_RATES_ZERO(gyro_sum); INT_VECT3_ZERO(accel_sum); diff --git a/sw/airborne/subsystems/imu/imu_disco.c b/sw/airborne/subsystems/imu/imu_disco.c index 626d004201..25f75a1398 100644 --- a/sw/airborne/subsystems/imu/imu_disco.c +++ b/sw/airborne/subsystems/imu/imu_disco.c @@ -81,7 +81,7 @@ void imu_disco_init(void) /** * Handle all the periodic tasks of the Disco IMU components. - * Read the MPU60x0 every periodic call and the HMC58XX every 10th call. + * Read the MPU60x0 every periodic call and the AKM8963 every 10th call. */ void imu_disco_periodic(void) { diff --git a/sw/airborne/subsystems/radio_control/spektrum_radio.h b/sw/airborne/subsystems/radio_control/spektrum_radio.h index 0a3af0b489..50dac64118 100644 --- a/sw/airborne/subsystems/radio_control/spektrum_radio.h +++ b/sw/airborne/subsystems/radio_control/spektrum_radio.h @@ -28,16 +28,16 @@ #ifndef RADIO_CONTROL_SPEKTRUM_RADIO_H #define RADIO_CONTROL_SPEKTRUM_RADIO_H -/* Amount of spektrum channels */ +/* Amount of Spektrum channels */ #ifndef RADIO_CONTROL_NB_CHANNEL #define RADIO_CONTROL_NB_CHANNEL 14 #endif #if RADIO_CONTROL_NB_CHANNEL > 14 -#error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than 14." +#error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than 14. X-Plus channel expansion is not (yet) usable" #endif -/* default channel assignments */ +/* Default channel assignments */ #ifndef RADIO_THROTTLE #define RADIO_THROTTLE 0 #endif @@ -50,19 +50,41 @@ #ifndef RADIO_YAW #define RADIO_YAW 3 #endif +#ifndef RADIO_GEAR #define RADIO_GEAR 4 +#endif +#ifndef RADIO_FLAP #define RADIO_FLAP 5 +#endif +#ifndef RADIO_AUX1 #define RADIO_AUX1 5 +#endif +#ifndef RADIO_AUX2 #define RADIO_AUX2 6 +#endif +#ifndef RADIO_AUX3 #define RADIO_AUX3 7 +#endif +#ifndef RADIO_AUX4 #define RADIO_AUX4 8 +#endif +#ifndef RADIO_AUX5 #define RADIO_AUX5 9 +#endif +#ifndef RADIO_AUX6 #define RADIO_AUX6 10 +#endif +#ifndef RADIO_AUX7 #define RADIO_AUX7 11 +#endif +#ifndef RADIO_AUX8 #define RADIO_AUX8 12 +#endif +#ifndef RADIO_AUX9 #define RADIO_AUX9 13 +#endif -/* Default Mode channel is GEAR (number 5) */ +/* Default Mode channel is GEAR */ #ifndef RADIO_MODE #define RADIO_MODE RADIO_GEAR #endif @@ -71,7 +93,7 @@ #ifndef RADIO_CONTROL_SPEKTRUM_SIGNS // #ifdef RADIO_CONTROL_SPEKTRUM_OLD_SIGNS -#define RADIO_CONTROL_SPEKTRUM_SIGNS {1,-1,-1,-1,1,-1,1,1,1,1,1,1,1,1} // As most transmitters are sold +#define RADIO_CONTROL_SPEKTRUM_SIGNS {1,-1,-1,-1,1,-1,1,1,1,1,1,1,1,1} // As most transmitters are sold and set per default #else #define RADIO_CONTROL_SPEKTRUM_SIGNS {1,1,1,1,1,1,1,1,1,1,1,1,1,1} // PPRZ sign convention #endif diff --git a/sw/airborne/subsystems/radio_control/superbitrf_rc.h b/sw/airborne/subsystems/radio_control/superbitrf_rc.h index ae91df2f52..448a7cd24c 100644 --- a/sw/airborne/subsystems/radio_control/superbitrf_rc.h +++ b/sw/airborne/subsystems/radio_control/superbitrf_rc.h @@ -34,25 +34,55 @@ #endif #if RADIO_CONTROL_NB_CHANNEL > 14 -#error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than 14." +#error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than 14. X-Plus channel expansion is not (yet) usable" #endif -/* The channel ordering is always the same for DSM2 and DSMX */ +/* Default channel assignments */ +#ifndef RADIO_THROTTLE #define RADIO_THROTTLE 0 +#endif +#ifndef RADIO_ROLL #define RADIO_ROLL 1 +#endif +#ifndef RADIO_PITCH #define RADIO_PITCH 2 +#endif +#ifndef RADIO_YAW #define RADIO_YAW 3 +#endif +#ifndef RADIO_GEAR #define RADIO_GEAR 4 +#endif +#ifndef RADIO_FLAP #define RADIO_FLAP 5 +#endif +#ifndef RADIO_AUX1 #define RADIO_AUX1 5 +#endif +#ifndef RADIO_AUX2 #define RADIO_AUX2 6 +#endif +#ifndef RADIO_AUX3 #define RADIO_AUX3 7 +#endif +#ifndef RADIO_AUX4 #define RADIO_AUX4 8 +#endif +#ifndef RADIO_AUX5 #define RADIO_AUX5 9 +#endif +#ifndef RADIO_AUX6 #define RADIO_AUX6 10 +#endif +#ifndef RADIO_AUX7 #define RADIO_AUX7 11 +#endif +#ifndef RADIO_AUX8 #define RADIO_AUX8 12 +#endif +#ifndef RADIO_AUX9 #define RADIO_AUX9 13 +#endif /* Map the MODE default to the gear switch */ #ifndef RADIO_MODE diff --git a/sw/tools/parrot/parrot_utils.py b/sw/tools/parrot/parrot_utils.py index 6c2ae8af99..daae1b63c2 100644 --- a/sw/tools/parrot/parrot_utils.py +++ b/sw/tools/parrot/parrot_utils.py @@ -109,7 +109,9 @@ class ParrotUtils: print('Could not connect to the ' + self.uav_name + ' (address: ' + self.address + ')') print('Check if the ' + self.uav_name + ' is turned on and the computer is connected over wifi or bluetooth.') if self.address == '192.168.42.1': - print("If you are using Bebop 1 or 2, don't forget pressing the power button 4 times after the Bebop has booted!") + print("If you are using Bebop 1 or 2, don't forget pressing the power button 4 times after the Bebop has booted!\n") + print("And if using Disco pressing the power button 2 times after aircraft powerup.") + print("Or run the buttonpress script to get rid of this buttonpress annoyance.") exit(2) # Close the telnet and ftp @@ -274,7 +276,7 @@ class ParrotUtils: if ((not v == ParrotVersion('0.0.0.0')) and ((v < ParrotVersion(min_ver)) or (v > ParrotVersion(max_ver)))): print("Error: please upgrade your " + self.uav_name + " firmware to version between " + min_ver + " and " + max_ver + "!") return - + f = self.split_into_path_and_file(name) # Upload the file