Question Determining distance between docking ports on different vessels

dmurley

New member
Joined
Dec 11, 2017
Messages
37
Reaction score
0
Points
0
Location
Hill country (near San Antonio
The following question arises in the context of "Go Play in Space," chapter 2:

On the Docking MFD, a distance is shown to the docking port on the other vessel. How is this distance determined?
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
For the C++ API, this involves

- retrieving the docking port positions in local vessel coordinates (VESSEL::GetDockParams)
- mapping from local to global frame (VESSEL::Local2Global)
- calculating the Euclidian distance between the two global docking port positions

Since you are asking in the Lua forum, I guess you are more interested in the Lua API. I'm not sure if the required functionality has been completely ported to the Lua interface. If you find that there is a function missing, let me know and I'll look into adding it (or you could do it yourself, since the entire Lua implementation is available in source as part of the Orbitersdk samples).
 

dgatsoulis

ele2png user
Donator
Joined
Dec 2, 2009
Messages
1,924
Reaction score
340
Points
98
Location
Sparta
... I'm not sure if the required functionality has been completely ported to the Lua interface...

kuddel has added local2global to the Lua API. If the OP (or anyone else) is interested, the extended Lua API is here.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
I also have a Lua example doing just that (show distance from one docking port to another)
lying around at home. I'll post it once I'm back from office.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
...and here it is.

You can take a look at Script\Test\undock_test.lua for one possible "solution".

I am sure that this Scenario/Script combination works for Orbiter BETA, possibly also with Orbiter 2016... -haven't tried-...just try the scenario and see ;)

The whole idea behind this package started from this thread.
 

Attachments

  • LuaTest_Scenario.zip
    2.9 KB · Views: 3
Last edited:

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
kuddel has added local2global to the Lua API.
Side-note: If both vessels orbit the same body, I would recommend to use vessel::local2rel.
 
Last edited:

dmurley

New member
Joined
Dec 11, 2017
Messages
37
Reaction score
0
Points
0
Location
Hill country (near San Antonio
It will probably be late tomorrow (my time) before I can look at the example you posted. I'll let you know if I have questions.

By the way, how *do* you attach files to your posts (another newbie question)? Is zip format pretty standard when you do this?
 

dbeachy1

O-F Administrator
Administrator
Orbiter Contributor
Addon Developer
Donator
Beta Tester
Joined
Jan 14, 2008
Messages
9,214
Reaction score
1,560
Points
203
Location
VA
Website
alteaaerospace.com
Preferred Pronouns
he/him
By the way, how *do* you attach files to your posts (another newbie question)? Is zip format pretty standard when you do this?

In the "Additional Options" section below the main section where you type your reply, there is a "Manage Attachments" button. Valid attachment extensions are listed there:

Valid file extensions: bmp cfg doc gif jpe jpeg jpg log pdf png psd scn txt zip

There are maximum size limits for each file type, however. For zip files, the max size is 5.77 MB. If you need to attach a large item to a post, you can use something like Dropbox to host it externally and then include a link to the content in your post.
 

dmurley

New member
Joined
Dec 11, 2017
Messages
37
Reaction score
0
Points
0
Location
Hill country (near San Antonio
I am trying to run the local2global() Lua function and keep getting an execution error when I try to invoke that function. The code I am using is the following:

Code:
pos1,dir1,rot1=hGL1:get_dockparams(dPrt1)
pos2,dir2,rot2=hGL2:get_dockparams(dPrt2)
term.out (pos1)
term.out (pos2)
gpos1=hGL1:local2global(pos1)

pos1 and pos 2 print out ok. The execution error occurs when local2global() is invoked. I have assumed invocation parameters based on what was sent to me in an example and I don't see what the problem could be (do I need to compile the Lua beta functions before I can use them? I don't have a C++ compiler).

Any comment would be appreciated. Thanks.

(After reading the post above, I realized that I should mention that I'm using Orbiter 2016 instead of Orbiter Beta. That may be my problem.)
 
Last edited:

dgatsoulis

ele2png user
Donator
Joined
Dec 2, 2009
Messages
1,924
Reaction score
340
Points
98
Location
Sparta
If you want to use local2global in Orbiter2016, you need to install the .dlls from the link on post #3 of this thread, in your Orbiter2016 installation.

Unzip the LuaScript 2017-12-07(dlls).zip in your Orbiter2016 directory, let it overwrite the current files and everything will go in its place.
 

dmurley

New member
Joined
Dec 11, 2017
Messages
37
Reaction score
0
Points
0
Location
Hill country (near San Antonio
Problems installing Lua updates

When I extracted the files from LuaScript 2017-12-07(dlls).zip into "C:/Orbiter 2016" in order to get the Lua beta functions, Lua quit working and I got the error message in the attached file. This makes me think that I am doing something wrong. Any ideas? Thanks.
 

Attachments

  • error.jpg
    error.jpg
    23.8 KB · Views: 10

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
That package (ZIP) was made for Orbiter BETA, so Orbiter 2016 might not work.
I'll see if I can provide something that can be used with Orbiter 2016.
But I can't promise anything yet, one or two methods/features might not be present in Orbiter 2016.
...stay tuned.
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
Also, I should say sorry that I haven't incorporated your extensions into the beta distribution yet, kuddel. At the time the problem was that some of the code wouldn't compile under VS2008 which I was using then, but since switching to VS2015 I don't really have any excuses left. Hopefully I'll find some time soon.

If I remember correctly, the only thing missing was the documentation for the new functions. I'll see if I can add those.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
Hi Martin, as far as I remember most of the functions have been incorporated in the BETA repository already...do you have a co-worker you forgot to pay? :p

Some (minor) things have not been incorporated, but all the methods/functions are already in there.

I also fixed some very minor (documentation fixes) that might also be nice to be incorporated.
I'll post an updated package when it's ready for easy integration.
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
...do you have a co-worker you forgot to pay? :p
I don't think so, unless I've forgotten them too - that would be a worry :lol:

Some (minor) things have not been incorporated, but all the methods/functions are already in there.
Excellent. I love things on my to do list that get so fed up with my working speed that they fix themselves. It doesn't happen often enough ...

Anyway, there definitely was something that I didn't manage to incorporate. It may have been some fixes of the terminal window, but I'm no longer sure about it.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
LuaScriptPlus DLLs (for Orbiter 2016)

Yeah, terminal window needs some more love.

---------- Post added at 21:21 ---------- Previous post was at 20:47 ----------

@dmurley: I've uploaded versions for Orbiter 2016 (see attachments in first post of development thread).
You may try those. Note, that the contents of the ZIP will overwrite your files, so you might like to backup those before they get overwritten.

The test scenario (\Scenarios\Tests\undock_test.scn) is a starting point to run the test script.
As Orbiter 2016 does not have the "automatic Lua script start from scenario" feature, you have to run/start that manually.
At the LuaConsole type:
Code:
run('test/undock_test')

Have fun (if it works for you, else please report back)
 
Last edited:

dmurley

New member
Joined
Dec 11, 2017
Messages
37
Reaction score
0
Points
0
Location
Hill country (near San Antonio
kuddel: no hurry. I have plenty to keep me busy and lots to learn. Let me know when you have something you want me to try. Thanks for your help and patience.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,588
Reaction score
2,312
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
I don't think so, unless I've forgotten them too - that would be a worry :lol:

No post-grads around? Usually they are the most expendable resource in a university.

I remember one, whose PhD got constantly delayed by various reasons and rules, though everybody knew he was simply too hard to replace for the faculty. :lol:
 
Top