Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/orbitersim/orbiter into Bak…
Browse files Browse the repository at this point in the history
…edVC

# Conflicts:
#	Orbitersdk/include/GraphicsAPI.h
  • Loading branch information
jarmonik committed Jan 23, 2024
2 parents 324be7c + 5005c0a commit bdc8996
Show file tree
Hide file tree
Showing 83 changed files with 76,509 additions and 8,301 deletions.
31 changes: 27 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

Expand Down Expand Up @@ -78,7 +78,30 @@ jobs:
- name: Install
working-directory: ${{ github.workspace }}/out/build/windows-${{ matrix.architecture }}-release
run: cmake --install . --prefix ${{ github.workspace }}/out/install

- name: List exports
working-directory: ${{ github.workspace }}/out/install/Orbiter
shell: cmd
run: |
dumpbin /EXPORTS Modules\Server\Orbiter.exe /OUT:exports_tmp0.txt
type exports_tmp0.txt | find " ?" > exports_tmp1.txt
for /F "tokens=4" %%F in (exports_tmp1.txt) do @echo %%F >> exports_tmp2.txt
undname exports_tmp2.txt | sort > exports.txt
del /Q exports_tmp*.txt
- name: Diff exports with Orbiter 2016
if: ${{ matrix.architecture == 'x86' }}
shell: cmd
continue-on-error: true
run: git diff -U0 --ignore-cr-at-eol --ignore-space-at-eol --no-index exports.2016.txt out/install/Orbiter/exports.txt

- name: Upload exports
uses: actions/upload-artifact@v4
with:
name: exports-${{ matrix.architecture }}
path: ${{ github.workspace }}/out/install/Orbiter/exports.txt
retention-days: 1

- name: Pack
if: ${{ github.ref == 'refs/heads/main' }}
working-directory: ${{ github.workspace }}/out/install/Orbiter
Expand All @@ -87,7 +110,7 @@ jobs:

- name: Upload Build Artifact
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4
with:
name: Orbiter-${{ matrix.architecture }}
# A file, directory or wildcard pattern that describes what to upload
Expand All @@ -108,10 +131,10 @@ jobs:
run: mkdir out

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: ./out

Expand Down
3 changes: 2 additions & 1 deletion Config/MFD/ScriptMFD.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
MFD\Attitude.cfg
MFD\TestMFD1.cfg
;MFD\TestMFD2.cfg
;MFD\TestMFD2.cfg
MFD\Tests\MFDScriptAPI.cfg
4 changes: 4 additions & 0 deletions Config/MFD/Tests/MFDScriptAPI.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Name = Script MFD API-Test
Script = Tests/MFDScriptAPI.lua
Key = 0x19 ; 'T'
Persist = vessel
230 changes: 230 additions & 0 deletions Config/MFD/Tests/MFDScriptAPI.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
-- ---------------------------------------------------
-- General TEST Utils
-- ---------------------------------------------------

-- fifo_add --
local linebuf = {}
local linenum = 0
local viewstart = 0
local linemax = 18 -- view window size
-- periodic_check --
local pc_inhibit = false -- flag to inhibit periodic_check()
local tmax = 5 -- 5 seconds should be plenty of time to complete this test
local t0 = oapi.get_systime()
-- general --
local tests_passed = 0 -- to be filled with TEST_ID.xxx

function fifo_add(line)
linebuf[linenum] = line
linenum = linenum + 1
if linenum > linemax then
viewstart = viewstart + 1
end
end

function add_line(line)
oapi.dbg_out(line)
oapi.write_log(line)
fifo_add(line)
end

function assert(cond)
if cond == false then
add_line(" - FAILED!")
error("Assertion failed\n"..debug.traceback())
pc_inhibit = true -- inhibit periodic_check. no more checks!
-- oapi.exit(1)
end
end

function pass(test_id)
add_line(" - passed")
tests_passed = tests_passed + test_id
end

-- local pc_count = 0
function periodic_check()
if pc_inhibit then return end

local t1 = oapi.get_systime()
if t1 - t0 > tmax then -- timeout => check
-- add_line("timeout")
-- assert( tests_passed == ALL_PASSED )
if tests_passed == ALL_PASSED then
add_line("=== All tests passed ===")
else
add_line("=== Some tests failed to pass (in time) ===")
-- oapi.exit(1)
end
pc_inhibit = true -- inhibit periodic_check. no more checks!
cleanup()
-- oapi.exit(0)
end
-- All tests passed before timeout?
if tests_passed == ALL_PASSED then
add_line("=== All tests passed ===")
pc_inhibit = true -- inhibit periodic_check. no more checks!
-- oapi.exit(0)
cleanup()
end
-- <DEBUG>
-- pc_count = pc_count + 1
-- linebuf[linenum-1] = tostring(pc_count) .. " t1:" .. oapi.formatvalue(t1) .. " t0:" .. oapi.formatvalue(t0)
-- </DEBUG>
end

function cleanup()
res,err = os.remove("Scenarios\\Tests\\Manual\\__delete_me__.scn")
if err ~= nil then
add_line(err)
end
end

-- ---------------------------------------------------
-- "Constants"
-- ---------------------------------------------------

local TEST_ID = {
valid_mfd_table = 0x01,
readstatus_called = 0x02,
recallstatus_called = 0x04,
writestatus_called = 0x08,
update_called = 0x10,
savescenario = 0x20
}
local ALL_PASSED = 0x3F -- make sure this is the sum of TEST_ID values!

vec = { x = 1.2, y = -3.4, z = 5.6 }


-- ---------------------------------------------------
-- TEST(S)
-- ---------------------------------------------------

add_line("=== Lua script unit tests ===")

add_line("")
add_line("--- Script MFD module ---")


-- ---------------------------------------------------
-- MFD ''globals'
-- ---------------------------------------------------
add_line("check vor valid 'mfd' table")
assert(mfd ~= nil)
pass(TEST_ID.valid_mfd_table)


-- ---------------------------------------------------
-- readstatus, oapi.readscenario_nextline
-- ---------------------------------------------------
function readstatus(scn)
add_line("readstatus(scn) called")
assert(scn ~= nil)

local got_str = false
local got_int = false
local got_flt = false
local got_vec = false
while true do
line = oapi.readscenario_nextline(scn)
if line == nil then -- ALTERNATIVE(see "else", too): if line == nil or line == "END_MFD" then
break
elseif string.find(line, "VAL_STR") then
got_str = true -- VAL_STR foo
add_line(" | got \"" .. line .. "\"")
elseif string.find(line, "VAL_INT") then
got_int = true -- VAL_INT 42
add_line(" | got \"" .. line .. "\"")
elseif string.find(line, "VAL_FLT") then
got_flt = true -- VAL_FLT 3.14
add_line(" | got \"" .. line .. "\"")
elseif string.find(line, "VAL_VEC") then
got_vec = true -- VAL_VEC 1.20 -3.40 5.60
add_line(" | got \"" .. line .. "\"")
else -- "END_MFD" etc. ...why??? C++ API does this too!
add_line(" | got unexpected \"" .. line .. "\"")
end
end
assert(got_str == true and got_int == true and got_flt == true and got_vec == true)
pass(TEST_ID.readstatus_called)
end

-- ---------------------------------------------------
-- recallstatus (TO BE DONE!)
-- ---------------------------------------------------
function recallstatus()
add_line("recallstatus() called")
pass(TEST_ID.recallstatus_called)
end

-- ---------------------------------------------------
-- writestatus, oapi.writescenario_XXX
-- ---------------------------------------------------
function writestatus(scn)
add_line("writestatus(scn) called")
assert(scn ~= nil)
oapi.writescenario_string(scn, "VAL_STR", "foo")
oapi.writescenario_int (scn, "VAL_INT", 42)
oapi.writescenario_float (scn, "VAL_FLT", 3.141592)
-- it's no problem writing same keys over and over...
oapi.writescenario_float (scn, "VAL_FLT", 0.0)
oapi.writescenario_float (scn, "VAL_FLT", 0.1)
oapi.writescenario_float (scn, "VAL_FLT", 1.0)
oapi.writescenario_float (scn, "VAL_FLT", 4 ) -- will both become "VAL_FLT 4.0"
oapi.writescenario_float (scn, "VAL_FLT", 4.0) -- " " " "
oapi.writescenario_vec (scn, "VAL_VEC", vec)
pass(TEST_ID.writestatus_called)
end

-- ---------------------------------------------------
-- prestep, poststep (TO BE DONE!)
-- ---------------------------------------------------
function prestep(simt,simdt,mjd)
end

function poststep(simt,simdt,mjd)
end

-- ---------------------------------------------------
-- update
-- ---------------------------------------------------
local update_called_once = false
function update(skp)
-- For the Test result ...
if update_called_once == false then
update_called_once = true
add_line("update(skp) called")
assert(skp ~= nil)
add_line("valid 'skp'")
pass(TEST_ID.update_called)

add_line("call oapi.savescenario(fname,desc)")
oapi.savescenario( "Tests\\Manual\\__delete_me__",
"This is a test-artifact and can be deleted!" )
pass(TEST_ID.savescenario)
end
periodic_check() -- ... for "ALL TESTS PASSED" condition

-- For eye candy ;) ...
ch,cw = skp:get_charsize()
mfd:set_title(skp,'Script MFD Test')
top = 2 * ch
lft = 4 * cw
for i=0,linemax do
line = linebuf[viewstart+i-1]
skp:text(lft, top + i * ch, line, #line)
end
return true
end




-- ---------------------------------------------------
-- FINAL RESULT
-- ---------------------------------------------------
-- look @ update() & periodic_check()

-- add_line("=== All tests passed ===")
-- oapi.exit(0)
Binary file modified Doc/Credit.doc
Binary file not shown.
8 changes: 5 additions & 3 deletions Doc/Technotes/gravity/gravity.tex
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ \section{Extension to Tesseral Harmonics}
U_G(s, t, u) = \frac{\mu}{r}\left\{1+\sum_{n=1}^{\infty}\left ( \frac{a}{r} \right )^n \sum_{m=1}^{n}A_{n,m}(u)(C_{n,m}r_m(s,t)+S_{n,m}i_m(s,t)) \right\}
\end{equation}
where s, t, and u are the x, y, and z\footnote{Note: Orbiter uses a left-handed coordinate system, wherein the y and z axes are swaped with respect conventional systems like IAU.}, components of position normalized by the magnitude of the position vector, $r_m(s,t)$ and $i_m(s,t)$ are the real and imaginary components respectively of $(s+it)^m$, and $A_{n,m}(u)$ are the \emph{m}th derivative of the associated Legendre polynomial $P_{n,m}(u)$.
Similar to the zonal representation, the acceleration vector acting upon the spacecraft is found by computing the gradient of the potential. The algorithm used to compute acceleration is discussed and described in detail by Eckman et al.\cite{Eckman08}, referencing the implementation developed by DeMars et al.\\cite{DeMars08}
Similar to the zonal representation, the acceleration vector acting upon the spacecraft is found by computing the gradient of the potential. The algorithm used to compute acceleration is discussed and described in detail by Eckman et al.\cite{Eckman08}, referencing the implementation developed by DeMars et al.\cite{DeMars08}

\subsection{Notes on Usage}
Gravity models must follow certain conventions in order to be used. The format used by this implementation is the SHADR format, or Spherical Harmonic ASCII Data Record of PSI\cite{shadr}. Only ASCII models where degree = order are supported.
Expand Down Expand Up @@ -194,14 +194,16 @@ \subsubsection{Limitations}
All gravity models must start with the C(1,0) and S(1,0) coefficients. In the case that they have been omitted by the original creator of the model, they must be padded by zeros as shown in the first two lines of the example above. Additionally: only normalized coefficients are supported, only models that have a reference latitude and longitude corresponding to Orbiter's positive X axis are supported (latitude = 0°, longitude = 0°).

\subsubsection{Included Models}
By default Orbiter comes with four gravity models, one each for: Mercury, Venus, Earth's Moon, and Mars. The default cut-off degree/order is 10 to minimize the impact on simulation performance, however this can be increased at the users discretion. A summary of the models included with this release and their respective default settings is shown in Table~\ref{tab:models}
By default Orbiter comes with four gravity models, one each for: Mercury, Venus, Earth, Luna, Mars, and Vesta. The default cut-off degree/order is 10 to minimize the impact on simulation performance, however this can be increased at the users discretion. A summary of the models included with this release and their respective default settings is shown in Table~\ref{tab:models}
\begin{table}[h]
\begin{tabular}{llcc}
Body & Model & Maximum Degree/Order & Default Degree/Order \\\hline
Mercury & \emph{jgmess\_160a\_sha.tab} & 160 & 10 \\
Venus & \emph{mod\_shgj120p.a01} & 120 & 10 \\
Earth & \emph{egm96\_to360.tab} & 360 & 10 \\
Luna &\emph{ jgl165p1.sha} & 165 & 10 \\
Mars &\emph{ jgmro\_120f\_sha.tab} & 120 & 10
Mars &\emph{ jgmro\_120f\_sha.tab} & 120 & 10 \\
Vesta &\emph{ JGDWN\_VES20H\_SHA.TAB} & 20 & 10
\end{tabular}
\caption{Gravity models included with Orbiter}
\label{tab:models}
Expand Down
1 change: 1 addition & 0 deletions GravityModels/Notes on Gravity Models.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Mercury jgmess_160a_sha.tab
Venus mod_shgj120p.a01
Earth egm96_to360.tab
Moon jgl165p1.sha
Mars jgmro_120f_sha.tab
Vesta JGDWN_VES20H_SHA.TAB
Loading

0 comments on commit bdc8996

Please sign in to comment.