diff --git a/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/flight_model.cfg b/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/flight_model.cfg index 8ce69f49594..57b6f651da4 100644 --- a/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/flight_model.cfg +++ b/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/flight_model.cfg @@ -46,6 +46,7 @@ tailwheel_lock = 0 ; Is tailwheel lock available TRUE/FALSE max_number_of_points = 9 ; Number of contact points gear_locked_on_ground = 0 ; Defines whether or not the landing gear handle is locked to down when the plane is on the ground. gear_locked_above_speed = -1 ; Defines the speed at which the landing gear handle becomes locked in the up position. (-1 = Disabled)==> Disabled is kept in favor of an XML-based solution +allow_stopped_steering = 1 ; This can be used to enable (TRUE, 1) steering when the aircraft is stopped or not (FALSE, 0). max_speed_full_steering = 300 ; Defines the speed under which the full angle of steering is available (in feet/second).==> 20 kts or 33.7 ft/sec (was 8) max_speed_decreasing_steering = 350 ; Defines the speed above which the angle of steering stops decreasing (in feet/second). ==> 40 kts or 67.5 ft/sec (was 50) min_available_steering_angle_pct = 0.0 ; Defines the percentage of steering which will always be available even above max_speed_decreasing_steering (in percent over 100) ===> 6 degrees or 0.08% of 75 degrees max deflection (was 0.2 or 15 degrees) diff --git a/fbw-a32nx/src/wasm/systems/a320_systems_wasm/src/nose_wheel_steering.rs b/fbw-a32nx/src/wasm/systems/a320_systems_wasm/src/nose_wheel_steering.rs index e01d7e43511..7c5784d28b3 100644 --- a/fbw-a32nx/src/wasm/systems/a320_systems_wasm/src/nose_wheel_steering.rs +++ b/fbw-a32nx/src/wasm/systems/a320_systems_wasm/src/nose_wheel_steering.rs @@ -132,16 +132,30 @@ pub(super) fn nose_wheel_steering(builder: &mut MsfsAspectBuilder) -> Result<(), steering_demand_to_msfs_from_steering_angle(nose_wheel_position, rudder_position) }, - Variable::aspect("STEERING_ANGLE"), + Variable::aspect("STEERING_ANGLE_COMMAND"), + ); + + builder.map( + ExecuteOn::PostTick, + Variable::aspect("NOSE_WHEEL_POSITION_RATIO"), + steering_max_demand_to_msfs_from_steering_angle, + Variable::aspect("STEERING_ANGLE_MAX_COMMAND"), ); builder.variable_to_event( - Variable::aspect("STEERING_ANGLE"), + Variable::aspect("STEERING_ANGLE_COMMAND"), VariableToEventMapping::EventData32kPosition, VariableToEventWriteOn::EveryTick, "STEERING_SET", )?; + builder.variable_to_event( + Variable::aspect("STEERING_ANGLE_MAX_COMMAND"), + VariableToEventMapping::EventData32kPosition, + VariableToEventWriteOn::EveryTick, + "NOSE_WHEEL_STEERING_LIMIT_SET", + )?; + Ok(()) } @@ -181,3 +195,13 @@ fn steering_demand_to_msfs_from_steering_angle( // This way we end up with actual angle we required (1. - steering_ratio_converted) + (rudder_position - 0.5) } + +fn steering_max_demand_to_msfs_from_steering_angle(nose_wheel_position: f64) -> f64 { + const MAX_MSFS_STEERING_ANGLE_DEGREES: f64 = 180.; + + // Steering in msfs is the max we want rescaled to the max in msfs + nose_wheel_position.abs() * MAX_CONTROLLABLE_STEERING_ANGLE_DEGREES + / MAX_MSFS_STEERING_ANGLE_DEGREES + / 2. + + 0.5 +} diff --git a/fbw-a380x/src/base/flybywire-aircraft-a380-842/SimObjects/AirPlanes/FlyByWire_A380_842/flight_model.cfg b/fbw-a380x/src/base/flybywire-aircraft-a380-842/SimObjects/AirPlanes/FlyByWire_A380_842/flight_model.cfg index 24494ee9dd3..d4bfc59849d 100755 --- a/fbw-a380x/src/base/flybywire-aircraft-a380-842/SimObjects/AirPlanes/FlyByWire_A380_842/flight_model.cfg +++ b/fbw-a380x/src/base/flybywire-aircraft-a380-842/SimObjects/AirPlanes/FlyByWire_A380_842/flight_model.cfg @@ -74,6 +74,7 @@ tailwheel_lock = 0 ; Is tailwheel lock available TRUE/FALSE max_number_of_points = 11 ; Number of contact points gear_locked_on_ground = 0 ; Defines whether or not the landing gear handle is locked to down when the plane is on the ground. gear_locked_above_speed = -1 ; Defines the speed at which the landing gear handle becomes locked in the up position. (-1 = Disabled)==> Disabled is kept in favor of an XML-based solution +allow_stopped_steering = 1 ; This can be used to enable (TRUE, 1) steering when the aircraft is stopped or not (FALSE, 0). max_speed_full_steering = 300 ; Defines the speed under which the full angle of steering is available (in feet/second).==> 20 kts or 33.7 ft/sec (was 8) max_speed_decreasing_steering = 350 ; Defines the speed above which the angle of steering stops decreasing (in feet/second). ==> 40 kts or 67.5 ft/sec (was 50) min_available_steering_angle_pct = 0.0 ; Defines the percentage of steering which will always be available even above max_speed_decreasing_steering (in percent over 100) ===> 6 degrees or 0.08% of 75 degrees max deflection (was 0.2 or 15 degrees) diff --git a/fbw-a380x/src/wasm/systems/a380_systems_wasm/src/nose_wheel_steering.rs b/fbw-a380x/src/wasm/systems/a380_systems_wasm/src/nose_wheel_steering.rs index 3140c8dc2eb..b96d30ba478 100644 --- a/fbw-a380x/src/wasm/systems/a380_systems_wasm/src/nose_wheel_steering.rs +++ b/fbw-a380x/src/wasm/systems/a380_systems_wasm/src/nose_wheel_steering.rs @@ -132,16 +132,30 @@ pub(super) fn nose_wheel_steering(builder: &mut MsfsAspectBuilder) -> Result<(), steering_demand_to_msfs_from_steering_angle(nose_wheel_position, rudder_position) }, - Variable::aspect("STEERING_ANGLE"), + Variable::aspect("STEERING_ANGLE_COMMAND"), + ); + + builder.map( + ExecuteOn::PostTick, + Variable::aspect("NOSE_WHEEL_POSITION_RATIO"), + steering_max_demand_to_msfs_from_steering_angle, + Variable::aspect("STEERING_ANGLE_MAX_COMMAND"), ); builder.variable_to_event( - Variable::aspect("STEERING_ANGLE"), + Variable::aspect("STEERING_ANGLE_COMMAND"), VariableToEventMapping::EventData32kPosition, VariableToEventWriteOn::EveryTick, "STEERING_SET", )?; + builder.variable_to_event( + Variable::aspect("STEERING_ANGLE_MAX_COMMAND"), + VariableToEventMapping::EventData32kPosition, + VariableToEventWriteOn::EveryTick, + "NOSE_WHEEL_STEERING_LIMIT_SET", + )?; + // Adds rotational speed to nose wheel based on steering angle const STEERING_RATIO_TO_WHEEL_ANGLE_GAIN: f64 = 80.; builder.map_many( @@ -207,6 +221,16 @@ fn steering_demand_to_msfs_from_steering_angle( (1. - steering_ratio_converted) + (rudder_position - 0.5) } +fn steering_max_demand_to_msfs_from_steering_angle(nose_wheel_position: f64) -> f64 { + const MAX_MSFS_STEERING_ANGLE_DEGREES: f64 = 180.; + + // Steering in msfs is the max we want rescaled to the max in msfs + nose_wheel_position.abs() * MAX_CONTROLLABLE_STEERING_ANGLE_DEGREES + / MAX_MSFS_STEERING_ANGLE_DEGREES + / 2. + + 0.5 +} + fn normalise_angle(angle: f64) -> f64 { let raw = angle % 360.;