Vessel unstability when opening Scenario Editor during moving

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
1,480
Reaction score
2,207
Points
128
Location
Lviv
Preferred Pronouns
he/him
I'm not noticing this issue for the DG (on Lua), but it happens with my custom vessel based on Lua. Maybe there're some problems with my short Lua code or/and with my TD points definitions. I will be glad if someone could test it.

So, I'm starting moving on a runway, then when speed isn't zero (for example ~1 m/s), I press Ctrl F4, then select the Scenario Editor, and the vessel is diving underground. This issue doesn't occur when the vessel is completely stopped. My Lua vessel code example:
Code:
--[[
; Example for a script-driven vessel class definition.
; For implementation code, see Orbitersdk/samples/ScriptVessel
; This file contains both the configuration and script parts.
; The config part is terminated by 'END_PARSE' to prevent the
; Orbiter parser from reading the script, and enclosed in Lua
; comment brackets to make it a comment for the script interpreter.

; A. Configuration section
; -------------------------------------------
ClassName =TestVessel
Module = ScriptVessel
Script = TestVessel.cfg
END_PARSE




; B. Script section
; -------------------------------------------
--]]

-- Vessel parameters

vprm = {                           -- general Parameters
  emass = 500,                     -- empty mass [kg]
  fuelmass = 750,                  -- propellant mass [kg]
  size = 50,                       -- mean radius [m]
  pmi = {x=10,y=30,z=10},          -- principal moments of inertia [m^2]
  cs = {x=10,y=8,z=10},            -- cross sections [m^2]
  rd = {x=5,y=0.1,z=5},        -- rotation drag coefficients
  co = {x=0,y=0,z=0},              -- cockpit camera offset
  td1 = {x=0,y=-12,z=100},         -- touchdown point: front
  td2 = {x=-20,y=-12,z=-50},       -- touchdown point: left
  td3 = {x=20,y=-12,z=-50}         -- touchdown point: right
}

thhovr_prm = {                     -- hover thruster parameters
  pos = {x=0,y=0,z=0},             -- thrust attack point [m]
  dir = {x=0,y=1,z=0},             -- thrust direction
  maxth0 = 1.5e4,                  -- max. vacuum thrust [N]
  isp0 = 5e5                       -- vacuum ISP value [m/s]
}
thrcs_prm = {                      -- RCS thruster parameters
  maxth0 = 2e3,                    -- max. vaccum thrust [N]
  isp0 = 5e4                       -- vacuum ISP value [m/s]
}

-- SetClassCaps implementation

function clbk_setclasscaps(cfg)

  -- physical vessel parameters
  vi:set_size(vprm.size)
  vi:set_emptymass(vprm.emass)
  vi:set_pmi(vprm.pmi)
  vi:set_crosssections(vprm.cs)
  vi:set_rotdrag(vprm.rd)
  vi:set_touchdownpoints(vprm.td1,vprm.td2,vprm.td3)
 
  -- propellant resources
  hProp = vi:create_propellantresource(vprm.fuelmass)

  -- hover engine
  thhovr_prm.hprop = hProp
  thhovr = vi:create_thruster(thhovr_prm)
  thghovr = vi:create_thrustergroup({thhovr},THGROUP.HOVER)
 
  -- RCS engines
  th = thrcs_prm.maxth0
  isp = thrcs_prm.isp0
  thrcs0  = vi:create_thruster({pos={x=1,y=0,z=3},dir={x=0,y=1,z=0},maxth0=th,isp0=isp,hprop=hProp})
  thrcs1  = vi:create_thruster({pos={x=1,y=0,z=3},dir={x=0,y=-1,z=0},maxth0=th,isp0=isp,hprop=hProp})
  thrcs2  = vi:create_thruster({pos={x=-1,y=0,z=3},dir={x=0,y=1,z=0},maxth0=th,isp0=isp,hprop=hProp})
  thrcs3  = vi:create_thruster({pos={x=-1,y=0,z=3},dir={x=0,y=-1,z=0},maxth0=th,isp0=isp,hprop=hProp})
  thrcs4  = vi:create_thruster({pos={x=1,y=0,z=-3},dir={x=0,y=1,z=0},maxth0=th,isp0=isp,hprop=hProp})
  thrcs5  = vi:create_thruster({pos={x=1,y=0,z=-3},dir={x=0,y=-1,z=0},maxth0=th,isp0=isp,hprop=hProp})
  thrcs6  = vi:create_thruster({pos={x=-1,y=0,z=-3},dir={x=0,y=1,z=0},maxth0=th,isp0=isp,hprop=hProp})
  thrcs7  = vi:create_thruster({pos={x=-1,y=0,z=-3},dir={x=0,y=-1,z=0},maxth0=th,isp0=isp,hprop=hProp})
  thrcs8  = vi:create_thruster({pos={x=1,y=0,z=3},dir={x=-1,y=0,z=0},maxth0=th,isp0=isp,hprop=hProp})
  thrcs9  = vi:create_thruster({pos={x=-1,y=0,z=3},dir={x=1,y=0,z=0},maxth0=th,isp0=isp,hprop=hProp})
  thrcs10 = vi:create_thruster({pos={x=1,y=0,z=-3},dir={x=-1,y=0,z=0},maxth0=th,isp0=isp,hprop=hProp})
  thrcs11 = vi:create_thruster({pos={x=-1,y=0,z=-3},dir={x=1,y=0,z=0},maxth0=th,isp0=isp,hprop=hProp})
  thrcs12 = vi:create_thruster({pos={x=0,y=0,z=-3},dir={x=0,y=0,z=1},maxth0=th,isp0=isp,hprop=hProp})
  thrcs13 = vi:create_thruster({pos={x=0,y=0,z=3},dir={x=0,y=0,z=-1},maxth0=th,isp0=isp,hprop=hProp})
  vi:create_thrustergroup({thrcs0,thrcs2,thrcs5,thrcs7},THGROUP.ATT_PITCHUP)
  vi:create_thrustergroup({thrcs1,thrcs3,thrcs4,thrcs6},THGROUP.ATT_PITCHDOWN)
  vi:create_thrustergroup({thrcs0,thrcs4,thrcs3,thrcs7},THGROUP.ATT_BANKLEFT)
  vi:create_thrustergroup({thrcs1,thrcs5,thrcs2,thrcs6},THGROUP.ATT_BANKRIGHT)
  vi:create_thrustergroup({thrcs8,thrcs11},THGROUP.ATT_YAWLEFT)
  vi:create_thrustergroup({thrcs9,thrcs10},THGROUP.ATT_YAWRIGHT)
  vi:create_thrustergroup({thrcs8,thrcs10},THGROUP.ATT_LEFT)
  vi:create_thrustergroup({thrcs9,thrcs11},THGROUP.ATT_RIGHT)
  vi:create_thrustergroup({thrcs12},THGROUP.ATT_FORWARD)
  vi:create_thrustergroup({thrcs13},THGROUP.ATT_BACK)

  -- camera parameters
  vi:set_cameraoffset(vprm.co)
 
  -- associate a mesh for the visual
  vi:add_mesh('TestVessel')
  vi:set_mesh_visibility_mode(0,MESHVIS.EXTERNAL)
end
I think you can use any of your mesh, just call it "TestVessel.msh" (or change the name in the end of the code).
 
Scenario Editor does strange things, messes with the time step.
But it's probably the TD points, they are incredibly sensetive in conjunction with mass, pmi, cross section, etc. Also don't see any stiff, damp or mu?
Had a similar issue which was solved by adjusting pmi and mu.
Would also advise at least one more TD point for the top
 
Thanks.
Also don't see any stiff, damp or mu?
Yes, they're missed in my Lua code. I took that code from the "ScriptPB" vessel (that's the Shuttle-PB Lua version) and deleted some code blocks. (It looks I didn't delete anything related to the TD points definitions). But I tried the ScriptPB vessel now and it doesn't have that issue with opening the Scenario Editor during moving.
Would also advise at least one more TD point for the top
The ScriptPB is stable with three points during opening the Scenario Editor while moving, so I don't know what's the problem could be.
 
Thanks.
Yes, they're missed in my Lua code. I took that code from the "ScriptPB" vessel (that's the Shuttle-PB Lua version) and deleted some code blocks. (It looks I didn't delete anything related to the TD points definitions). But I tried the ScriptPB vessel now and it doesn't have that issue with opening the Scenario Editor during moving.
The ScriptPB is stable with three points during opening the Scenario Editor while moving, so I don't know what's the problem could be.
Ok, if all the parameters, mass, pmi, are identical then, as you say, independant of mesh the results should be the same?
 
Oh, no, I'm sorry, I remembered I changed these parameters. I should try it again with other values.
 
Well, the original ScriptPB Lua code (with my custom mesh) doesn't have the issue when opening the Scenario Editor during moving (as obviously expected). So, it requires further research, I'll leave it as is for now.

But nevertheless the issue doesn't occur when a vessel is completely stopped (this also seems obvious).
 
I found, that my TD points coordinates and "Size" parameter leads to unstability when a vessel is moving (during opening the Scenario Editor, and x10 time acceleration too (as it turned out). The problem is solved by setting these parameters to the ScriptPB ones. But I need other parameters, so I'll try to add more TD parameters (stiffness, damping, etc). I found an example for the DG on Lua, although I don't understand how to realize it for my vessel yet.
 
Back
Top