From 3b02da90bbb314bc2c2ca5fe1c010ba89e76dc87 Mon Sep 17 00:00:00 2001 From: Rob Neu Date: Sat, 13 Jan 2018 16:29:47 -0700 Subject: [PATCH 1/7] Configured for Twin Fixed Wing --- include/mixer.h | 4 ++-- src/param.cpp | 47 +++++++++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/include/mixer.h b/include/mixer.h index 93a4838d..2d4f37a1 100644 --- a/include/mixer.h +++ b/include/mixer.h @@ -192,8 +192,8 @@ class Mixer { {S, S, M, S, S, M, NONE, NONE}, - { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F Mix - { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // X Mix + { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}, // F Mix + { 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f}, // X Mix { 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Y Mix { 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f} // Z Mix }; diff --git a/src/param.cpp b/src/param.cpp index f6f2cf49..35bbf766 100644 --- a/src/param.cpp +++ b/src/param.cpp @@ -108,10 +108,10 @@ void Params::set_defaults(void) init_param_int(PARAM_STREAM_HEARTBEAT_RATE, "STRM_HRTBT", 1); // Rate of heartbeat streaming (Hz) | 0 | 1000 init_param_int(PARAM_STREAM_STATUS_RATE, "STRM_STATUS", 10); // Rate of status streaming (Hz) | 0 | 1000 - init_param_int(PARAM_STREAM_ATTITUDE_RATE, "STRM_ATTITUDE", 200); // Rate of attitude stream (Hz) | 0 | 1000 + init_param_int(PARAM_STREAM_ATTITUDE_RATE, "STRM_ATTITUDE", 100); // Rate of attitude stream (Hz) | 0 | 1000 init_param_int(PARAM_STREAM_IMU_RATE, "STRM_IMU", 500); // Rate of IMU stream (Hz) | 0 | 1000 - init_param_int(PARAM_STREAM_MAG_RATE, "STRM_MAG", 50); // Rate of magnetometer stream (Hz) | 0 | 75 - init_param_int(PARAM_STREAM_BARO_RATE, "STRM_BARO", 50); // Rate of barometer stream (Hz) | 0 | 100 + init_param_int(PARAM_STREAM_MAG_RATE, "STRM_MAG", 75); // Rate of magnetometer stream (Hz) | 0 | 75 + init_param_int(PARAM_STREAM_BARO_RATE, "STRM_BARO", 100); // Rate of barometer stream (Hz) | 0 | 100 init_param_int(PARAM_STREAM_AIRSPEED_RATE, "STRM_AIRSPEED", 20); // Rate of airspeed stream (Hz) | 0 | 50 init_param_int(PARAM_STREAM_SONAR_RATE, "STRM_SONAR", 40); // Rate of sonar stream (Hz) | 0 | 40 @@ -121,7 +121,7 @@ void Params::set_defaults(void) /********************************/ /*** CONTROLLER CONFIGURATION ***/ /********************************/ - init_param_float(PARAM_MAX_COMMAND, "PARAM_MAX_CMD", 1.0); // saturation point for PID controller output | 0 | 1.0 + init_param_float(PARAM_MAX_COMMAND, "PARAM_MAX_CMD", 1.0); // saturation point for PID controller output | 0.0 | 1.0 init_param_float(PARAM_PID_ROLL_RATE_P, "PID_ROLL_RATE_P", 0.070f); // Roll Rate Proportional Gain | 0.0 | 1000.0 init_param_float(PARAM_PID_ROLL_RATE_I, "PID_ROLL_RATE_I", 0.000f); // Roll Rate Integral Gain | 0.0 | 1000.0 @@ -137,11 +137,10 @@ void Params::set_defaults(void) init_param_float(PARAM_PID_ROLL_ANGLE_P, "PID_ROLL_ANG_P", 0.15f); // Roll Angle Proporitional Gain | 0.0 | 1000.0 init_param_float(PARAM_PID_ROLL_ANGLE_I, "PID_ROLL_ANG_I", 0.0f); // Roll Angle Integral Gain | 0.0 | 1000.0 - init_param_float(PARAM_PID_ROLL_ANGLE_D, "PID_ROLL_ANG_D", 0.05f); // Roll Angle Derivative Gain | 0.0 | 1000.0 - + init_param_float(PARAM_PID_ROLL_ANGLE_D, "PID_ROLL_ANG_D", 0.07f); // Roll Angle Derivative Gain | 0.0 | 1000.0 init_param_float(PARAM_PID_PITCH_ANGLE_P, "PID_PITCH_ANG_P", 0.15f); // Pitch Angle Proporitional Gain | 0.0 | 1000.0 init_param_float(PARAM_PID_PITCH_ANGLE_I, "PID_PITCH_ANG_I", 0.0f); // Pitch Angle Integral Gain | 0.0 | 1000.0 - init_param_float(PARAM_PID_PITCH_ANGLE_D, "PID_PITCH_ANG_D", 0.05f); // Pitch Angle Derivative Gain | 0.0 | 1000.0 + init_param_float(PARAM_PID_PITCH_ANGLE_D, "PID_PITCH_ANG_D", 0.07f); // Pitch Angle Derivative Gain | 0.0 | 1000.0 init_param_float(PARAM_X_EQ_TORQUE, "X_EQ_TORQUE", 0.0f); // Equilibrium torque added to output of controller on x axis | -1.0 | 1.0 init_param_float(PARAM_Y_EQ_TORQUE, "Y_EQ_TORQUE", 0.0f); // Equilibrium torque added to output of controller on y axis | -1.0 | 1.0 @@ -153,28 +152,28 @@ void Params::set_defaults(void) /*************************/ /*** PWM CONFIGURATION ***/ /*************************/ - init_param_int(PARAM_MOTOR_PWM_SEND_RATE, "MOTOR_PWM_UPDATE", 490); // Refresh rate of motor commands to motors - See motor documentation | 0 | 1000 - init_param_float(PARAM_MOTOR_IDLE_THROTTLE, "MOTOR_IDLE_THR", 0.1); // min throttle command sent to motors when armed (Set above 0.1 to spin when armed) | 0.0 | 1.0 - init_param_float(PARAM_FAILSAFE_THROTTLE, "FAILSAFE_THR", 0.3); // Throttle sent to motors in failsafe condition (set just below hover throttle) | 0.0 | 1.0 + init_param_int(PARAM_MOTOR_PWM_SEND_RATE, "MOTOR_PWM_UPDATE", 50); // Refresh rate of motor commands to motors - See motor documentation | 0 | 1000 + init_param_float(PARAM_MOTOR_IDLE_THROTTLE, "MOTOR_IDLE_THR", 0.0); // min throttle command sent to motors when armed (Set above 0.1 to spin when armed) | 0.0 | 1.0 + init_param_float(PARAM_FAILSAFE_THROTTLE, "FAILSAFE_THR", 0.0); // Throttle sent to motors in failsafe condition (set just below hover throttle) | 0.0 | 1.0 init_param_int(PARAM_MOTOR_MIN_PWM, "MOTOR_MIN_PWM", 1000); // PWM value sent to motor ESCs at zero throttle | 1000 | 2000 init_param_int(PARAM_MOTOR_MAX_PWM, "MOTOR_MAX_PWM", 2000); // PWM value sent to motor ESCs at full throttle | 1000 | 2000 - init_param_int(PARAM_SPIN_MOTORS_WHEN_ARMED, "ARM_SPIN_MOTORS", true); // Enforce MOTOR_IDLE_THR | 0 | 1 + init_param_int(PARAM_SPIN_MOTORS_WHEN_ARMED, "ARM_SPIN_MOTORS", false); // Enforce MOTOR_IDLE_THR | 0 | 1 /*******************************/ /*** ESTIMATOR CONFIGURATION ***/ /*******************************/ init_param_int(PARAM_INIT_TIME, "FILTER_INIT_T", 3000); // Time in ms to initialize estimator | 0 | 100000 - init_param_float(PARAM_FILTER_KP, "FILTER_KP", 0.5f); // estimator proportional gain - See estimator documentation | 0 | 10.0 - init_param_float(PARAM_FILTER_KI, "FILTER_KI", 0.05f); // estimator integral gain - See estimator documentation | 0 | 1.0 + init_param_float(PARAM_FILTER_KP, "FILTER_KP", 1.0f); // estimator proportional gain - See estimator documentation | 0 | 10.0 + init_param_float(PARAM_FILTER_KI, "FILTER_KI", 0.1f); // estimator integral gain - See estimator documentation | 0 | 1.0 - init_param_int(PARAM_FILTER_USE_QUAD_INT, "FILTER_QUAD_INT", 1); // Perform a quadratic averaging of LPF gyro data prior to integration (adds ~20 us to estimation loop on F1 processors) | 0 | 1 - init_param_int(PARAM_FILTER_USE_MAT_EXP, "FILTER_MAT_EXP", 1); // 1 - Use matrix exponential to improve gyro integration (adds ~90 us to estimation loop in F1 processors) 0 - use euler integration | 0 | 1 + init_param_int(PARAM_FILTER_USE_QUAD_INT, "FILTER_QUAD_INT", 0); // Perform a quadratic averaging of LPF gyro data prior to integration (adds ~20 us to estimation loop on F1 processors) | 0 | 1 + init_param_int(PARAM_FILTER_USE_MAT_EXP, "FILTER_MAT_EXP", 0); // 1 - Use matrix exponential to improve gyro integration (adds ~90 us to estimation loop in F1 processors) 0 - use euler integration | 0 | 1 init_param_int(PARAM_FILTER_USE_ACC, "FILTER_USE_ACC", 1); // Use accelerometer to correct gyro integration drift (adds ~70 us to estimation loop) | 0 | 1 init_param_int(PARAM_CALIBRATE_GYRO_ON_ARM, "CAL_GYRO_ARM", false); // True if desired to calibrate gyros on arm | 0 | 1 - init_param_float(PARAM_GYRO_ALPHA, "GYRO_LPF_ALPHA", 0.3f); // Low-pass filter constant - See estimator documentation | 0 | 1.0 - init_param_float(PARAM_ACC_ALPHA, "ACC_LPF_ALPHA", 0.5f); // Low-pass filter constant - See estimator documentation | 0 | 1.0 + init_param_float(PARAM_GYRO_ALPHA, "GYRO_LPF_ALPHA", 0.888f); // Low-pass filter constant - See estimator documentation | 0 | 1.0 + init_param_float(PARAM_ACC_ALPHA, "ACC_LPF_ALPHA", 0.888f); // Low-pass filter constant - See estimator documentation | 0 | 1.0 init_param_float(PARAM_GYRO_X_BIAS, "GYRO_X_BIAS", 0.0f); // Constant x-bias of gyroscope readings | -1.0 | 1.0 init_param_float(PARAM_GYRO_Y_BIAS, "GYRO_Y_BIAS", 0.0f); // Constant y-bias of gyroscope readings | -1.0 | 1.0 @@ -215,8 +214,8 @@ void Params::set_defaults(void) init_param_int(PARAM_RC_ATTITUDE_OVERRIDE_CHANNEL, "RC_ATT_OVRD_CHN", 4); // RC switch mapped to attitude override [0 indexed, -1 to disable] | 4 | 7 init_param_int(PARAM_RC_THROTTLE_OVERRIDE_CHANNEL, "RC_THR_OVRD_CHN", 4); // RC switch channel mapped to throttle override [0 indexed, -1 to disable] | 4 | 7 init_param_int(PARAM_RC_ATT_CONTROL_TYPE_CHANNEL, "RC_ATT_CTRL_CHN", -1); // RC switch channel mapped to attitude control type [0 indexed, -1 to disable] | 4 | 7 - init_param_int(PARAM_RC_ARM_CHANNEL, "ARM_CHANNEL", -1); // RC switch channel mapped to arming (only if PARAM_ARM_STICKS is false) [0 indexed, -1 to disable] | 4 | 7 - init_param_int(PARAM_RC_NUM_CHANNELS, "RC_NUM_CHN", 6); // number of RC input channels | 1 | 8 + init_param_int(PARAM_RC_ARM_CHANNEL, "ARM_CHANNEL", 5); // RC switch channel mapped to arming (only if PARAM_ARM_STICKS is false) [0 indexed, -1 to disable] | 4 | 7 + init_param_int(PARAM_RC_NUM_CHANNELS, "RC_NUM_CHN", 8); // number of RC input channels | 1 | 8 init_param_int(PARAM_RC_SWITCH_5_DIRECTION, "SWITCH_5_DIR", 1); // RC switch 5 toggle direction | -1 | 1 init_param_int(PARAM_RC_SWITCH_6_DIRECTION, "SWITCH_6_DIR", 1); // RC switch 6 toggle direction | -1 | 1 @@ -225,7 +224,7 @@ void Params::set_defaults(void) init_param_float(PARAM_RC_OVERRIDE_DEVIATION, "RC_OVRD_DEV", 0.1); // RC stick deviation from center for overrride | 0.0 | 1.0 init_param_int(PARAM_OVERRIDE_LAG_TIME, "OVRD_LAG_TIME", 1000); // RC stick deviation lag time before returning control (ms) | 0 | 100000 - init_param_int(PARAM_RC_OVERRIDE_TAKE_MIN_THROTTLE, "MIN_THROTTLE", true); // Take minimum throttle between RC and computer at all times | 0 | 1 + init_param_int(PARAM_RC_OVERRIDE_TAKE_MIN_THROTTLE, "MIN_THROTTLE", false); // Take minimum throttle between RC and computer at all times | 0 | 1 init_param_int(PARAM_RC_ATTITUDE_MODE, "RC_ATT_MODE", 1); // Attitude mode for RC sticks (0: rate, 1: angle). Overridden if RC_ATT_CTRL_CHN is set. | 0 | 1 init_param_float(PARAM_RC_MAX_ROLL, "RC_MAX_ROLL", 0.786f); // Maximum roll angle command sent by full deflection of RC sticks | 0.0 | 3.14159 @@ -237,11 +236,11 @@ void Params::set_defaults(void) /***************************/ /*** FRAME CONFIGURATION ***/ /***************************/ - init_param_int(PARAM_MIXER, "MIXER", Mixer::INVALID_MIXER); // Which mixer to choose - See Mixer documentation | 0 | 10 + init_param_int(PARAM_MIXER, "MIXER", 10); // Which mixer to choose - See Mixer documentation | 0 | 10 - init_param_int(PARAM_FIXED_WING, "FIXED_WING", false); // switches on passthrough commands for fixedwing operation | 0 | 1 - init_param_int(PARAM_ELEVATOR_REVERSE, "ELEVATOR_REV", 0); // reverses elevator servo output | 0 | 1 - init_param_int(PARAM_AILERON_REVERSE, "AIL_REV", 0); // reverses aileron servo output | 0 | 1 + init_param_int(PARAM_FIXED_WING, "FIXED_WING", true); // switches on passthrough commands for fixedwing operation | 0 | 1 + init_param_int(PARAM_ELEVATOR_REVERSE, "ELEVATOR_REV", 1); // reverses elevator servo output | 0 | 1 + init_param_int(PARAM_AILERON_REVERSE, "AIL_REV", 1); // reverses aileron servo output | 0 | 1 init_param_int(PARAM_RUDDER_REVERSE, "RUDDER_REV", 0); // reverses rudder servo output | 0 | 1 /********************/ From 9532233a0c2a7921e6b35cd7cee63987117b9877 Mon Sep 17 00:00:00 2001 From: Rob Neu Date: Thu, 25 Jan 2018 15:34:12 -0700 Subject: [PATCH 2/7] updated commits of breezystm32 and mavlink submodules to newest version --- boards/naze/lib/breezystm32 | 2 +- comms/mavlink/v1.0 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/naze/lib/breezystm32 b/boards/naze/lib/breezystm32 index ed664a6c..8ca8dbfb 160000 --- a/boards/naze/lib/breezystm32 +++ b/boards/naze/lib/breezystm32 @@ -1 +1 @@ -Subproject commit ed664a6c9df11539764cd8531e6b5ca2538b8459 +Subproject commit 8ca8dbfb139a4e4de829e77b00306f0f49283449 diff --git a/comms/mavlink/v1.0 b/comms/mavlink/v1.0 index 09857c68..8a8558d4 160000 --- a/comms/mavlink/v1.0 +++ b/comms/mavlink/v1.0 @@ -1 +1 @@ -Subproject commit 09857c684a6c5c4bd20487bf8d6e29cba803fc11 +Subproject commit 8a8558d42d7ac1b7bc7728342827a52c24f9063b From 9e73f8b0238a0056893d08b538b65e3fb9943c93 Mon Sep 17 00:00:00 2001 From: Austin Hurst Date: Sat, 26 May 2018 11:41:29 -0600 Subject: [PATCH 3/7] Airspeed variance threshold increased and default params set --- src/param.cpp | 26 +++++++++++++------------- src/sensors.cpp | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/param.cpp b/src/param.cpp index 35bbf766..fc2a40f9 100644 --- a/src/param.cpp +++ b/src/param.cpp @@ -108,12 +108,12 @@ void Params::set_defaults(void) init_param_int(PARAM_STREAM_HEARTBEAT_RATE, "STRM_HRTBT", 1); // Rate of heartbeat streaming (Hz) | 0 | 1000 init_param_int(PARAM_STREAM_STATUS_RATE, "STRM_STATUS", 10); // Rate of status streaming (Hz) | 0 | 1000 - init_param_int(PARAM_STREAM_ATTITUDE_RATE, "STRM_ATTITUDE", 100); // Rate of attitude stream (Hz) | 0 | 1000 - init_param_int(PARAM_STREAM_IMU_RATE, "STRM_IMU", 500); // Rate of IMU stream (Hz) | 0 | 1000 - init_param_int(PARAM_STREAM_MAG_RATE, "STRM_MAG", 75); // Rate of magnetometer stream (Hz) | 0 | 75 - init_param_int(PARAM_STREAM_BARO_RATE, "STRM_BARO", 100); // Rate of barometer stream (Hz) | 0 | 100 + init_param_int(PARAM_STREAM_ATTITUDE_RATE, "STRM_ATTITUDE", 1); // Rate of attitude stream (Hz) | 0 | 1000 + init_param_int(PARAM_STREAM_IMU_RATE, "STRM_IMU", 0); // Rate of IMU stream (Hz) | 0 | 1000 + init_param_int(PARAM_STREAM_MAG_RATE, "STRM_MAG", 0); // Rate of magnetometer stream (Hz) | 0 | 75 + init_param_int(PARAM_STREAM_BARO_RATE, "STRM_BARO", 0); // Rate of barometer stream (Hz) | 0 | 100 init_param_int(PARAM_STREAM_AIRSPEED_RATE, "STRM_AIRSPEED", 20); // Rate of airspeed stream (Hz) | 0 | 50 - init_param_int(PARAM_STREAM_SONAR_RATE, "STRM_SONAR", 40); // Rate of sonar stream (Hz) | 0 | 40 + init_param_int(PARAM_STREAM_SONAR_RATE, "STRM_SONAR", 0); // Rate of sonar stream (Hz) | 0 | 40 init_param_int(PARAM_STREAM_OUTPUT_RAW_RATE, "STRM_SERVO", 50); // Rate of raw output stream | 0 | 490 init_param_int(PARAM_STREAM_RC_RAW_RATE, "STRM_RC", 50); // Rate of raw RC input stream | 0 | 50 @@ -142,9 +142,9 @@ void Params::set_defaults(void) init_param_float(PARAM_PID_PITCH_ANGLE_I, "PID_PITCH_ANG_I", 0.0f); // Pitch Angle Integral Gain | 0.0 | 1000.0 init_param_float(PARAM_PID_PITCH_ANGLE_D, "PID_PITCH_ANG_D", 0.07f); // Pitch Angle Derivative Gain | 0.0 | 1000.0 - init_param_float(PARAM_X_EQ_TORQUE, "X_EQ_TORQUE", 0.0f); // Equilibrium torque added to output of controller on x axis | -1.0 | 1.0 - init_param_float(PARAM_Y_EQ_TORQUE, "Y_EQ_TORQUE", 0.0f); // Equilibrium torque added to output of controller on y axis | -1.0 | 1.0 - init_param_float(PARAM_Z_EQ_TORQUE, "Z_EQ_TORQUE", 0.0f); // Equilibrium torque added to output of controller on z axis | -1.0 | 1.0 + init_param_float(PARAM_X_EQ_TORQUE, "X_EQ_TORQUE", -0.082f); // Equilibrium torque added to output of controller on x axis | -1.0 | 1.0 + init_param_float(PARAM_Y_EQ_TORQUE, "Y_EQ_TORQUE", -0.056f); // Equilibrium torque added to output of controller on y axis | -1.0 | 1.0 + init_param_float(PARAM_Z_EQ_TORQUE, "Z_EQ_TORQUE", -0.1f); // Equilibrium torque added to output of controller on z axis | -1.0 | 1.0 init_param_float(PARAM_PID_TAU, "PID_TAU", 0.05f); // Dirty Derivative time constant - See controller documentation | 0.0 | 1.0 @@ -172,8 +172,8 @@ void Params::set_defaults(void) init_param_int(PARAM_CALIBRATE_GYRO_ON_ARM, "CAL_GYRO_ARM", false); // True if desired to calibrate gyros on arm | 0 | 1 - init_param_float(PARAM_GYRO_ALPHA, "GYRO_LPF_ALPHA", 0.888f); // Low-pass filter constant - See estimator documentation | 0 | 1.0 - init_param_float(PARAM_ACC_ALPHA, "ACC_LPF_ALPHA", 0.888f); // Low-pass filter constant - See estimator documentation | 0 | 1.0 + init_param_float(PARAM_GYRO_ALPHA, "GYRO_LPF_ALPHA", 0.88f); // Low-pass filter constant - See estimator documentation | 0 | 1.0 + init_param_float(PARAM_ACC_ALPHA, "ACC_LPF_ALPHA", 0.88f); // Low-pass filter constant - See estimator documentation | 0 | 1.0 init_param_float(PARAM_GYRO_X_BIAS, "GYRO_X_BIAS", 0.0f); // Constant x-bias of gyroscope readings | -1.0 | 1.0 init_param_float(PARAM_GYRO_Y_BIAS, "GYRO_Y_BIAS", 0.0f); // Constant y-bias of gyroscope readings | -1.0 | 1.0 @@ -236,11 +236,11 @@ void Params::set_defaults(void) /***************************/ /*** FRAME CONFIGURATION ***/ /***************************/ - init_param_int(PARAM_MIXER, "MIXER", 10); // Which mixer to choose - See Mixer documentation | 0 | 10 + init_param_int(PARAM_MIXER, "MIXER", Mixer::FIXEDWING); // Which mixer to choose - See Mixer documentation | 0 | 10 init_param_int(PARAM_FIXED_WING, "FIXED_WING", true); // switches on passthrough commands for fixedwing operation | 0 | 1 - init_param_int(PARAM_ELEVATOR_REVERSE, "ELEVATOR_REV", 1); // reverses elevator servo output | 0 | 1 - init_param_int(PARAM_AILERON_REVERSE, "AIL_REV", 1); // reverses aileron servo output | 0 | 1 + init_param_int(PARAM_ELEVATOR_REVERSE, "ELEVATOR_REV", true); // reverses elevator servo output | 0 | 1 + init_param_int(PARAM_AILERON_REVERSE, "AIL_REV", true); // reverses aileron servo output | 0 | 1 init_param_int(PARAM_RUDDER_REVERSE, "RUDDER_REV", 0); // reverses rudder servo output | 0 | 1 /********************/ diff --git a/src/sensors.cpp b/src/sensors.cpp index e6804a3c..042a7eb4 100644 --- a/src/sensors.cpp +++ b/src/sensors.cpp @@ -53,7 +53,7 @@ const int Sensors::SENSOR_CAL_DELAY_CYCLES = 128; const int Sensors::SENSOR_CAL_CYCLES = 127; const float Sensors::BARO_MAX_CALIBRATION_VARIANCE = 25.0; // standard dev about 0.2 m -const float Sensors::DIFF_PRESSURE_MAX_CALIBRATION_VARIANCE = 100.0; // standard dev about 3 m/s +const float Sensors::DIFF_PRESSURE_MAX_CALIBRATION_VARIANCE = 1000.0; // standard dev about 3 m/s when = to 100.0 Sensors::Sensors(ROSflight& rosflight) : rf_(rosflight) From 315574b4bf46295532e2b72ca8f350ae959ea166 Mon Sep 17 00:00:00 2001 From: Rob Neu Date: Sat, 26 May 2018 13:27:21 -0600 Subject: [PATCH 4/7] Merged 'patch to fix parameter streaming' commit 245f49b from upstream --- include/comm_manager.h | 1 + src/comm_manager.cpp | 5 +++++ src/param.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/comm_manager.h b/include/comm_manager.h index 7820495f..5d41feb1 100644 --- a/include/comm_manager.h +++ b/include/comm_manager.h @@ -147,6 +147,7 @@ class CommManager void update_status(); void log(CommLink::LogSeverity severity, const char *fmt, ...); + void send_parameter_list(); void send_named_value_float(const char *const name, float value); }; diff --git a/src/comm_manager.cpp b/src/comm_manager.cpp index 4d485c8e..90eb40e6 100644 --- a/src/comm_manager.cpp +++ b/src/comm_manager.cpp @@ -158,6 +158,11 @@ void CommManager::param_request_list_callback(uint8_t target_system) send_params_index_ = 0; } +void CommManager::send_parameter_list() +{ + send_params_index_ = 0; +} + void CommManager::param_request_read_callback(uint8_t target_system, const char* const param_name, int16_t param_index) { if (target_system == sysid_) diff --git a/src/param.cpp b/src/param.cpp index fc2a40f9..36c13ff6 100644 --- a/src/param.cpp +++ b/src/param.cpp @@ -336,7 +336,7 @@ bool Params::set_param_float(uint16_t id, float value) { params.values[id].fvalue = value; change_callback(id); - RF_.comm_manager_.send_param_value(id); + RF_.comm_manager_.send_parameter_list(); return true; } return false; From 4014874456a32dcd33465ba19a6c9c59ba904687 Mon Sep 17 00:00:00 2001 From: Rob Neu Date: Sat, 26 May 2018 13:53:00 -0600 Subject: [PATCH 5/7] Merged 'When calibrating RC trims, add to existing trim values' commit 2eada83 from upstream --- src/controller.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controller.cpp b/src/controller.cpp index d51cab19..e2095c25 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -155,9 +155,9 @@ void Controller::calculate_equilbrium_torque_from_rc() turbomath::Vector pid_output = run_pid_loops(0, fake_state, RF_.command_manager_.rc_control(), false); // the output from the controller is going to be the static offsets - RF_.params_.set_param_float(PARAM_X_EQ_TORQUE, pid_output.x); - RF_.params_.set_param_float(PARAM_Y_EQ_TORQUE, pid_output.y); - RF_.params_.set_param_float(PARAM_Z_EQ_TORQUE, pid_output.z); + RF_.params_.set_param_float(PARAM_X_EQ_TORQUE, pid_output.x + RF_.params_.get_param_float(PARAM_X_EQ_TORQUE)); + RF_.params_.set_param_float(PARAM_Y_EQ_TORQUE, pid_output.y + RF_.params_.get_param_float(PARAM_Y_EQ_TORQUE)); + RF_.params_.set_param_float(PARAM_Z_EQ_TORQUE, pid_output.z + RF_.params_.get_param_float(PARAM_Z_EQ_TORQUE)); RF_.comm_manager_.log(CommLink::LogSeverity::LOG_WARNING, "Equilibrium torques found and applied."); RF_.comm_manager_.log(CommLink::LogSeverity::LOG_WARNING, "Please zero out trims on your transmitter"); From 8e42d05f19550e6cf774e98c532e81f294b3ec3a Mon Sep 17 00:00:00 2001 From: Austin Hurst Date: Sun, 10 Jun 2018 02:10:47 -0600 Subject: [PATCH 6/7] failsafe requires RC connection loss AND computer connection loss --- src/command_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command_manager.cpp b/src/command_manager.cpp index 8512faea..be24be2f 100644 --- a/src/command_manager.cpp +++ b/src/command_manager.cpp @@ -267,11 +267,11 @@ bool CommandManager::run() bool last_rc_override = rc_override_; // Check for and apply failsafe command - if (RF_.state_manager_.state().failsafe) + if (RF_.state_manager_.state().failsafe && offboard_control_active() == false) { combined_command_ = failsafe_command_; } - else if (RF_.rc_.new_command()) + else if (RF_.rc_.new_command() || new_command_) { // Read RC interpret_rc(); From 8719d94b4c60c5c147443be0db0f6329c26c87ec Mon Sep 17 00:00:00 2001 From: Rob Neu Date: Sun, 10 Jun 2018 15:37:44 -0600 Subject: [PATCH 7/7] Increase min PWM value for failsafe to 910 --- src/command_manager.cpp | 2 +- src/rc.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command_manager.cpp b/src/command_manager.cpp index be24be2f..ee822998 100644 --- a/src/command_manager.cpp +++ b/src/command_manager.cpp @@ -267,7 +267,7 @@ bool CommandManager::run() bool last_rc_override = rc_override_; // Check for and apply failsafe command - if (RF_.state_manager_.state().failsafe && offboard_control_active() == false) + if (RF_.state_manager_.state().failsafe && !offboard_control_active()) { combined_command_ = failsafe_command_; } diff --git a/src/rc.cpp b/src/rc.cpp index 9520c6e4..64676214 100644 --- a/src/rc.cpp +++ b/src/rc.cpp @@ -174,7 +174,7 @@ bool RC::check_rc_lost() // go into failsafe if we get an invalid RC command for any channel for (int8_t i = 0; i 2100) + if (RF_.board_.pwm_read(i) < 910 || RF_.board_.pwm_read(i) > 2100) { failsafe = true; }