diff --git a/conf/airframes/tudelft/bebop2_indi_convergence.xml b/conf/airframes/tudelft/bebop2_indi_convergence.xml new file mode 100644 index 0000000000..8849c5ab2f --- /dev/null +++ b/conf/airframes/tudelft/bebop2_indi_convergence.xml @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+ + + +
+ +
+ + + + + + + + + + + + + + +
+ +
+ +
+ + +
+ + + + + + + +
+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ + + + + + + + +
+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ +
+ + +
+ +
+ + + +
+ + +
+ + + + + + +
+ +
+ + + + + +
+
diff --git a/conf/airframes/tudelft/disco_rotorcraft_indi.xml b/conf/airframes/tudelft/disco_rotorcraft_indi.xml new file mode 100644 index 0000000000..091443a6b3 --- /dev/null +++ b/conf/airframes/tudelft/disco_rotorcraft_indi.xml @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ +
+ + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + + + +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ +
+ + + + + + +
+ +
+ + + + + +
+ +
diff --git a/conf/flight_plans/tudelft/delft_bebop_convergence.xml b/conf/flight_plans/tudelft/delft_bebop_convergence.xml new file mode 100644 index 0000000000..879f5e229a --- /dev/null +++ b/conf/flight_plans/tudelft/delft_bebop_convergence.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/flight_plans/tudelft/disco_convergence.xml b/conf/flight_plans/tudelft/disco_convergence.xml new file mode 100644 index 0000000000..6f4aa729df --- /dev/null +++ b/conf/flight_plans/tudelft/disco_convergence.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/modules/actuators_disco.xml b/conf/modules/actuators_disco.xml index 6481e4feec..abdde8b604 100644 --- a/conf/modules/actuators_disco.xml +++ b/conf/modules/actuators_disco.xml @@ -10,6 +10,7 @@ i2c,actuators actuators +
diff --git a/conf/modules/logger_file.xml b/conf/modules/logger_file.xml index b4cb07008d..f55cc920a3 100644 --- a/conf/modules/logger_file.xml +++ b/conf/modules/logger_file.xml @@ -7,13 +7,16 @@ (only for linux) +
- +
+ stop="file_logger_stop()" autorun="FALSE" freq="FILE_LOGGER_FREQUENCY" /> - + + + diff --git a/conf/simulator/jsbsim/aircraft/Systems/aerodynamics_disco.xml b/conf/simulator/jsbsim/aircraft/Systems/aerodynamics_disco.xml new file mode 100644 index 0000000000..2643e9c996 --- /dev/null +++ b/conf/simulator/jsbsim/aircraft/Systems/aerodynamics_disco.xml @@ -0,0 +1,159 @@ + + + + + + + fcs/ele_left_lag + -0.65 + + + fcs/ele_right_lag + -.65 + + + + + + + + + + fcs/ele_left_lag + -0.0373430666 + + + fcs/ele_right_lag + 0.0373430666 + + + + + + + + + Lift due to alpha + + aero/qbar-psf + metrics/Sw-sqft + + aero/alpha-rad + + + -1.77 -0.750 + -1.57 0.250 + -1.34 1.400 + -0.97 0.710 + 0.00 0.0 + 0.80 0.2 + 1.27 0.2 + 1.57 0.0 + 1.87 -0.2 + +
+
+
+ +
+ + + + + Drag at zero lift + + aero/qbar-psf + metrics/Sw-sqft + + aero/alpha-rad + + -1.57 0.028 + -1.31 0.036 + 0.00 1.500 + 1.31 0.036 + 1.57 0.028 + + +
+
+
+ + + Induced drag + + aero/qbar-psf + metrics/Sw-sqft + aero/cl-squared + 0.04 + + + + + + + + + + + + + + + + + + + + + +
+ + + + + Side force due to beta + + aero/qbar-psf + metrics/Sw-sqft + aero/beta-rad + -1 + + + + + + + + + Yaw moment due to beta + + aero/qbar-psf + metrics/Sw-sqft + metrics/bw-ft + aero/beta-rad + + 0.24 + + + + + + + +
diff --git a/conf/simulator/jsbsim/aircraft/bebop2.xml b/conf/simulator/jsbsim/aircraft/bebop2.xml new file mode 100644 index 0000000000..5d7e012115 --- /dev/null +++ b/conf/simulator/jsbsim/aircraft/bebop2.xml @@ -0,0 +1,504 @@ + + + + + + Ewoud Smeur + 07-03-2017 + Version 0.9 - beta + Bebop1 with actuator dynamics (NE/SW turning CCW, NW/SE CW) + + + + 78.53 + 10 + 6.89 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + 0.001030 + 0.001111 + 0.00081 + 0. + 0. + 0. + 0.84 + + 0 + 0 + 0 + + + + + + + -0.15 + 0 + -0.1 + + 0.8 + 0.5 + 500 + 100 + 1000 + 0.0 + NONE + 0 + + + + + 0.15 + 0 + -0.1 + + 0.8 + 0.5 + 500 + 100 + 1000 + 0.0 + NONE + 0 + + + + + 0. + 0.15 + -0.1 + + 0.8 + 0.5 + 500 + 100 + 1000 + 0.0 + NONE + 0 + + + + + 0. + -0.15 + -0.1 + + 0.8 + 0.5 + 500 + 100 + 1000 + 0.0 + NONE + 0 + + + + + + + + + fcs/ne_motor + 30 + fcs/ne_motor_lag + + + fcs/se_motor + 30 + fcs/se_motor_lag + + + fcs/sw_motor + 30 + fcs/sw_motor_lag + + + fcs/nw_motor + 30 + fcs/nw_motor_lag + + + + + fcs/ne_motor + 30 + fcs/ne_motor_d + + + fcs/se_motor + 30 + fcs/se_motor_d + + + fcs/sw_motor + 30 + fcs/sw_motor_d + + + fcs/nw_motor + 30 + fcs/nw_motor_d + + + + fcs/ne_motor_d + 0.295 + fcs/g2timesactd + + + fcs/ne_motor_lag + 0.0425 + fcs/g1timesact + + + fcs/g2timesactd + fcs/g1timesact + fcs/yawcontrol + + + + fcs/se_motor_d + 0.295 + fcs/g2timesactd1 + + + fcs/se_motor_lag + 0.0425 + fcs/g1timesact1 + + + fcs/g2timesactd1 + fcs/g1timesact1 + fcs/yawcontrol1 + + + + fcs/sw_motor_d + 0.295 + fcs/g2timesactd2 + + + fcs/sw_motor_lag + 0.0425 + fcs/g1timesact2 + + + fcs/g2timesactd2 + fcs/g1timesact2 + fcs/yawcontrol2 + + + + fcs/nw_motor_d + 0.295 + fcs/g2timesactd3 + + + fcs/nw_motor_lag + 0.0425 + fcs/g1timesact3 + + + fcs/g2timesactd3 + fcs/g1timesact3 + fcs/yawcontrol3 + + + + + + + fcs/ne_motor + fcs/ne_motor_lag + fcs/se_motor + fcs/se_motor_lag + fcs/sw_motor + fcs/sw_motor_lag + fcs/nw_motor + fcs/nw_motor_lag + + + + + + + + fcs/ne_motor_lag + 0.42 + + + + -3.05 + 3.74 + 0 + + + 0 + 0 + -1 + + + + + + + fcs/sw_motor_lag + 0.42 + + + + 3.05 + -3.74 + 0 + + + 0 + 0 + -1 + + + + + + + fcs/se_motor_lag + 0.42 + + + + 3.05 + 3.74 + 0 + + + 0 + 0 + -1 + + + + + + + fcs/nw_motor_lag + 0.42 + + + + -3.05 + -3.74 + 0 + + + 0 + 0 + -1 + + + + + + + + + + fcs/yawcontrol + -1.0 + + + + + -4.87 + 6.8385 + 0 + + + -1 + 0 + 0 + + + + + + + fcs/yawcontrol + -1.0 + + + + -4.87 + 2.9015 + 0 + + + 1 + 0 + 0 + + + + + + + + + fcs/yawcontrol1 + -1.0 + + + + 4.87 + 6.8385 + 0 + + + 1 + 0 + 0 + + + + + + + fcs/yawcontrol1 + -1.0 + + + + 4.87 + 2.9015 + 0 + + + -1 + 0 + 0 + + + + + + + + + fcs/yawcontrol2 + -1.0 + + + + 4.87 + -2.9015 + 0 + + + -1 + 0 + 0 + + + + + + + fcs/yawcontrol2 + -1.0 + + + + 4.87 + -6.8385 + 0 + + + 1 + 0 + 0 + + + + + + + + + fcs/yawcontrol3 + -1.0 + + + + -4.87 + -2.9015 + 0 + + + 1 + 0 + 0 + + + + + + + fcs/yawcontrol3 + -1.0 + + + + -4.87 + -6.8385 + 0 + + + -1 + 0 + 0 + + + + + + + + + + + + + Drag + + aero/qbar-psf + 47.9 + 0.0151 + 0.224808943 + + + + + + diff --git a/conf/simulator/jsbsim/aircraft/disco_rotorcraft.xml b/conf/simulator/jsbsim/aircraft/disco_rotorcraft.xml new file mode 100644 index 0000000000..f2f7bdfc4f --- /dev/null +++ b/conf/simulator/jsbsim/aircraft/disco_rotorcraft.xml @@ -0,0 +1,185 @@ + + + + + + Dennis van Wijngaarden + 21-06-2021 + Version 0.9 - beta + Disco rotorcraft + + + + 425 + 45 + 9.45 + 0 + 0 + 0 + 0 + 90 + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + 0.01143077 + 0.00088507457028 + 0.01143077 + 0. + 0. + 0. + 1.653 + + 0 + 0 + 0 + + + + + + + -0.15 + 0 + -0.1 + + 0.8 + 0.5 + 500 + 100 + 1000 + 0.0 + NONE + 0 + + + + + 0.15 + 0 + -0.1 + + 0.8 + 0.5 + 500 + 100 + 1000 + 0.0 + NONE + 0 + + + + + 0. + 0.15 + -0.1 + + 0.8 + 0.5 + 500 + 100 + 1000 + 0.0 + NONE + 0 + + + + + 0. + -0.15 + -0.1 + + 0.8 + 0.5 + 500 + 100 + 1000 + 0.0 + NONE + 0 + + + + + + + + + fcs/ele_left + 54 + fcs/ele_left_lag + + + fcs/ele_right + 54 + fcs/ele_right_lag + + + fcs/mot + 31.7 + fcs/mot_lag + + + + + + + fcs/ele_left + fcs/ele_left_lag + fcs/ele_right + fcs/ele_right_lag + fcs/mot + fcs/mot_lag + fcs/none1 + fcs/none2 + fcs/none3 + fcs/none4 + + + + + + + fcs/mot_lag + 1.7 + + + + 0 + 0 + 0 + + + 0 + 0 + -1 + + + + + + + + + + + + + + diff --git a/conf/telemetry/default_rotorcraft.xml b/conf/telemetry/default_rotorcraft.xml index f2d3480adf..37b9b113a8 100644 --- a/conf/telemetry/default_rotorcraft.xml +++ b/conf/telemetry/default_rotorcraft.xml @@ -36,6 +36,7 @@ + @@ -126,6 +127,7 @@ + diff --git a/conf/userconf/tudelft/conf.xml b/conf/userconf/tudelft/conf.xml index bc475db715..766c752c26 100644 --- a/conf/userconf/tudelft/conf.xml +++ b/conf/userconf/tudelft/conf.xml @@ -436,9 +436,20 @@ telemetry="telemetry/default_rotorcraft.xml" flight_plan="flight_plans/tudelft/delft_bebop.xml" settings="settings/rotorcraft_basic.xml [settings/estimation/ahrs_secondary.xml]" - settings_modules="modules/air_data.xml modules/gps.xml modules/gps_ubx_ucenter.xml modules/guidance_rotorcraft.xml modules/imu_common.xml modules/ins_ekf2.xml modules/nav_basic_rotorcraft.xml modules/stabilization_indi_simple.xml" + settings_modules="modules/air_data.xml modules/gps.xml modules/gps_ublox.xml modules/gps_ubx_ucenter.xml modules/guidance_rotorcraft.xml modules/imu_common.xml modules/ins_ekf2.xml modules/nav_basic_rotorcraft.xml modules/stabilization_indi_simple.xml" gui_color="#baa3d698b729" /> + + z); if(autopilot.mode == AP_MODE_NAV) { - speed_sp = nav_get_speed_setpoint(gih_params.pos_gain); + gi_speed_sp = nav_get_speed_setpoint(gih_params.pos_gain); } else{ - speed_sp.x = pos_x_err * gih_params.pos_gain; - speed_sp.y = pos_y_err * gih_params.pos_gain; - speed_sp.z = pos_z_err * gih_params.pos_gainz; + gi_speed_sp.x = pos_x_err * gih_params.pos_gain; + gi_speed_sp.y = pos_y_err * gih_params.pos_gain; + gi_speed_sp.z = pos_z_err * gih_params.pos_gainz; } //for rc control horizontal, rotate from body axes to NED float psi = eulers_zxy.psi; /*NAV mode*/ - float speed_sp_b_x = cosf(psi) * speed_sp.x + sinf(psi) * speed_sp.y; - float speed_sp_b_y =-sinf(psi) * speed_sp.x + cosf(psi) * speed_sp.y; + float speed_sp_b_x = cosf(psi) * gi_speed_sp.x + sinf(psi) * gi_speed_sp.y; + float speed_sp_b_y =-sinf(psi) * gi_speed_sp.x + cosf(psi) * gi_speed_sp.y; - float airspeed = stateGetAirspeed_f(); + // Get airspeed or zero it + float airspeed; + if (GUIDANCE_INDI_ZERO_AIRSPEED) { + airspeed = 0.0; + } else { + airspeed = stateGetAirspeed_f(); + } struct NedCoor_f *groundspeed = stateGetSpeedNed_f(); struct FloatVect2 airspeed_v = {cos(psi)*airspeed, sin(psi)*airspeed}; struct FloatVect2 windspeed; VECT2_DIFF(windspeed, *groundspeed, airspeed_v); - VECT2_DIFF(desired_airspeed, speed_sp, windspeed); // Use 2d part of speed_sp + VECT2_DIFF(desired_airspeed, gi_speed_sp, windspeed); // Use 2d part of gi_speed_sp float norm_des_as = FLOAT_VECT2_NORM(desired_airspeed); // Make turn instead of straight line - if((airspeed > 10.0) && (norm_des_as > 12.0)) { + if((airspeed > TURN_AIRSPEED_TH) && (norm_des_as > (TURN_AIRSPEED_TH+2.0) )) { // Give the wind cancellation priority. if (norm_des_as > guidance_indi_max_airspeed) { @@ -273,8 +298,8 @@ void guidance_indi_run(float *heading_sp) { // if the wind is faster than we can fly, just fly in the wind direction if(FLOAT_VECT2_NORM(windspeed) < guidance_indi_max_airspeed) { - float av = speed_sp.x * speed_sp.x + speed_sp.y * speed_sp.y; - float bv = -2 * (windspeed.x * speed_sp.x + windspeed.y * speed_sp.y); + float av = gi_speed_sp.x * gi_speed_sp.x + gi_speed_sp.y * gi_speed_sp.y; + float bv = -2 * (windspeed.x * gi_speed_sp.x + windspeed.y * gi_speed_sp.y); float cv = windspeed.x * windspeed.x + windspeed.y * windspeed.y - guidance_indi_max_airspeed * guidance_indi_max_airspeed; float dv = bv * bv - 4.0 * av * cv; @@ -288,8 +313,8 @@ void guidance_indi_run(float *heading_sp) { groundspeed_factor = (-bv + d_sqrt) / (2.0 * av); } - desired_airspeed.x = groundspeed_factor * speed_sp.x - windspeed.x; - desired_airspeed.y = groundspeed_factor * speed_sp.y - windspeed.y; + desired_airspeed.x = groundspeed_factor * gi_speed_sp.x - windspeed.x; + desired_airspeed.y = groundspeed_factor * gi_speed_sp.y - windspeed.y; speed_sp_b_x = guidance_indi_max_airspeed; } @@ -314,7 +339,7 @@ void guidance_indi_run(float *heading_sp) { sp_accel.x = cosf(psi) * sp_accel_b.x - sinf(psi) * sp_accel_b.y; sp_accel.y = sinf(psi) * sp_accel_b.x + cosf(psi) * sp_accel_b.y; - sp_accel.z = (speed_sp.z - stateGetSpeedNed_f()->z) * gih_params.speed_gainz; + sp_accel.z = (gi_speed_sp.z - stateGetSpeedNed_f()->z) * gih_params.speed_gainz; } else { // Go somewhere in the shortest way if(airspeed > 10.0) { @@ -327,12 +352,12 @@ void guidance_indi_run(float *heading_sp) { speed_sp_b_x = guidance_indi_max_airspeed + groundspeed_x - airspeed; } } - speed_sp.x = cosf(psi) * speed_sp_b_x - sinf(psi) * speed_sp_b_y; - speed_sp.y = sinf(psi) * speed_sp_b_x + cosf(psi) * speed_sp_b_y; + gi_speed_sp.x = cosf(psi) * speed_sp_b_x - sinf(psi) * speed_sp_b_y; + gi_speed_sp.y = sinf(psi) * speed_sp_b_x + cosf(psi) * speed_sp_b_y; - sp_accel.x = (speed_sp.x - stateGetSpeedNed_f()->x) * gih_params.speed_gain; - sp_accel.y = (speed_sp.y - stateGetSpeedNed_f()->y) * gih_params.speed_gain; - sp_accel.z = (speed_sp.z - stateGetSpeedNed_f()->z) * gih_params.speed_gainz; + sp_accel.x = (gi_speed_sp.x - stateGetSpeedNed_f()->x) * gih_params.speed_gain; + sp_accel.y = (gi_speed_sp.y - stateGetSpeedNed_f()->y) * gih_params.speed_gain; + sp_accel.z = (gi_speed_sp.z - stateGetSpeedNed_f()->z) * gih_params.speed_gainz; } // Bound the acceleration setpoint @@ -401,7 +426,7 @@ void guidance_indi_run(float *heading_sp) { //Bound euler angles to prevent flipping Bound(guidance_euler_cmd.phi, -guidance_indi_max_bank, guidance_indi_max_bank); - Bound(guidance_euler_cmd.theta, -RadOfDeg(120.0), RadOfDeg(25.0)); + Bound(guidance_euler_cmd.theta, RadOfDeg(GUIDANCE_INDI_MIN_PITCH), RadOfDeg(GUIDANCE_INDI_MAX_PITCH)); // Use the current roll angle to determine the corresponding heading rate of change. float coordinated_turn_roll = eulers_zxy.phi; @@ -429,6 +454,20 @@ void guidance_indi_run(float *heading_sp) { } else { *heading_sp += omega / PERIODIC_FREQUENCY; FLOAT_ANGLE_NORMALIZE(*heading_sp); + // limit heading setpoint to be within bounds of current heading + #ifdef STABILIZATION_ATTITUDE_SP_PSI_DELTA_LIMIT + float delta_limit = STABILIZATION_ATTITUDE_SP_PSI_DELTA_LIMIT; + float heading = stabilization_attitude_get_heading_f(); + + float delta_psi = *heading_sp - heading; + FLOAT_ANGLE_NORMALIZE(delta_psi); + if (delta_psi > delta_limit) { + *heading_sp = heading + delta_limit; + } else if (delta_psi < -delta_limit) { + *heading_sp = heading - delta_limit; + } + FLOAT_ANGLE_NORMALIZE(*heading_sp); + #endif } #endif diff --git a/sw/airborne/firmwares/rotorcraft/guidance/guidance_indi_hybrid.h b/sw/airborne/firmwares/rotorcraft/guidance/guidance_indi_hybrid.h index bfd1ce122e..cb4c85fc19 100644 --- a/sw/airborne/firmwares/rotorcraft/guidance/guidance_indi_hybrid.h +++ b/sw/airborne/firmwares/rotorcraft/guidance/guidance_indi_hybrid.h @@ -39,7 +39,6 @@ extern void guidance_indi_enter(void); extern void guidance_indi_run(float *heading_sp); extern void stabilization_attitude_set_setpoint_rp_quat_f(struct FloatEulers* indi_rp_cmd, bool in_flight, int32_t heading); extern void guidance_indi_init(void); -extern void guidance_indi_propagate_filters(void); struct guidance_indi_hybrid_params { float pos_gain; @@ -49,6 +48,9 @@ struct guidance_indi_hybrid_params { float heading_bank_gain; }; +extern struct FloatVect3 sp_accel; +extern struct FloatVect3 gi_speed_sp; + extern struct guidance_indi_hybrid_params gih_params; extern float guidance_indi_specific_force_gain; extern float guidance_indi_max_airspeed; diff --git a/sw/airborne/firmwares/rotorcraft/navigation.h b/sw/airborne/firmwares/rotorcraft/navigation.h index 46e9e59e67..094a0211ef 100644 --- a/sw/airborne/firmwares/rotorcraft/navigation.h +++ b/sw/airborne/firmwares/rotorcraft/navigation.h @@ -126,11 +126,7 @@ extern void nav_parse_MOVE_WP(uint8_t *buf); extern void set_exception_flag(uint8_t flag_num); -extern float nav_max_speed; extern bool force_forward; -extern struct FloatVect3 nav_get_speed_sp_from_go(struct EnuCoor_i target, float pos_gain); -extern struct FloatVect3 nav_get_speed_setpoint(float pos_gain); -extern struct FloatVect3 nav_get_speed_sp_from_line(struct FloatVect2 line_v, struct FloatVect2 to_end_v, struct EnuCoor_i target, float pos_gain); extern float get_dist2_to_waypoint(uint8_t wp_id); extern float get_dist2_to_point(struct EnuCoor_i *p); diff --git a/sw/tools/parrot/bebop.py b/sw/tools/parrot/bebop.py index 91b3ecf238..10ee53e1a8 100755 --- a/sw/tools/parrot/bebop.py +++ b/sw/tools/parrot/bebop.py @@ -160,7 +160,7 @@ class Bebop(ParrotUtils): # Parse the extra arguments self.parser.add_argument('--min_version', metavar='MIN', default='3.3.0', help='force minimum version allowed') - self.parser.add_argument('--max_version', metavar='MAX', default='4.4.2', + self.parser.add_argument('--max_version', metavar='MAX', default='4.7.1', help='force maximum version allowed') ss = self.subparsers.add_parser('networkid', help='Set the network ID (SSID) to join in managed mode')