Idea Merging Vessels

escapetomsfate

OBSP Developer
Addon Developer
Joined
Jun 21, 2008
Messages
282
Reaction score
0
Points
0
Location
GB
MergeVessel: 0.1 Alpha

Well, here's my first implementation of it.

MergeVessel.JPG
View attachment MergeVessel.zip

Unzip over Orbiter directory, and activate in the modules tab. When you start a scenario, the DLL will check each timestep for docked vessels and merge them with the focus vessel.

Open the default "Docked at ISS" scenario. It will merge ISS with the DG.

Bugs:
The mesh isn't rotated to the right angle, and only appears if the merged vessel has a "Meshname" parameter in it's CFG file.

I'll make an MFD for it soon, this is just a proof-of-concept alpha release.
 

Kaito

Orbiquiz Coordinator
Joined
Jul 24, 2008
Messages
857
Reaction score
0
Points
0
AWESOME!
Just a small thing...I think that the "auto-merge" at docking might cause trouble, as someone might forget the module is activated, dock with a space station, then suddenly have the entire ISS at the front of their ship on accident. If there would be a different way to do the merging, that'd be great, although I'm sure people will learn to deal with the docking

EDIT:
Noticed bug: Crash if two vessels (vessel-vessel scenario in the Delta-Glider folder) are already docked...
 

DarkWanderer

Active member
Orbiter Contributor
Donator
Joined
Apr 27, 2008
Messages
213
Reaction score
83
Points
43
Location
Moscow
A direction to develop: don't forget to add up the MOI's. ISS rotating at 100deg/s would look strange.
 

escapetomsfate

OBSP Developer
Addon Developer
Joined
Jun 21, 2008
Messages
282
Reaction score
0
Points
0
Location
GB
EDIT:
Noticed bug: Crash if two vessels (vessel-vessel scenario in the Delta-Glider folder) are already docked...

Open up /Config/Vessels/Deltaglider.cfg, and add this:

Code:
Meshname = /dg/Deltaglider

The only way to find the mesh of the vessel is to look at the "meshname" parameter in it's cfg file - which means if a vessel doesn't have one, it crashes. I should add a fail-safe really...

DarkWanderer said:
A direction to develop: don't forget to add up the MOI's. ISS rotating at 100deg/s would look strange.

Um, what's a MOI? :embarrassed:
 
Last edited:

escapetomsfate

OBSP Developer
Addon Developer
Joined
Jun 21, 2008
Messages
282
Reaction score
0
Points
0
Location
GB
MergeVessel 0.2

Here's the second alpha, with an MFD. It shows all docked / attached vessels, you just MGE to merge with the focus vessel.

Also, it won't crash if it can't find a mesh.

View attachment MergeVessel 0.2.zip

Bugs:

-If you press merge in virtual cockpit, orbiter crashes for some reason.


Moment of Inertia I assume.

Ah, thanks. Would I calculate it like this?

Code:
hVessel->SetPMI(hVessel->GetPMI() + oVessel->GetPMI());
 

DarkWanderer

Active member
Orbiter Contributor
Donator
Joined
Apr 27, 2008
Messages
213
Reaction score
83
Points
43
Location
Moscow
Unless the overloaded + operator already implemented that
Oh yeah, and it can tell the PMI VECTOR3 from any other VECTOR3. Compilers are so smart nowadays :p

It will look like this (assuming the axes are similarly aligned for both vessels):
Code:
#define sqr(x) (x*x)

double m1, r1, m2, r2; // Mass and coordinates of the vessels
VECTOR3 PMI1, PMI2; //Principal moments of inertia
double m, r; //Parameters of the new vessel
VECTOR3 PMI; //Parameters of the new vessel

m = m1+m2;
r = (m1*r1+m2*r2)/(m1+m2);

double d1 = r1-r; //Distance from new CoG to first vessel
double d1 = r2-r; //Distance from new CoG to second vessel

PMI.x = PMI1.x + PMI2.x + (sqr(d1.y)+sqr(d1.z))*m1+(sqr(d2.y)+sqr(d2.z))*m2;
PMI.y = PMI1.y + PMI2.y + (sqr(d1.x)+sqr(d1.z))*m1+(sqr(d2.x)+sqr(d2.z))*m2;
PMI.z = PMI1.z + PMI2.z + (sqr(d1.x)+sqr(d1.y))*m1+(sqr(d2.x)+sqr(d2.y))*m2;
That's imprecise and leaves out centrifugal moments, but since the latter are not supported - that's better than nothing.
 

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,320
Reaction score
25
Points
113
Location
Sydney, Australia
Thrusters and animations I'm not sure about, but I'm sure something could be done.
Thrusters should be doable since you can find out all about them (position, direction, fuel tanks) through the VESSEL interface.

Implementation of animations are internal to each vessel and there would be no way to find out about them unless the vessel exposed that information in some way. Options I can see:

1. .ini file, spacecraft3 style, as suggested earlier. Benefits: spacecraft3 vessels could be easily incorporated into the scheme. Disadvantage: A developer writing a standard DLL vessel would need to add a config file containing animation information (the work load for that could be reduced by producing a standard library to parse the file and implement the animations).

2. An exported class from the vessel DLL that contains all the animation information. Disadvantage: excludes all spacecraft3 vessels.

---------- Post added at 09:16 ---------- Previous post was at 09:05 ----------

It will look like this (assuming the axes are similarly aligned for both vessels):
You may interested in how the Orbiter core does it (it works for non-aligned axes, if I understand the description right). See here:
Orbiter: A free spacecraft simulation tool, 2nd ESA Workshop on Astrodynamics Tools and Techniques, ESTEC, Noordwijk, 13-15 September 2004. Presentation: PDF.
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,282
Reaction score
17
Points
0
Location
Florida
Hm. I didn't know Orbiter supported a way to add a mesh to a vessel with a rotational offset.
 

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,320
Reaction score
25
Points
113
Location
Sydney, Australia
Hm. I didn't know Orbiter supported a way to add a mesh to a vessel with a rotational offset.
You can't, to my knowledge anyway. You could, however, define a parent animation that rotates the whole mesh to the required orientation.
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,282
Reaction score
17
Points
0
Location
Florida
You can't, to my knowledge anyway. You could, however, define a parent animation that rotates the whole mesh to the required orientation.

I know ;) I don't see an elegant design for this add-on, perhaps escapetom can come up with something.

The best solutions for dealing with many vessels inside a scenario in my opinion would be:

a. As darkwanderer said, set enable focus to false for every vessel besides the core.

b. Create some interface which organizes the station, and allows you to visually select nodes, etc.

Add-ons like this tend to create stability issues.
 

DarkWanderer

Active member
Orbiter Contributor
Donator
Joined
Apr 27, 2008
Messages
213
Reaction score
83
Points
43
Location
Moscow
You can't, to my knowledge anyway. You could, however, define a parent animation that rotates the whole mesh to the required orientation.
maybe better to translate it? ;)
You can add a mesh with offset:
AddMesh (2)
This version adds a preloaded mesh to the vessel’s visual representation.
Synopsis:
void AddMesh (MESHHANDLE hMesh, const VECTOR3 *ofs=0) const
ofs optional pointer to a displacement vector which describes the offset
(in meter) of the mesh origin against the vessel origin.

You may interested in how the Orbiter core does it (it works for non-aligned axes, if I understand the description right). See here:
It works, but leaves out non-diagonal inertia components as well.
Unfortunately, there's no GetSuperstructureMOI function (refer to GetSuperstructureCG). So, own function will be needed anyways.
 

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,320
Reaction score
25
Points
113
Location
Sydney, Australia
maybe better to translate it? ;)
You can add a mesh with offset:
Yes, but you can't add a mesh with a rotation and an offset. Consider a situation where a module is attached at 45° to one of the core modules principle axes (it is possible because the docking ports can be in any orientation).

It works, but leaves out non-diagonal inertia components as well.
Yes, but it does not require the docked module to have its principle axes parallel to the vessel's principle axes, which Huygens-Steiner does require.
 

DarkWanderer

Active member
Orbiter Contributor
Donator
Joined
Apr 27, 2008
Messages
213
Reaction score
83
Points
43
Location
Moscow
Yes, but you can't add a mesh with a rotation and an offset. Consider a situation where a module is attached at 45° to one of the core modules principle axes (it is possible because the docking ports can be in any orientation).
That's true. Agree. Skipped the word "rotational".
Yes, but it does not require the docked module to have its principle axes parallel to the vessel's principle axes, which Huygens-Steiner does require.
Yes. But you can transform the inertia tensor. And I'm almost sure that's what Orbiter is doing when adding it.
Unfortunately, there looks to be no way to get results of Orbiter's computations, so what I'm proposing is to recreate it.

Sorry for driving the thread aside.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,917
Reaction score
2,182
Points
203
Location
between the planets
What you want to do is to go here:


http://www.orbiter-forum.com/showthread.php?t=1391&highlight=modular

download the source code, contact Vchamp if you may use it (which you may, since it's on sourceforge, but it's still polite to ask) and use it. Vchamp and I kind of droped the project, but the code for merging vessels out of several meshes with preserved animations is all there. Vchamp was going to do thermodynamics, damage simulation etc, and eventually dropped it, but what you'd need to set up a space station with not much of a systems simulation is there. You could take the modules from Greg Burches space station building blocks, write new configs for them and use them with this mod.
 
Top