@@ -957,12 +957,12 @@ FixedwingPositionControl::control_position(const hrt_abstime &now, const Vector2
957
957
float target_airspeed = calculate_target_airspeed (mission_airspeed, ground_speed);
958
958
959
959
if (_param_fw_use_npfg.get ()) {
960
- _npfg.setAirspeedNom (target_airspeed);
961
- _npfg.setAirspeedMax (_param_fw_airspd_max.get ());
960
+ _npfg.setAirspeedNom (target_airspeed * _eas2tas );
961
+ _npfg.setAirspeedMax (_param_fw_airspd_max.get () * _eas2tas );
962
962
_npfg.navigateWaypoints (prev_wp, curr_wp, curr_pos, ground_speed, _wind_vel);
963
963
_att_sp.roll_body = _npfg.getRollSetpoint ();
964
964
_att_sp.yaw_body = _npfg.getBearing ();
965
- target_airspeed = _npfg.getAirspeedRef ();
965
+ target_airspeed = _npfg.getAirspeedRef () / _eas2tas ;
966
966
967
967
} else {
968
968
_l1_control.navigate_waypoints (prev_wp, curr_wp, curr_pos, nav_speed_2d);
@@ -1009,12 +1009,12 @@ FixedwingPositionControl::control_position(const hrt_abstime &now, const Vector2
1009
1009
float target_airspeed = calculate_target_airspeed (mission_airspeed, ground_speed);
1010
1010
1011
1011
if (_param_fw_use_npfg.get ()) {
1012
- _npfg.setAirspeedNom (target_airspeed);
1013
- _npfg.setAirspeedMax (_param_fw_airspd_max.get ());
1012
+ _npfg.setAirspeedNom (target_airspeed * _eas2tas );
1013
+ _npfg.setAirspeedMax (_param_fw_airspd_max.get () * _eas2tas );
1014
1014
_npfg.navigateLoiter (curr_wp, curr_pos, loiter_radius, loiter_direction, ground_speed, _wind_vel);
1015
1015
_att_sp.roll_body = _npfg.getRollSetpoint ();
1016
1016
_att_sp.yaw_body = _npfg.getBearing ();
1017
- target_airspeed = _npfg.getAirspeedRef ();
1017
+ target_airspeed = _npfg.getAirspeedRef () / _eas2tas ;
1018
1018
1019
1019
} else {
1020
1020
_l1_control.navigate_loiter (curr_wp, curr_pos, loiter_radius, loiter_direction, nav_speed_2d);
@@ -1167,13 +1167,15 @@ FixedwingPositionControl::control_position(const hrt_abstime &now, const Vector2
1167
1167
1168
1168
if (_param_fw_use_npfg.get ()) {
1169
1169
_npfg.enableWindExcessRegulation (false ); // disable as we are not letting npfg control airspeed anyway
1170
- _npfg.setAirspeedNom (altctrl_airspeed);
1171
- _npfg.setAirspeedMax (_param_fw_airspd_max.get ());
1170
+ _npfg.setAirspeedNom (altctrl_airspeed * _eas2tas );
1171
+ _npfg.setAirspeedMax (_param_fw_airspd_max.get () * _eas2tas );
1172
1172
_npfg.navigateWaypoints (prev_wp, curr_wp, curr_pos, ground_speed, _wind_vel);
1173
1173
_att_sp.roll_body = _npfg.getRollSetpoint ();
1174
1174
_att_sp.yaw_body = _npfg.getBearing ();
1175
1175
_npfg.enableWindExcessRegulation (_param_npfg_en_wind_reg.get ()); // reset to user defined value in case we switch modes
1176
1176
1177
+ altctrl_airspeed = _npfg.getAirspeedRef () / _eas2tas;
1178
+
1177
1179
} else {
1178
1180
/* populate l1 control setpoint */
1179
1181
_l1_control.navigate_waypoints (prev_wp, curr_wp, curr_pos, ground_speed);
@@ -1375,12 +1377,14 @@ FixedwingPositionControl::control_takeoff(const hrt_abstime &now, const Vector2d
1375
1377
ground_speed);
1376
1378
1377
1379
if (_param_fw_use_npfg.get ()) {
1378
- _npfg.setAirspeedNom (target_airspeed);
1379
- _npfg.setAirspeedMax (_param_fw_airspd_max.get ());
1380
+ _npfg.setAirspeedNom (target_airspeed * _eas2tas );
1381
+ _npfg.setAirspeedMax (_param_fw_airspd_max.get () * _eas2tas );
1380
1382
_npfg.navigateWaypoints (_runway_takeoff.getStartWP (), curr_wp, curr_pos, ground_speed, _wind_vel);
1381
1383
_att_sp.roll_body = _runway_takeoff.getRoll (_npfg.getRollSetpoint ());
1382
1384
_att_sp.yaw_body = _runway_takeoff.getYaw (_npfg.getBearing ());
1383
1385
1386
+ target_airspeed = _npfg.getAirspeedRef () / _eas2tas;
1387
+
1384
1388
} else {
1385
1389
/*
1386
1390
* Update navigation: _runway_takeoff returns the start WP according to mode and phase.
@@ -1463,12 +1467,12 @@ FixedwingPositionControl::control_takeoff(const hrt_abstime &now, const Vector2d
1463
1467
float target_airspeed = _param_fw_airspd_trim.get ();
1464
1468
1465
1469
if (_param_fw_use_npfg.get ()) {
1466
- _npfg.setAirspeedNom (target_airspeed);
1467
- _npfg.setAirspeedMax (_param_fw_airspd_max.get ());
1470
+ _npfg.setAirspeedNom (target_airspeed * _eas2tas );
1471
+ _npfg.setAirspeedMax (_param_fw_airspd_max.get () * _eas2tas );
1468
1472
_npfg.navigateWaypoints (prev_wp, curr_wp, curr_pos, ground_speed, _wind_vel);
1469
1473
_att_sp.roll_body = _npfg.getRollSetpoint ();
1470
1474
_att_sp.yaw_body = _npfg.getBearing ();
1471
- target_airspeed = _npfg.getAirspeedRef ();
1475
+ target_airspeed = _npfg.getAirspeedRef () / _eas2tas ;
1472
1476
1473
1477
} else {
1474
1478
_l1_control.navigate_waypoints (prev_wp, curr_wp, curr_pos, ground_speed);
@@ -1495,12 +1499,12 @@ FixedwingPositionControl::control_takeoff(const hrt_abstime &now, const Vector2d
1495
1499
float target_airspeed = calculate_target_airspeed (_param_fw_airspd_trim.get (), ground_speed);
1496
1500
1497
1501
if (_param_fw_use_npfg.get ()) {
1498
- _npfg.setAirspeedNom (target_airspeed);
1499
- _npfg.setAirspeedMax (_param_fw_airspd_max.get ());
1502
+ _npfg.setAirspeedNom (target_airspeed * _eas2tas );
1503
+ _npfg.setAirspeedMax (_param_fw_airspd_max.get () * _eas2tas );
1500
1504
_npfg.navigateWaypoints (prev_wp, curr_wp, curr_pos, ground_speed, _wind_vel);
1501
1505
_att_sp.roll_body = _npfg.getRollSetpoint ();
1502
1506
_att_sp.yaw_body = _npfg.getBearing ();
1503
- target_airspeed = _npfg.getAirspeedRef ();
1507
+ target_airspeed = _npfg.getAirspeedRef () / _eas2tas ;
1504
1508
1505
1509
} else {
1506
1510
_l1_control.navigate_waypoints (prev_wp, curr_wp, curr_pos, ground_speed);
@@ -1676,8 +1680,8 @@ FixedwingPositionControl::control_landing(const hrt_abstime &now, const Vector2d
1676
1680
float target_airspeed = calculate_target_airspeed (airspeed_land, ground_speed);
1677
1681
1678
1682
if (_param_fw_use_npfg.get ()) {
1679
- _npfg.setAirspeedNom (target_airspeed);
1680
- _npfg.setAirspeedMax (_param_fw_airspd_max.get ());
1683
+ _npfg.setAirspeedNom (target_airspeed * _eas2tas );
1684
+ _npfg.setAirspeedMax (_param_fw_airspd_max.get () * _eas2tas );
1681
1685
1682
1686
if (_land_noreturn_horizontal) {
1683
1687
// heading hold
@@ -1690,7 +1694,7 @@ FixedwingPositionControl::control_landing(const hrt_abstime &now, const Vector2d
1690
1694
1691
1695
_att_sp.roll_body = _npfg.getRollSetpoint ();
1692
1696
_att_sp.yaw_body = _npfg.getBearing ();
1693
- target_airspeed = _npfg.getAirspeedRef ();
1697
+ target_airspeed = _npfg.getAirspeedRef () / _eas2tas ;
1694
1698
1695
1699
} else {
1696
1700
if (_land_noreturn_horizontal) {
@@ -1816,8 +1820,8 @@ FixedwingPositionControl::control_landing(const hrt_abstime &now, const Vector2d
1816
1820
float target_airspeed = calculate_target_airspeed (airspeed_approach, ground_speed);
1817
1821
1818
1822
if (_param_fw_use_npfg.get ()) {
1819
- _npfg.setAirspeedNom (target_airspeed);
1820
- _npfg.setAirspeedMax (_param_fw_airspd_max.get ());
1823
+ _npfg.setAirspeedNom (target_airspeed * _eas2tas );
1824
+ _npfg.setAirspeedMax (_param_fw_airspd_max.get () * _eas2tas );
1821
1825
1822
1826
if (_land_noreturn_horizontal) {
1823
1827
// heading hold
@@ -1830,7 +1834,7 @@ FixedwingPositionControl::control_landing(const hrt_abstime &now, const Vector2d
1830
1834
1831
1835
_att_sp.roll_body = _npfg.getRollSetpoint ();
1832
1836
_att_sp.yaw_body = _npfg.getBearing ();
1833
- target_airspeed = _npfg.getAirspeedRef ();
1837
+ target_airspeed = _npfg.getAirspeedRef () / _eas2tas ;
1834
1838
1835
1839
} else {
1836
1840
if (_land_noreturn_horizontal) {
0 commit comments