Compare commits

...

2 Commits

3 changed files with 52 additions and 29 deletions

View File

@@ -307,6 +307,7 @@ Thrusters = {
primary_altitude_thruster = true,
primary_fore_thruster = false,
primary_aft_thruster = false,
x_config_equivalent = "1", -- if you're running a standard x configuration, what prop is this equivalent to?
type = "rotator",
name = "gyroscopic_propeller_bearing_0",
thruster = nil,
@@ -334,6 +335,7 @@ Thrusters = {
primary_altitude_thruster = true,
primary_fore_thruster = false,
primary_aft_thruster = false,
x_config_equivalent = "2", -- if you're running a standard x configuration, what prop is this equivalent to?
type = "rotator",
name = "gyroscopic_propeller_bearing_1",
thruster = nil,
@@ -361,6 +363,7 @@ Thrusters = {
primary_altitude_thruster = true,
primary_fore_thruster = false,
primary_aft_thruster = false,
x_config_equivalent = "4", -- if you're running a standard x configuration, what prop is this equivalent to?
type = "rotator",
name = "gyroscopic_propeller_bearing_2",
thruster = nil,
@@ -388,6 +391,7 @@ Thrusters = {
primary_altitude_thruster = true,
primary_fore_thruster = false,
primary_aft_thruster = false,
x_config_equivalent = "3", -- if you're running a standard x configuration, what prop is this equivalent to?
type = "rotator",
name = "gyroscopic_propeller_bearing_3",
thruster = nil,

View File

@@ -961,6 +961,8 @@ function UpdateGlobalThrust()
for _, thruster in pairs(Thrusters) do
local desiredThrust = 0
if thruster.x_config_equivalent ~= nil then
-- Calculate desired thrust based on affectVectors and PID outputs
if thruster.affectVectors.angular.pitch ~= nil and thruster.primary_pitch_thruster then
if thruster.affectVectors.angular.pitch == "up" then
@@ -994,6 +996,19 @@ function UpdateGlobalThrust()
--if Config.Debug then print("DEBUG: "..thruster.name..": desiredThrust "..desiredThrust.." (from UpdateGlobalThrust)") end
SetThrusterPower(thruster, desiredThrust)
else
local prop1 = throttleOutput + pitchRateOutput + rollRateOutput -- front-left
local prop2 = throttleOutput + pitchRateOutput - rollRateOutput -- front-right
local prop3 = throttleOutput - pitchRateOutput - rollRateOutput -- back-right
local prop4 = throttleOutput - pitchRateOutput + rollRateOutput -- back-left
if thruster.x_config_equivalent == "1" then SetThrusterPower(thruster, prop1)
elseif thruster.x_config_equivalent == "2" then SetThrusterPower(thruster, prop2)
elseif thruster.x_config_equivalent == "3" then SetThrusterPower(thruster, prop3)
elseif thruster.x_config_equivalent == "4" then SetThrusterPower(thruster, prop4)
else print("ERROR: Thruster "..thruster.name.." has invalid x_config_equivalent value")
end
end
end
end

View File

@@ -6,6 +6,7 @@ return {
primary_altitude_thruster = true,
primary_fore_thruster = false,
primary_aft_thruster = false,
x_config_equivalent = "1",
type = "rotator",
name = "gyroscopic_propeller_bearing_0",
thruster = nil,
@@ -31,6 +32,7 @@ return {
primary_altitude_thruster = true,
primary_fore_thruster = false,
primary_aft_thruster = false,
x_config_equivalent = "2",
type = "rotator",
name = "gyroscopic_propeller_bearing_1",
thruster = nil,
@@ -56,6 +58,7 @@ return {
primary_altitude_thruster = true,
primary_fore_thruster = false,
primary_aft_thruster = false,
x_config_equivalent = "4",
type = "rotator",
name = "gyroscopic_propeller_bearing_2",
thruster = nil,
@@ -81,6 +84,7 @@ return {
primary_altitude_thruster = true,
primary_fore_thruster = false,
primary_aft_thruster = false,
x_config_equivalent = "3",
type = "rotator",
name = "gyroscopic_propeller_bearing_3",
thruster = nil,