Compare commits
2 Commits
056c10c346
...
fa96b2f59f
| Author | SHA1 | Date | |
|---|---|---|---|
| fa96b2f59f | |||
| f816761e0f |
4
docs.md
4
docs.md
@@ -307,6 +307,7 @@ Thrusters = {
|
|||||||
primary_altitude_thruster = true,
|
primary_altitude_thruster = true,
|
||||||
primary_fore_thruster = false,
|
primary_fore_thruster = false,
|
||||||
primary_aft_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",
|
type = "rotator",
|
||||||
name = "gyroscopic_propeller_bearing_0",
|
name = "gyroscopic_propeller_bearing_0",
|
||||||
thruster = nil,
|
thruster = nil,
|
||||||
@@ -334,6 +335,7 @@ Thrusters = {
|
|||||||
primary_altitude_thruster = true,
|
primary_altitude_thruster = true,
|
||||||
primary_fore_thruster = false,
|
primary_fore_thruster = false,
|
||||||
primary_aft_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",
|
type = "rotator",
|
||||||
name = "gyroscopic_propeller_bearing_1",
|
name = "gyroscopic_propeller_bearing_1",
|
||||||
thruster = nil,
|
thruster = nil,
|
||||||
@@ -361,6 +363,7 @@ Thrusters = {
|
|||||||
primary_altitude_thruster = true,
|
primary_altitude_thruster = true,
|
||||||
primary_fore_thruster = false,
|
primary_fore_thruster = false,
|
||||||
primary_aft_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",
|
type = "rotator",
|
||||||
name = "gyroscopic_propeller_bearing_2",
|
name = "gyroscopic_propeller_bearing_2",
|
||||||
thruster = nil,
|
thruster = nil,
|
||||||
@@ -388,6 +391,7 @@ Thrusters = {
|
|||||||
primary_altitude_thruster = true,
|
primary_altitude_thruster = true,
|
||||||
primary_fore_thruster = false,
|
primary_fore_thruster = false,
|
||||||
primary_aft_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",
|
type = "rotator",
|
||||||
name = "gyroscopic_propeller_bearing_3",
|
name = "gyroscopic_propeller_bearing_3",
|
||||||
thruster = nil,
|
thruster = nil,
|
||||||
|
|||||||
73
main.lua
73
main.lua
@@ -961,39 +961,54 @@ function UpdateGlobalThrust()
|
|||||||
for _, thruster in pairs(Thrusters) do
|
for _, thruster in pairs(Thrusters) do
|
||||||
local desiredThrust = 0
|
local desiredThrust = 0
|
||||||
|
|
||||||
-- Calculate desired thrust based on affectVectors and PID outputs
|
if thruster.x_config_equivalent ~= nil then
|
||||||
if thruster.affectVectors.angular.pitch ~= nil and thruster.primary_pitch_thruster then
|
|
||||||
if thruster.affectVectors.angular.pitch == "up" then
|
-- Calculate desired thrust based on affectVectors and PID outputs
|
||||||
desiredThrust = desiredThrust + pitchRateOutput
|
if thruster.affectVectors.angular.pitch ~= nil and thruster.primary_pitch_thruster then
|
||||||
else
|
if thruster.affectVectors.angular.pitch == "up" then
|
||||||
desiredThrust = desiredThrust - pitchRateOutput
|
desiredThrust = desiredThrust + pitchRateOutput
|
||||||
end
|
else
|
||||||
end
|
desiredThrust = desiredThrust - pitchRateOutput
|
||||||
|
end
|
||||||
if thruster.affectVectors.angular.roll ~= nil and thruster.primary_roll_thruster then
|
|
||||||
if thruster.affectVectors.angular.roll == "port" then
|
|
||||||
desiredThrust = desiredThrust + rollRateOutput
|
|
||||||
else
|
|
||||||
desiredThrust = desiredThrust - rollRateOutput
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
if thruster.affectVectors.angular.roll ~= nil and thruster.primary_roll_thruster then
|
||||||
|
if thruster.affectVectors.angular.roll == "port" then
|
||||||
if thruster.affectVectors.angular.yaw ~= nil and thruster.primary_yaw_thruster then
|
desiredThrust = desiredThrust + rollRateOutput
|
||||||
if thruster.affectVectors.angular.yaw == "port" then
|
else
|
||||||
desiredThrust = desiredThrust + yawRateOutput
|
desiredThrust = desiredThrust - rollRateOutput
|
||||||
else
|
end
|
||||||
desiredThrust = desiredThrust - yawRateOutput
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if thruster.affectVectors.angular.yaw ~= nil and thruster.primary_yaw_thruster then
|
||||||
|
if thruster.affectVectors.angular.yaw == "port" then
|
||||||
|
desiredThrust = desiredThrust + yawRateOutput
|
||||||
|
else
|
||||||
|
desiredThrust = desiredThrust - yawRateOutput
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if thruster.affectVectors.lateral.y == "up" then
|
||||||
|
desiredThrust = desiredThrust + throttleOutput
|
||||||
|
end
|
||||||
|
|
||||||
|
--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
|
||||||
|
|
||||||
if thruster.affectVectors.lateral.y == "up" then
|
|
||||||
desiredThrust = desiredThrust + throttleOutput
|
|
||||||
end
|
|
||||||
|
|
||||||
--if Config.Debug then print("DEBUG: "..thruster.name..": desiredThrust "..desiredThrust.." (from UpdateGlobalThrust)") end
|
|
||||||
|
|
||||||
SetThrusterPower(thruster, desiredThrust)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ return {
|
|||||||
primary_altitude_thruster = true,
|
primary_altitude_thruster = true,
|
||||||
primary_fore_thruster = false,
|
primary_fore_thruster = false,
|
||||||
primary_aft_thruster = false,
|
primary_aft_thruster = false,
|
||||||
|
x_config_equivalent = "1",
|
||||||
type = "rotator",
|
type = "rotator",
|
||||||
name = "gyroscopic_propeller_bearing_0",
|
name = "gyroscopic_propeller_bearing_0",
|
||||||
thruster = nil,
|
thruster = nil,
|
||||||
@@ -31,6 +32,7 @@ return {
|
|||||||
primary_altitude_thruster = true,
|
primary_altitude_thruster = true,
|
||||||
primary_fore_thruster = false,
|
primary_fore_thruster = false,
|
||||||
primary_aft_thruster = false,
|
primary_aft_thruster = false,
|
||||||
|
x_config_equivalent = "2",
|
||||||
type = "rotator",
|
type = "rotator",
|
||||||
name = "gyroscopic_propeller_bearing_1",
|
name = "gyroscopic_propeller_bearing_1",
|
||||||
thruster = nil,
|
thruster = nil,
|
||||||
@@ -56,6 +58,7 @@ return {
|
|||||||
primary_altitude_thruster = true,
|
primary_altitude_thruster = true,
|
||||||
primary_fore_thruster = false,
|
primary_fore_thruster = false,
|
||||||
primary_aft_thruster = false,
|
primary_aft_thruster = false,
|
||||||
|
x_config_equivalent = "4",
|
||||||
type = "rotator",
|
type = "rotator",
|
||||||
name = "gyroscopic_propeller_bearing_2",
|
name = "gyroscopic_propeller_bearing_2",
|
||||||
thruster = nil,
|
thruster = nil,
|
||||||
@@ -81,6 +84,7 @@ return {
|
|||||||
primary_altitude_thruster = true,
|
primary_altitude_thruster = true,
|
||||||
primary_fore_thruster = false,
|
primary_fore_thruster = false,
|
||||||
primary_aft_thruster = false,
|
primary_aft_thruster = false,
|
||||||
|
x_config_equivalent = "3",
|
||||||
type = "rotator",
|
type = "rotator",
|
||||||
name = "gyroscopic_propeller_bearing_3",
|
name = "gyroscopic_propeller_bearing_3",
|
||||||
thruster = nil,
|
thruster = nil,
|
||||||
|
|||||||
Reference in New Issue
Block a user