@@ -733,31 +733,17 @@ FixedwingPositionControl::getManualHeightRateSetpoint()
733
733
return height_rate_setpoint;
734
734
}
735
735
736
+ // TADY/////////////////////////////////////////////////////////////////////////////////////////////////TADY
736
737
void
737
738
FixedwingPositionControl::updateManualTakeoffStatus ()
738
739
{
739
-
740
- // a VTOL does not need special takeoff handling
741
- if (_vehicle_status.is_vtol ) {
742
- return false ;
743
- }
744
-
745
- if (_autogyro_takeoff.autogyroTakeoffEnabled ()) {
746
- return (!_autogyro_takeoff.isInitialized () || _autogyro_takeoff.climbout ());
747
- }
748
-
749
740
if (!_completed_manual_takeoff) {
750
741
const bool at_controllable_airspeed = _airspeed > _param_fw_airspd_min.get ()
751
742
|| !_airspeed_valid;
752
743
const bool is_hovering = _vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING
753
744
&& _control_mode.flag_armed ;
754
745
_completed_manual_takeoff = (!_landed && at_controllable_airspeed) || is_hovering;
755
746
}
756
-
757
- // in air for < 10s
758
- return (hrt_elapsed_time (&_time_went_in_air) < 10_s)
759
- && (_current_altitude <= _takeoff_ground_alt + _param_fw_clmbout_diff.get ());
760
-
761
747
}
762
748
763
749
void
@@ -1435,25 +1421,39 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo
1435
1421
_autogyro_takeoff.update (now, _airspeed, _rotor_rpm, _current_altitude - _takeoff_ground_alt,
1436
1422
_current_latitude, _current_longitude, &_mavlink_log_pub);
1437
1423
1438
- float target_airspeed = get_auto_airspeed_setpoint (control_interval,
1439
- _runway_takeoff.getMinAirspeedScaling () * _param_fw_airspd_min.get (), ground_speed);
1440
- /*
1441
- * Update navigation: _autogyro_takeoff returns the start WP according to mode and phase.
1442
- * If we use the navigator heading or not is decided later.
1443
- */
1444
- Vector2f prev_wp_local = _global_local_proj_ref.project (_runway_takeoff.getStartWP ()(0 ),
1445
- _runway_takeoff.getStartWP ()(1 ));
1424
+ const float takeoff_airspeed = _runway_takeoff.getMinAirspeedScaling () * _param_fw_airspd_min.get ();
1425
+ float adjusted_min_airspeed = _param_fw_airspd_min.get ();
1426
+
1427
+ if (takeoff_airspeed < _param_fw_airspd_min.get ()) {
1428
+ // adjust underspeed detection bounds for takeoff airspeed
1429
+ _tecs.set_equivalent_airspeed_min (takeoff_airspeed);
1430
+ adjusted_min_airspeed = takeoff_airspeed;
1431
+ }
1432
+
1433
+ float target_airspeed = get_auto_airspeed_setpoint (control_interval, takeoff_airspeed, adjusted_min_airspeed,
1434
+ ground_speed);
1435
+
1436
+
1437
+ const Vector2f start_pos_local = _global_local_proj_ref.project (_runway_takeoff.getStartPosition ()(0 ),
1438
+ _runway_takeoff.getStartPosition ()(1 ));
1439
+ const Vector2f takeoff_waypoint_local = _global_local_proj_ref.project (pos_sp_curr.lat , pos_sp_curr.lon );
1440
+
1441
+ // the bearing from runway start to the takeoff waypoint is followed until the clearance altitude is exceeded
1442
+ const Vector2f takeoff_bearing_vector = calculateTakeoffBearingVector (start_pos_local, takeoff_waypoint_local);
1443
+
1446
1444
1447
1445
if (_param_fw_use_npfg.get ()) {
1448
1446
_npfg.setAirspeedNom (target_airspeed * _eas2tas);
1449
1447
_npfg.setAirspeedMax (_param_fw_airspd_max.get () * _eas2tas);
1450
- _npfg.navigateWaypoints (prev_wp_local, curr_wp_local, curr_pos_local, ground_speed, _wind_vel);
1448
+ _npfg.navigatePathTangent (local_2D_position, start_pos_local, takeoff_bearing_vector, ground_speed,
1449
+ _wind_vel, 0 .0f );
1451
1450
1452
1451
_att_sp.roll_body = _autogyro_takeoff.getRoll (_npfg.getRollSetpoint ());
1453
1452
target_airspeed = _npfg.getAirspeedRef () / _eas2tas;
1454
1453
1455
1454
} else {
1456
- _l1_control.navigate_waypoints (prev_wp_local, curr_wp_local, curr_pos_local, ground_speed);
1455
+ const Vector2f virtual_waypoint = start_pos_local + takeoff_bearing_vector * HDG_HOLD_DIST_NEXT;
1456
+ _l1_control.navigate_waypoints (start_pos_local, virtual_waypoint, local_2D_position, ground_speed);
1457
1457
_att_sp.roll_body = _autogyro_takeoff.getRoll (_l1_control.get_roll_setpoint ());
1458
1458
}
1459
1459
@@ -1468,7 +1468,6 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo
1468
1468
radians (takeoff_pitch_max_deg),
1469
1469
_param_fw_thr_min.get (),
1470
1470
_param_fw_thr_max.get (), // XXX should we also set autogyro_takeoff_throttle here?
1471
- _param_fw_thr_cruise.get (),
1472
1471
_autogyro_takeoff.climbout (),
1473
1472
radians (_autogyro_takeoff.getMinPitch (_takeoff_pitch_min.get (), _param_fw_p_lim_min.get ())),
1474
1473
tecs_status_s::TECS_MODE_TAKEOFF);
@@ -1481,7 +1480,10 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo
1481
1480
_att_sp.roll_reset_integral = _autogyro_takeoff.resetIntegrators ();
1482
1481
_att_sp.pitch_reset_integral = _autogyro_takeoff.resetIntegrators ();
1483
1482
1484
- } else if (_runway_takeoff.runwayTakeoffEnabled ()) {
1483
+ }
1484
+
1485
+ // ///////////////////////////////////////////////////////////RUNWAY
1486
+ else if (_runway_takeoff.runwayTakeoffEnabled ()) {
1485
1487
if (!_runway_takeoff.isInitialized ()) {
1486
1488
_runway_takeoff.init (now, _yaw, global_position);
1487
1489
@@ -1599,7 +1601,10 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo
1599
1601
_att_sp.apply_flaps = vehicle_attitude_setpoint_s::FLAPS_TAKEOFF;
1600
1602
_att_sp.apply_spoilers = vehicle_attitude_setpoint_s::SPOILERS_OFF;
1601
1603
1602
- } else {
1604
+ }
1605
+
1606
+ // /////////LOUNCH
1607
+ else {
1603
1608
/* Perform launch detection */
1604
1609
if (!_skipping_takeoff_detection && _launchDetector.launchDetectionEnabled () &&
1605
1610
_launch_detection_state != LAUNCHDETECTION_RES_DETECTED_ENABLEMOTORS) {
@@ -1742,7 +1747,7 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo
1742
1747
_att_sp.thrust_body [0 ] = _runway_takeoff.getThrottle (now, get_tecs_thrust ());
1743
1748
1744
1749
} else if (_autogyro_takeoff.autogyroTakeoffEnabled ()) {
1745
- PX4_INFO (" Spoustim GETTHROTTLE" );
1750
+ // PX4_INFO("Spoustim GETTHROTTLE");
1746
1751
_att_sp.thrust_body [0 ] = _autogyro_takeoff.getThrottle (now, get_tecs_thrust ());
1747
1752
1748
1753
} else {
0 commit comments