diff --git a/conf/airframes/OPENUAS/openuas_parrot_disco.xml b/conf/airframes/OPENUAS/openuas_parrot_disco.xml
index e3506b962f..5e7c53f52b 100644
--- a/conf/airframes/OPENUAS/openuas_parrot_disco.xml
+++ b/conf/airframes/OPENUAS/openuas_parrot_disco.xml
@@ -1,67 +1,95 @@
-
-* in Fixedwing (https://www.openuas.org/airframes/)
+
+* Parrot Disco Fixedwing (https://www.openuas.org/airframes/)
+ Airframe to validate all onboard functionally...
Parrot Disco
- + Autopilot: Parrot C.H.U.C.K.
- + Actuators: Default Discon servos
+ + Autopilot: Default Parrot C.H.U.C.K.
+ + Actuators: Default Disco servos
+ GPS: Default uBlox M8N GNSS
- + RC RX: Spektrum DSMX RX620R Receiver with SBUS out
- + AIRSPEED: Default
- + TELEMETRY: Default Wifi
- + CURRENT: ? V/I sensor?
+ + 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
NOTES:
- + The first config will mimic the Exact Parrot Flight Envelope
- Later on the maximum performance option will be added
- and different setting if 5200mAh (heavier) battery is used (330g)
- + There will be a flightplan mimicing exact default behaviour of Parrot assisted flight
- (Or better, create one for the PPRZ team and make everyone happy)
- + WARNING: This config is NOT tested in flight and NOT tuned yet
- + Testing with Firmware v1.4.1 (and v1.3.0 before)
- + Using Enahanced Total Energy control as control loop in Final AC
- + Flashing the firmware via WiFi or USB
- + Enlarged Battery Bay to fir a 5200 mAh 3S battery
- This makes the airframe heavier, in the end we'll use adaptive etecs
- + Regular Telemetry is possible via USB to FTDI serial to Modem
+ + 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
+ + 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
+ + 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
- If testing "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
+ 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
- FIXME magneto 90Deg off in X/Y
-
+ 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
+
+ RC:
+ The Receiver R620R 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
+ since Spektrum serial is not handled by the Parrot main AP
+
+ The setup ot Transmitter is in such a way that one could fly without PPRC just Parrot with a 3rd party transmitter
+ Thus modeswitch on 5 for well.. mode
+
+ TX Channel Nr Function Control type Comments
+ 1 Roll Stick
+ 2 Pitch Stick
+ 3 Throttle Stick
+ 4 Yaw Stick Used to set the Disco in loiter
+ 5 Gear 3-position switch Used to configure the piloting mode:
+ Auto-pilot with Parrot SkyController2 (Risky so better limit this one exept if you teaching people to fly with Skycontroller student AND RCTX for teacher )
+ Auto-pilot with RC controller
+ Full manual with RC controller
+ 6 Automatic Take-off/Landing 2-position trainer switch Used in “Auto-pilot with RC controller” mode
+ Start: SWx Landing: SWy
+ Motor off in manual mode SW?
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
-
-
+
+
-
+
@@ -71,90 +99,123 @@
-
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
-
+
+
+
-
+
+
-
-
+
+
+
+
-
+
+
-
+
-
+
+
+
+
+
@@ -164,69 +225,54 @@
-
+
+
-
-
-
+
+
-
+
-
+
-
+
-
-
-
-
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
+
-
-
-
+
+
+
@@ -234,217 +280,247 @@
-
-
+
+
-
-
+
-
-
+
-
+
+
-
+
+
+
+
+
+
-
+
-
+
-
+
-
-
-
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
-
-
-
+
+
-
-
-
+
-
-
-
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
+
+
-
-
+
+
https://github.com/paparazzi/paparazzi/blob/master/sw/airborne/modules/nav.c#L132
-->
-
+
-
-
-
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
-
+
-
+
-
+
@@ -503,27 +579,27 @@ AFS_SEL=3 2,048 LSB/g-->
-
-
-
+
+
+
-
+
-
+
-
+
-
+
@@ -531,12 +607,12 @@ AFS_SEL=3 2,048 LSB/g-->
-
-
+
+
-
-
+
+
@@ -556,8 +632,8 @@ AFS_SEL=3 2,048 LSB/g-->
-
-
+
+
@@ -568,7 +644,7 @@ AFS_SEL=3 2,048 LSB/g-->
-
+
@@ -577,59 +653,63 @@ AFS_SEL=3 2,048 LSB/g-->
-
+
-
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
-
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
@@ -637,51 +717,88 @@ AFS_SEL=3 2,048 LSB/g-->
-
+
-
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
diff --git a/conf/boards/disco.makefile b/conf/boards/disco.makefile
index aaec6e5a59..1a642d2e1d 100644
--- a/conf/boards/disco.makefile
+++ b/conf/boards/disco.makefile
@@ -53,8 +53,8 @@ $(TARGET).LDFLAGS += -static
# -----------------------------------------------------------------------
# default LED configuration
-RADIO_CONTROL_LED ?= none
-BARO_LED ?= none
-AHRS_ALIGNER_LED ?= none
-GPS_LED ?= none
-SYS_TIME_LED ?= none
+RADIO_CONTROL_LED ?= none
+BARO_LED ?= none
+AHRS_ALIGNER_LED ?= none
+GPS_LED ?= none
+SYS_TIME_LED ?= none
diff --git a/conf/flight_plans/OPENUAS/openuas_versatile.xml b/conf/flight_plans/OPENUAS/openuas_versatile.xml
new file mode 100644
index 0000000000..a9a85da2d5
--- /dev/null
+++ b/conf/flight_plans/OPENUAS/openuas_versatile.xml
@@ -0,0 +1,334 @@
+
+
+
+
+
+
+#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
+
+// Incluse airframe.h To be able to use specific variables
+ #include "generated/airframe.h"
+
+// Completly replace with onboard recon copmpter interface
+ #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
+
+//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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/airspeed_ms45xx_i2c.xml b/conf/modules/airspeed_ms45xx_i2c.xml
index 4413565da2..cb695820e3 100644
--- a/conf/modules/airspeed_ms45xx_i2c.xml
+++ b/conf/modules/airspeed_ms45xx_i2c.xml
@@ -3,20 +3,21 @@
- MS45XX differential pressure/airspeed sensor.
- Airspeed sensor module using the MS45xxDO digital pressure sensor via I2C.
- Needs one of the differential versions with 14bit pressure and 11bit temperature.
+ MS45XX differential or gauge type of pressure sensor for e.g measuring airspeed.
+ This sensor module is using the MS45xxDO digital pressure sensor with readings via I2C.
+ Needs to be a versions with 14bit pressure and 11bit temperature data output.
-
+
+
-
+
@@ -24,6 +25,7 @@
+
diff --git a/conf/radios/OPENUAS/openuas_sbus_out.xml b/conf/radios/OPENUAS/openuas_sbus_out.xml
new file mode 100644
index 0000000000..709c162afa
--- /dev/null
+++ b/conf/radios/OPENUAS/openuas_sbus_out.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/telemetry/OPENUAS/openuas_fixedwing_imu.xml b/conf/telemetry/OPENUAS/openuas_fixedwing_imu.xml
index 22d7efd9ef..9d6bedf063 100644
--- a/conf/telemetry/OPENUAS/openuas_fixedwing_imu.xml
+++ b/conf/telemetry/OPENUAS/openuas_fixedwing_imu.xml
@@ -3,33 +3,38 @@
-
-
+
+
+
-
+
-
-
+
+
-
-
-
-
+
+
-
-
+
+
+
-
+
-
-
+
-
-
-
+
+
+
+
+
+
+
+
+
@@ -46,10 +51,9 @@
-
+
-
-
+
@@ -62,7 +66,7 @@
-
+
@@ -70,13 +74,14 @@
+
-
-
-
+
+
+
@@ -88,7 +93,7 @@
-
+
diff --git a/conf/userconf/OPENUAS/openuas_conf.xml b/conf/userconf/OPENUAS/openuas_conf.xml
index fa58924f0a..3e129b7260 100644
--- a/conf/userconf/OPENUAS/openuas_conf.xml
+++ b/conf/userconf/OPENUAS/openuas_conf.xml
@@ -3,12 +3,13 @@
name="Disco"
ac_id="241"
airframe="airframes/OPENUAS/openuas_parrot_disco.xml"
- radio="radios/spektrum.xml"
- telemetry="telemetry/default_fixedwing_imu.xml"
- flight_plan="flight_plans/versatile.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_rtp_stream.xml modules/video_capture.xml modules/nav_smooth.xml modules/nav_survey_poly_osam.xml modules/geo_mag.xml modules/air_data.xml modules/gps.xml modules/nav_basic_fw.xml modules/guidance_full_pid_fw.xml modules/stabilization_adaptive_fw.xml modules/ahrs_float_cmpl_quat.xml modules/tune_airspeed.xml modules/airspeed_ms45xx_i2c.xml modules/imu_common.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"
gui_color="#f39cf39cf39c"
+ release="5a6b25fcd07ac1277f008c15ae3aef71870e9ce4"
/>
-
@@ -639,5 +638,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/sw/airborne/arch/sim/max1167_hw.c b/sw/airborne/arch/sim/max1167_hw.c
index 2494b0aad0..31219f983d 100644
--- a/sw/airborne/arch/sim/max1167_hw.c
+++ b/sw/airborne/arch/sim/max1167_hw.c
@@ -20,7 +20,7 @@
*
*/
-#include "max1167.h"
+#include "max1167_hw.h"
#include "subsystems/imu.h"
diff --git a/sw/airborne/boards/bebop/actuators.c b/sw/airborne/boards/bebop/actuators.c
index 6e9d69b020..0f98deeb76 100644
--- a/sw/airborne/boards/bebop/actuators.c
+++ b/sw/airborne/boards/bebop/actuators.c
@@ -121,7 +121,7 @@ void actuators_bebop_commit(void)
actuators_bebop.i2c_trans.buf[6] = actuators_bebop.rpm_ref[2] & 0xFF;
actuators_bebop.i2c_trans.buf[7] = actuators_bebop.rpm_ref[3] >> 8;
actuators_bebop.i2c_trans.buf[8] = actuators_bebop.rpm_ref[3] & 0xFF;
- actuators_bebop.i2c_trans.buf[9] = 0x00; //UNK?
+ actuators_bebop.i2c_trans.buf[9] = 0x00; //UNK enable security?
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-qual"
actuators_bebop.i2c_trans.buf[10] = actuators_bebop_checksum((uint8_t *)actuators_bebop.i2c_trans.buf, 9);
diff --git a/sw/airborne/boards/bebop/mt9v117.c b/sw/airborne/boards/bebop/mt9v117.c
index 05ca256898..833945a6e4 100644
--- a/sw/airborne/boards/bebop/mt9v117.c
+++ b/sw/airborne/boards/bebop/mt9v117.c
@@ -442,6 +442,7 @@ void mt9v117_init(struct mt9v117_t *mt)
}
// Successfully configured!
+ //printf("[MT9V117] Switching config OK\r\n");
return;
}
}
diff --git a/sw/airborne/boards/disco.h b/sw/airborne/boards/disco.h
index e77509400d..ba6cde4631 100644
--- a/sw/airborne/boards/disco.h
+++ b/sw/airborne/boards/disco.h
@@ -26,9 +26,11 @@
#include "std.h"
#include "peripherals/video_device.h"
-// reuse bebop video driver
+// re-use the Parrot Bebop video drivers
+#include "boards/bebop/mt9v117.h"
#include "boards/bebop/mt9f002.h"
+
/** uart connected to GPS internally */
#define UART1_DEV /dev/ttyPA1
#define GPS_UBX_ENABLE_NMEA_DATA_MASK 0xff
@@ -70,4 +72,20 @@ struct mt9f002_t mt9f002;
#define SPI0_MAX_SPEED_HZ 320000
#endif
+/* Configuration values of airspeed sensor onboard the Parrot Disco C.H.U.C.K */
+#define MS45XX_I2C_DEV i2c1
+#define MS45XX_PRESSURE_RANGE 4
+#define MS45XX_PRESSURE_TYPE 1
+#define MS45XX_OUTPUT_TYPE 1
+#define MS45XX_PRESSURE_OUTPUT_TYPE_InH2O 1
+#define MS45XX_AIRSPEED_SCALE 1.6327
+#define USE_AIRSPEED_LOWPASS_FILTER 1
+#define MS45XX_LOWPASS_TAU 0.15
+
+/* 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... */
+#ifndef USE_AIRSPEED
+#define USE_AIRSPEED 1
+#endif
+
#endif /* CONFIG_DISCO */
diff --git a/sw/airborne/boards/disco/actuators.c b/sw/airborne/boards/disco/actuators.c
index ca911f540a..6e74f6bae7 100644
--- a/sw/airborne/boards/disco/actuators.c
+++ b/sw/airborne/boards/disco/actuators.c
@@ -22,9 +22,9 @@
/**
* @file boards/disco/actuators.c
- * Actuator driver for the disco
+ * Actuator driver for the Parrot Disco
*
- * Disco plane is using the same ESC (I2C) than bebop for its motor
+ * Disco plane is using the same ESC (I2C) as a Parrot Bebop for its motor
* and Pwm_sysfs linux driver for the PWM outputs
*
* Some part of this code is coming from the APM Disco and Bebop drivers
@@ -114,7 +114,7 @@ void actuators_disco_commit(void)
// Receive the status
actuators_disco.i2c_trans.buf[0] = ACTUATORS_DISCO_GET_OBS_DATA;
- i2c_transceive(&i2c1, &actuators_disco.i2c_trans, actuators_disco.i2c_trans.slave_addr, 1, sizeof(obs_data));
+ i2c_blocking_transceive(&i2c1, &actuators_disco.i2c_trans, actuators_disco.i2c_trans.slave_addr, 1, sizeof(obs_data));
// copy data from buffer
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-qual"
@@ -135,26 +135,26 @@ void actuators_disco_commit(void)
// When detected a suicide
uint8_t bldc_status = obs_data.status & 0x07;
if (obs_data.error == 2 && bldc_status != DISCO_BLDC_STATUS_STOPPED) {
- autopilot_set_kill_throttle(true);
+ autopilot_set_kill_throttle(true); //FIXME: make behaviour definable low flying should not stop it
}
// Start the motors
if (bldc_status != DISCO_BLDC_STATUS_RUNNING &&
- bldc_status != DISCO_BLDC_STATUS_RAMPUP &&
+ bldc_status != DISCO_BLDC_STATUS_RAMPUP && //FIXME also on rampdown?
actuators_disco.motor_rpm > DISCO_BLDC_START_MOTOR_THRESHOLD) {
// Reset the error
actuators_disco.i2c_trans.buf[0] = ACTUATORS_DISCO_CLEAR_ERROR;
- i2c_transmit(&i2c1, &actuators_disco.i2c_trans, actuators_disco.i2c_trans.slave_addr, 1);
+ i2c_blocking_transmit(&i2c1, &actuators_disco.i2c_trans, actuators_disco.i2c_trans.slave_addr, 1);
// Start the motors
actuators_disco.i2c_trans.buf[0] = ACTUATORS_DISCO_START_PROP;
- i2c_transmit(&i2c1, &actuators_disco.i2c_trans, actuators_disco.i2c_trans.slave_addr, 1);
+ i2c_blocking_transmit(&i2c1, &actuators_disco.i2c_trans, actuators_disco.i2c_trans.slave_addr, 1);
}
// Stop the motors
else if ((bldc_status == DISCO_BLDC_STATUS_RUNNING || bldc_status == DISCO_BLDC_STATUS_RAMPUP) &&
actuators_disco.motor_rpm < DISCO_BLDC_START_MOTOR_THRESHOLD) {
actuators_disco.i2c_trans.buf[0] = ACTUATORS_DISCO_STOP_PROP;
- i2c_transmit(&i2c1, &actuators_disco.i2c_trans, actuators_disco.i2c_trans.slave_addr, 1);
+ i2c_blocking_transmit(&i2c1, &actuators_disco.i2c_trans, actuators_disco.i2c_trans.slave_addr, 1);
} else if (bldc_status == DISCO_BLDC_STATUS_RUNNING) {
// Send the commands
actuators_disco.i2c_trans.buf[0] = ACTUATORS_DISCO_SET_REF_SPEED;
@@ -165,11 +165,11 @@ void actuators_disco_commit(void)
#pragma GCC diagnostic ignored "-Wcast-qual"
actuators_disco.i2c_trans.buf[4] = actuators_disco_checksum((uint8_t *)actuators_disco.i2c_trans.buf, 3);
#pragma GCC diagnostic pop
- i2c_transmit(&i2c1, &actuators_disco.i2c_trans, actuators_disco.i2c_trans.slave_addr, 11);
+ i2c_blocking_transmit(&i2c1, &actuators_disco.i2c_trans, actuators_disco.i2c_trans.slave_addr, 11);
}
// Send ABI message
- AbiSendMsgRPM(RPM_SENSOR_ID, &actuators_disco.rpm_obs, 1);
+ AbiSendMsgRPM(RPM_SENSOR_ID, &actuators_disco.rpm_obs, 1);//FIXME & or not
}
static uint8_t actuators_disco_checksum(uint8_t *bytes, uint8_t size)
@@ -178,6 +178,6 @@ static uint8_t actuators_disco_checksum(uint8_t *bytes, uint8_t size)
for (int i = 0; i < size; i++) {
checksum = checksum ^ bytes[i];
}
+
return checksum;
}
-
diff --git a/sw/airborne/boards/disco/actuators.h b/sw/airborne/boards/disco/actuators.h
index 6c1ecb90cb..9e05754080 100644
--- a/sw/airborne/boards/disco/actuators.h
+++ b/sw/airborne/boards/disco/actuators.h
@@ -52,7 +52,7 @@
#define ACTUATORS_DISCO_MOTOR_IDX 0 ///< Index for motor BLDC
struct ActuatorsDisco {
- struct i2c_transaction i2c_trans; ///< I2C transaction for communicating with the bebop BLDC driver
+ struct i2c_transaction i2c_trans; ///< I2C transaction for communicating with the Disco BLDC driver
uint16_t motor_rpm; ///< Motor RPM setpoint
uint16_t rpm_obs; ///< Measured RPM
struct PWM_Sysfs pwm[ACTUATORS_DISCO_PWM_NB]; ///< Array of PWM outputs
diff --git a/sw/airborne/boards/disco/baro_board.h b/sw/airborne/boards/disco/baro_board.h
index 73eac26d66..aaae478913 100644
--- a/sw/airborne/boards/disco/baro_board.h
+++ b/sw/airborne/boards/disco/baro_board.h
@@ -1,6 +1,5 @@
/*
- * Copyright (C) 2014 Freek van Tienen
- * Copyright (C) 2017 Gautier Hattenberger
+ * Copyright (C) 2018 OpenUAS
*
* This file is part of Paparazzi.
*
diff --git a/sw/airborne/boards/disco/board.c b/sw/airborne/boards/disco/board.c
index efb1f958cb..512121a302 100644
--- a/sw/airborne/boards/disco/board.c
+++ b/sw/airborne/boards/disco/board.c
@@ -73,10 +73,10 @@ struct mt9f002_t mt9f002 = {
static int kill_gracefull(char *process_name)
{
- /* "pidof" always in /bin on Bebop firmware tested 1.98, 2.0.57, no need for "which" */
+ /* TODO: "pidof" always in /bin on Disco firmware tested 1.4.1, no need for "which" */
char pidof_commandline[200] = "/bin/pidof ";
strcat(pidof_commandline, process_name);
- /* Bebop Busybox a
+ /* On Disco Busybox a
$ cat /proc/sys/kernel/pid_max
Gives max 32768, makes sure it never kills existing other process
*/
@@ -126,14 +126,15 @@ void board_init(void)
void board_init2(void)
{
- /* Initialize MT9V117 chipset (Bottom camera) */
- //struct mt9v117_t mt9v117 = {
- // // Initial values
+ /* Initialize MT9V117 chipset (Bottom camera) */
+ struct mt9v117_t mt9v117 = {
+ // Initial values
- // // I2C connection port
- // .i2c_periph = &i2c0
- //};
- //mt9v117_init(&mt9v117);
+ // I2C connection port
+ .i2c_periph = &i2c0
+ };
+ mt9v117_init(&mt9v117);
- //mt9f002_init(&mt9f002);
+ /* Initialize Front camera) */
+ //WIP mt9f002_init(&mt9f002);
}
diff --git a/sw/airborne/modules/loggers/file_logger.c b/sw/airborne/modules/loggers/file_logger.c
index 9939a259ed..a27dea9f6e 100644
--- a/sw/airborne/modules/loggers/file_logger.c
+++ b/sw/airborne/modules/loggers/file_logger.c
@@ -32,7 +32,13 @@
#include "std.h"
#include "subsystems/imu.h"
+#ifdef COMMAND_THRUST
#include "firmwares/rotorcraft/stabilization.h"
+#else
+#include "firmwares/fixedwing/stabilization/stabilization_attitude.h"
+#include "firmwares/fixedwing/stabilization/stabilization_adaptive.h"
+#endif
+
#include "state.h"
/** Set the default File logger path to the USB drive */
@@ -79,7 +85,13 @@ void file_logger_start(void)
if (file_logger != NULL) {
fprintf(
file_logger,
+
+ //rotorcraft uses COMMAND_THRUST, fixedwing COMMAND_THROTTLE at this time
+#ifdef COMMAND_THRUST
"counter,gyro_unscaled_p,gyro_unscaled_q,gyro_unscaled_r,accel_unscaled_x,accel_unscaled_y,accel_unscaled_z,mag_unscaled_x,mag_unscaled_y,mag_unscaled_z,COMMAND_THRUST,COMMAND_ROLL,COMMAND_PITCH,COMMAND_YAW,qi,qx,qy,qz\n"
+#else
+ "counter,gyro_unscaled_p,gyro_unscaled_q,gyro_unscaled_r,accel_unscaled_x,accel_unscaled_y,accel_unscaled_z,mag_unscaled_x,mag_unscaled_y,mag_unscaled_z, h_ctl_aileron_setpoint, h_ctl_elevator_setpoint, qi,qx,qy,qz\n"
+#endif
);
}
}
@@ -93,7 +105,8 @@ void file_logger_stop(void)
}
}
-/** Log the values to a csv file */
+/** Log the values to a csv file */
+/** Change the Variable that you are interested in here */
void file_logger_periodic(void)
{
if (file_logger == NULL) {
@@ -102,6 +115,7 @@ void file_logger_periodic(void)
static uint32_t counter;
struct Int32Quat *quat = stateGetNedToBodyQuat_i();
+#ifdef COMMAND_THRUST //For example rotorcraft
fprintf(file_logger, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
counter,
imu.gyro_unscaled.p,
@@ -122,5 +136,26 @@ void file_logger_periodic(void)
quat->qy,
quat->qz
);
+#else
+ fprintf(file_logger, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
+ counter,
+ imu.gyro_unscaled.p,
+ imu.gyro_unscaled.q,
+ imu.gyro_unscaled.r,
+ imu.accel_unscaled.x,
+ imu.accel_unscaled.y,
+ imu.accel_unscaled.z,
+ imu.mag_unscaled.x,
+ imu.mag_unscaled.y,
+ imu.mag_unscaled.z,
+ h_ctl_aileron_setpoint,
+ h_ctl_elevator_setpoint,
+ quat->qi,
+ quat->qx,
+ quat->qy,
+ quat->qz
+ );
+#endif
+
counter++;
}
diff --git a/sw/airborne/modules/sensors/airspeed_ms45xx_i2c.c b/sw/airborne/modules/sensors/airspeed_ms45xx_i2c.c
index 576c0407fc..27f6c24b67 100644
--- a/sw/airborne/modules/sensors/airspeed_ms45xx_i2c.c
+++ b/sw/airborne/modules/sensors/airspeed_ms45xx_i2c.c
@@ -22,7 +22,7 @@
/** @file modules/sensors/airspeed_ms45xx_i2c.c
* Airspeed sensor module using the MS45xxDO digital pressure sensor via I2C.
- * Needs one of the differential versions with 14bit pressure and 11bit temperature.
+ * Needs to be one of the versions with 14bit pressure and 11bit temperature.
*/
#include "std.h"
@@ -42,7 +42,7 @@
#ifndef USE_AIRSPEED_MS45XX
#if USE_AIRSPEED
#define USE_AIRSPEED_MS45XX TRUE
-PRINT_CONFIG_MSG("USE_AIRSPEED_MS45XX automatically set to TRUE")
+PRINT_CONFIG_MSG("USE_AIRSPEED_MS45XX set to TRUE since this is set USE_AIRSPEED")
#endif
#endif
@@ -56,19 +56,32 @@ PRINT_CONFIG_MSG("USE_AIRSPEED_MS45XX automatically set to TRUE")
#define MS45XX_I2C_DEV i2c2
#endif
-/** Sensor I2C slave address (defaults 0x50, 0x6C and 0x8C) */
+/** Sensor I2C slave address (existing defaults 0x50, 0x6C and 0x8C)
+ */
#ifndef MS45XX_I2C_ADDR
#define MS45XX_I2C_ADDR 0x50
#endif
-/** MS45xx pressure range in psi.
- * The sensor is available in 1, 2, 5, 15, 30, 50, 100, 150 psi ranges.
- * 1 psi max range should be ~100m/s max airspeed.
+/** MS45xx sensors pressure output type can be in PSI or InH2O, as defined in the datasheet
+ * if not defined to be MS45XX_PRESSURE_OUTPUT_TYPE_InH2O then PSI is used
+ * */
+#ifndef MS45XX_PRESSURE_OUTPUT_TYPE_InH2O
+#define MS45XX_PRESSURE_OUTPUT_TYPE_InH2O 1
+#endif
+
+/** MS45xx pressure range in PSI or InH2O
+ * The sensor is available in many ranges, the datasheet of your pressure sensor will tell which one
+ * and what this range represents
*/
#ifndef MS45XX_PRESSURE_RANGE
#define MS45XX_PRESSURE_RANGE 1
#endif
+/* Pressure Type 0 = Differential, 1 = Gauge , note there are theoretical more types than 2, e.g. Absolute not implemented */
+#ifndef MS45XX_PRESSURE_TYPE
+#define MS45XX_PRESSURE_TYPE 0
+#endif
+
/** MS45xx output Type.
* 0 = Output Type A with 10% to 90%
* 1 = Output Type B with 5% to 95%
@@ -77,9 +90,18 @@ PRINT_CONFIG_MSG("USE_AIRSPEED_MS45XX automatically set to TRUE")
#define MS45XX_OUTPUT_TYPE 0
#endif
+/** Conversion factor from InH2O to Pa */
+#define InH2O_TO_PA 249.08891
+
/** Conversion factor from psi to Pa */
#define PSI_TO_PA 6894.75729
+#ifdef MS45XX_PRESSURE_OUTPUT_TYPE_InH2O
+#define OutputPressureToPa InH2O_TO_PA
+#else
+#define OutputPressureToPa PSI_TO_PA
+#endif
+
#if MS45XX_OUTPUT_TYPE == 0
/* Offset and scaling for OUTPUT TYPE A:
* p_raw = (0.8*16383)/ (Pmax - Pmin) * (pressure - Pmin) + 0.1*16383
@@ -92,31 +114,31 @@ PRINT_CONFIG_MSG("USE_AIRSPEED_MS45XX automatically set to TRUE")
* then convert to Pascal
*/
#ifndef MS45XX_PRESSURE_SCALE
-#define MS45XX_PRESSURE_SCALE (2 * MS45XX_PRESSURE_RANGE / (0.8 * 16383) * PSI_TO_PA)
+#define MS45XX_PRESSURE_SCALE (2 * MS45XX_PRESSURE_RANGE / (0.8 * 16383) * OutputPressureToPa)
#endif
#ifndef MS45XX_PRESSURE_OFFSET
-#define MS45XX_PRESSURE_OFFSET (1.25 * MS45XX_PRESSURE_RANGE * PSI_TO_PA)
+#define MS45XX_PRESSURE_OFFSET (1.25 * MS45XX_PRESSURE_RANGE * OutputPressureToPa)
#endif
-#else
+#else /* Can still be improved using another if statment with MS45XX_PRESSURE_TYPE etc. */
/* Offset and scaling for OUTPUT TYPE B:
* p_raw = (0.9*16383)/ (Pmax - Pmin) * (pressure - Pmin) + 0.05*16383
*/
#ifndef MS45XX_PRESSURE_SCALE
-#define MS45XX_PRESSURE_SCALE (2 * MS45XX_PRESSURE_RANGE / (0.9 * 16383) * PSI_TO_PA)
+#define MS45XX_PRESSURE_SCALE (MS45XX_PRESSURE_RANGE/(0.9*16383)*OutputPressureToPa)
#endif
#ifndef MS45XX_PRESSURE_OFFSET
-#define MS45XX_PRESSURE_OFFSET ((1.0 + 0.1 / 0.9) * MS45XX_PRESSURE_RANGE * PSI_TO_PA)
+#define MS45XX_PRESSURE_OFFSET (((MS45XX_PRESSURE_RANGE*0.05*16383)/(0.9*16383))*OutputPressureToPa)
#endif
#endif
/** Send a AIRSPEED_MS45XX message with every new measurement.
- * Mainly for debug, use with caution, sends message at ~100Hz.
+ * Mainly for debugging, use with caution, sends message at ~100Hz.
*/
#ifndef MS45XX_SYNC_SEND
#define MS45XX_SYNC_SEND FALSE
#endif
-/** Quadratic scale factor for airspeed.
+/** Quadratic scale factor for indicated airspeed.
* airspeed = sqrt(2*p_diff/density)
* With p_diff in Pa and standard air density of 1.225 kg/m^3,
* default airspeed scale is 2/1.225
@@ -136,19 +158,20 @@ struct AirspeedMs45xx ms45xx;
static struct i2c_transaction ms45xx_trans;
static Butterworth2LowPass ms45xx_filter;
-
static void ms45xx_downlink(struct transport_tx *trans, struct link_device *dev)
{
- pprz_msg_send_AIRSPEED_MS45XX(trans, dev, AC_ID,
- &ms45xx.diff_pressure,
- &ms45xx.temperature, &ms45xx.airspeed);
+ pprz_msg_send_AIRSPEED_MS45XX(trans,dev,AC_ID,
+ &ms45xx.pressure,
+ &ms45xx.temperature,
+ &ms45xx.airspeed);
}
void ms45xx_i2c_init(void)
{
- ms45xx.diff_pressure = 0;
+ ms45xx.pressure = 0.;
ms45xx.temperature = 0;
ms45xx.airspeed = 0.;
+ ms45xx.pressure_type = MS45XX_PRESSURE_TYPE;
ms45xx.pressure_scale = MS45XX_PRESSURE_SCALE;
ms45xx.pressure_offset = MS45XX_PRESSURE_OFFSET;
ms45xx.airspeed_scale = MS45XX_AIRSPEED_SCALE;
@@ -156,8 +179,10 @@ void ms45xx_i2c_init(void)
ms45xx_trans.status = I2CTransDone;
// setup low pass filter with time constant and 100Hz sampling freq
+ #ifdef USE_AIRSPEED_LOWPASS_FILTER
init_butterworth_2_low_pass(&ms45xx_filter, MS45XX_LOWPASS_TAU,
MS45XX_I2C_PERIODIC_PERIOD, 0);
+ #endif
#if PERIODIC_TELEMETRY
register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_AIRSPEED_MS45XX, ms45xx_downlink);
@@ -182,15 +207,22 @@ void ms45xx_i2c_event(void)
if (status == 0) {
/* 14bit raw pressure */
- uint16_t p_raw = 0x3FFF & (((uint16_t)(ms45xx_trans.buf[0]) << 8) |
- (uint16_t)(ms45xx_trans.buf[1]));
- /* Output is proportional to the difference between Port 1 and Port 2. Output
+ uint16_t p_raw = 0x3FFF & (((uint16_t)(ms45xx_trans.buf[0]) << 8) | (uint16_t)(ms45xx_trans.buf[1]));
+
+ /* For type Diff
+ * Output is proportional to the difference between Port 1 and Port 2. Output
* swings positive when Port 1> Port 2. Output is 50% of total counts
* when Port 1=Port 2.
- * p_diff = p_raw * scale - offset
+ * For type Gauge
+ * p_out = p_raw * scale - offset
*/
- float p_diff = p_raw * ms45xx.pressure_scale - ms45xx.pressure_offset;
- ms45xx.diff_pressure = update_butterworth_2_low_pass(&ms45xx_filter, p_diff);
+
+ float p_out = (p_raw * ms45xx.pressure_scale) - ms45xx.pressure_offset;
+ #ifdef USE_AIRSPEED_LOWPASS_FILTER
+ ms45xx.pressure = update_butterworth_2_low_pass(&ms45xx_filter, p_out);
+ #else
+ ms45xx.pressure = p_out;
+ #endif
/* 11bit raw temperature, 5 LSB bits not used */
uint16_t temp_raw = 0xFFE0 & (((uint16_t)(ms45xx_trans.buf[2]) << 8) |
@@ -201,14 +233,14 @@ void ms45xx_i2c_event(void)
*/
ms45xx.temperature = ((uint32_t)temp_raw * 2000) / 2047 - 500;
- // Send differential pressure via ABI
- AbiSendMsgBARO_DIFF(MS45XX_SENDER_ID, ms45xx.diff_pressure);
+ // Send (differential) pressure via ABI
+ AbiSendMsgBARO_DIFF(MS45XX_SENDER_ID, ms45xx.pressure);
// Send temperature as float in deg Celcius via ABI
float temp = ms45xx.temperature / 10.0f;
AbiSendMsgTEMPERATURE(MS45XX_SENDER_ID, temp);
-
// Compute airspeed
- ms45xx.airspeed = sqrtf(Max(ms45xx.diff_pressure * ms45xx.airspeed_scale, 0));
+ ms45xx.airspeed = sqrtf(Max(ms45xx.pressure * ms45xx.airspeed_scale, 0));
+
#if USE_AIRSPEED_MS45XX
stateSetAirspeed_f(ms45xx.airspeed);
#endif
diff --git a/sw/airborne/modules/sensors/airspeed_ms45xx_i2c.h b/sw/airborne/modules/sensors/airspeed_ms45xx_i2c.h
index e6e1d84aa2..68f9184242 100644
--- a/sw/airborne/modules/sensors/airspeed_ms45xx_i2c.h
+++ b/sw/airborne/modules/sensors/airspeed_ms45xx_i2c.h
@@ -20,7 +20,7 @@
*/
/** @file modules/sensors/airspeed_ms45xx_i2c.h
- * Airspeed driver for the MS45xx via I2C.
+ * Airspeed driver for the MS45xx pressure sensor via I2C.
*/
#ifndef AIRSPEED_MS45XX_I2C_H
@@ -29,13 +29,14 @@
#include "std.h"
struct AirspeedMs45xx {
- float diff_pressure; ///< differential pressure in Pascal
- int16_t temperature; ///< temperature in 0.1 deg Celcius
- float airspeed; ///< Airspeed in m/s estimated from differential pressure.
- float airspeed_scale; ///< quadratic scale factor to convert differential pressure to airspeed
- float pressure_scale; ///< scaling factor from raw measurement to Pascal
- float pressure_offset; ///< offset in Pascal
- bool sync_send; ///< flag to enable sending every new measurement via telemetry
+ float pressure; ///< (differential) pressure in Pascal
+ int16_t temperature; ///< Temperature in 0.1 deg Celcius
+ float airspeed; ///< Airspeed in m/s estimated from (differential) pressure.
+ bool pressure_type; ///< Pressure type Differential of Gauge
+ float airspeed_scale; ///< Quadratic scale factor to convert (differential) pressure to airspeed
+ float pressure_scale; ///< Scaling factor from raw measurement to Pascal
+ float pressure_offset; ///< Offset in Pascal
+ bool sync_send; ///< Flag to enable sending every new measurement via telemetry for debugging purpose
};
extern struct AirspeedMs45xx ms45xx;
diff --git a/sw/tools/generators/gen_flight_plan.ml b/sw/tools/generators/gen_flight_plan.ml
index 01fc922d70..3cc3667272 100644
--- a/sw/tools/generators/gen_flight_plan.ml
+++ b/sw/tools/generators/gen_flight_plan.ml
@@ -103,7 +103,7 @@ let check_altitude_srtm = fun a x wgs84 ->
let check_altitude = fun a x ->
if a < !ground_alt +. !security_height then begin
- fprintf stderr "\nNOTICE: low altitude (%.0f<%.0f+%.0f) in %s\n\n" a !ground_alt !security_height (Xml.to_string x)
+ fprintf stderr "NOTICE: low altitude (%.0f<%.0f+%.0f) in %s\n" a !ground_alt !security_height (Xml.to_string x)
end
@@ -275,7 +275,7 @@ let output_hmode x wp last_wp =
match hmode with
"route" ->
if last_wp = "last_wp" then
- fprintf stderr "Warning: Deprecated use of 'route' using last waypoint in %s\n"(Xml.to_string x);
+ fprintf stderr "NOTICE: Deprecated use of 'route' using last waypoint in %s\n"(Xml.to_string x);
lprintf "NavSegment(%s, %s);\n" last_wp wp
| "direct" -> lprintf "NavGotoWaypoint(%s);\n" wp
| x -> failwith (sprintf "Unknown hmode '%s'" x)
@@ -1102,7 +1102,7 @@ let () =
_ -> ()
end;
- begin
+ begin
try
let geofence_max_height = get_float "geofence_max_height" in
if geofence_max_height < !security_height then
diff --git a/sw/tools/parrot/disco.py b/sw/tools/parrot/disco.py
index 909712edec..3b30ec9905 100755
--- a/sw/tools/parrot/disco.py
+++ b/sw/tools/parrot/disco.py
@@ -40,7 +40,7 @@ class Disco(ParrotUtils):
# Parse the extra arguments
self.parser.add_argument('--min_version', metavar='MIN', default='1.4.1',
help='force minimum version allowed')
- self.parser.add_argument('--max_version', metavar='MAX', default='1.7.0',
+ self.parser.add_argument('--max_version', metavar='MAX', default='1.7.1',
help='force maximum version allowed')
def parse_extra_args(self, args):