TransX [Solved] Using TransX with an Y-axis aligned vessel

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,995
Reaction score
4,419
Points
203
Location
Toulouse
Hi,

I was wondering if there is a way to use the TransX bullseye to get the direction of the velocity vector when the main thruster of the ship is not Z-aligned but Y-aligned (prograde direction Y+ or _V(0,1,0) ) ? Is there an option or a config parameter that can allow to take that into account ?

Any ideas welcome, :tiphat:

(Suggestions of other MFDs count too)
 
Last edited:
Any chance it could be implemented in a future release ? :P
 
You do it simply by manually translating yourself sideways.:facepalm: That is all you'd need to do. In space you have the ability to translate sideways.

What you need to do is roll yourself sideways 90 degrees then translate to the side (+ or -) that needs correction. :rolleyes:
 
You do it simply by manually translating yourself sideways. That is all you'd need to do. In space you have the ability to translate sideways.

Yes, of course, I'm going to perform a 3200 m/s TLI burn with 100N N204/MMH RCS thrusters ? :facepalm:

I'm speaking of a realistic ship...
 
Yes, of course, I'm going to perform a 3200 m/s TLI burn with 100N N204/MMH RCS thrusters ? :facepalm:

I'm speaking of a realistic ship...

LOL Then you should have thought of getting up to the higher plane from the get go. :lol: That was your mistake there.:facepalm:
 
Sorry, I don't get what you mean. :shrug:
 
Ok since the RCS is a smaller engine. Why not point your big engines to the opposite direction of where you should go. Instead of translating sideways. Yaw yourself 90 degrees from your pointing from prograde and point your nose to the direction you want to go to. Is that so difficult to imagine?

Or if you don't have the fuel. The reason I said the above is that the beginning of your flight is what is crucial in getting you to that higher plane. If you don't start pointing it from the start you'll never get to that higher plane. That's what I'm trying to tell you above.
 
Last edited:
Well, I'm doing a trans-lunar off-plane transfer with very tight fuel budget, so I need to optimize everything.

Yes, the idea is to change the attitude by 90° and it's why I tried, but the problem is a lack of reference. OrbitMFD works in a very different way with a Y-axis oriented spacecraft (rather an assembly of spacecrafts, there). Also, I can't count on killrot (doesn't work with the shifted axis).

So I found an approximate method using the shifted OrbitMFD, but it lacks of precision. :(
 
The best way would be to make the burn using IMFD. It handles Y axis burns pretty well. Here is an example of a ship with the Y axis burn direction (CEV-E-LM)
Yburn2.jpg


Here it is oriented for the burn.

Yburn1.jpg


If you don't want to use the AutoBurn autopilot but make the burn manually instead, you have to get the vectors centered. (Picture2 - Cross in the middle and the small arrows aligned).

Hope this helps.
:cheers:
 
If you can find someone with the time to implement it, then yes. It's all opensource afterall.

Downloaded the source package. Is that the part I'm searching for (in graph.cpp) ?

Code:
double Graph::vectorpointdisplay(HDC hDC, const VECTOR3 &target, MFD *mfd, VESSEL *vessel, bool isposition)
//targetvector is a vector in the global reference plane
//isposition true
{
	VECTOR3 trtarget,temp;
	VESSELSTATUS status;
	if (isposition)
	{
		vessel->GetGlobalPos(temp);
		temp=target-temp;
	}
	else
	{
		temp=target;
	}
	vessel->GetStatus(status);
	VECTOR3 arot=status.arot;
	MATRIX3 rotmatrix;
	getinvrotmatrix(arot,&rotmatrix);
	trtarget = mul(rotmatrix, temp);
	int lines=int(windowsize/10);
	int edge=int(windowsize/1.5);
	int centre=int(windowsize/3);
	HPEN pen;
	pen=mfd->SelectDefaultPen(hDC,TransXFunction::White);
	Arc(hDC, ixstart,iystart+lines,ixstart+edge,iystart+edge+lines,ixstart,iystart+centre,ixstart,iystart+centre);
	edge-=centre/3;
	int nearedge=centre/3;
	Arc(hDC,ixstart+nearedge,iystart+nearedge+lines,ixstart+edge,iystart+edge+lines,ixstart+nearedge,iystart+centre,ixstart+nearedge,iystart+centre);
	edge-=centre/3;
	nearedge+=centre/3;
	Arc(hDC,ixstart+nearedge,iystart+nearedge+lines,ixstart+edge,iystart+edge+lines,ixstart+nearedge,iystart+centre,ixstart+nearedge,iystart+centre);
	edge=int(windowsize/1.5);
	MoveToEx(hDC,ixstart+centre,iystart+lines,NULL);
	LineTo(hDC,ixstart+centre,iystart+edge+lines);
	MoveToEx(hDC,ixstart,iystart+centre+lines,NULL);
	LineTo(hDC, ixstart+edge,iystart+centre+lines);
	double offsetsize=sqrt(trtarget.x*trtarget.x+trtarget.y*trtarget.y);
	double scalar=sqrt(2.0) / 2;
	double xang=trtarget.x/offsetsize;
	double yang=-trtarget.y/offsetsize;
	offsetsize=sqrt(offsetsize/trtarget.z);
	if (offsetsize>scalar || trtarget.z<0) offsetsize=scalar;
	offsetsize=offsetsize/scalar*windowsize/3;
	int xpos=int(offsetsize*xang+centre+ixstart);
	int ypos=int(offsetsize*yang+centre+lines+iystart);
	pen=mfd->SelectDefaultPen(hDC,TransXFunction::Green);
	MoveToEx(hDC,xpos-3,ypos-3,NULL);
	LineTo(hDC,xpos+3,ypos+3);
	MoveToEx(hDC,xpos-3,ypos+3,NULL);
	LineTo(hDC,xpos+3,ypos-3);
	return length(trtarget);
}
 
Ok I've managed to recompile the MFD and made a modification attempt... But then the problem is my non-comprehension of the maths/physics involved there.

I think I've tracked down the vector that holds the vessel orientation (arot vector). So my idea was to crossproduct the vector (supposed to be _V(0,0,1) in a "default" orientation) with _V(1,0,0) to have _V(0,1,0), or an y-axis output. But it does not work and I still can't get the proper vector display in Orbiter.

I feel that basic vector skills (that I don't have) could help to solve this, because the idea is only to feed TransX bullseye display with a modified vector. Any idea ? It would help a lot my lunar lander project :tiphat:

Code:
double Graph::vectorpointdisplay(HDC hDC, const VECTOR3 &target, MFD *mfd, VESSEL *vessel, bool isposition)
//targetvector is a vector in the global reference plane
//isposition true
{
	VECTOR3 trtarget,temp;
	VESSELSTATUS status;
	if (isposition)
	{
		vessel->GetGlobalPos(temp);	 // input : vessel global pos
		temp=target-temp;
	}
	else
	{
		temp=target;
	}
	vessel->GetStatus(status);
[B]	VECTOR3 arot=status.arot;	// there
	arot =	crossp(arot, _V(1,0,0)); // failed conversion attempt[/B] 
	MATRIX3 rotmatrix;
	getinvrotmatrix(arot,&rotmatrix);
	trtarget = mul(rotmatrix, temp);
        ... then more graphical stuff...


---------- Post added at 10:46 AM ---------- Previous post was at 01:42 AM ----------

In a moment of lucidity, I found out the answer.

There is only one line to change, in the same section than posted above :

from :

Code:
double yang=-trtarget.[B]y[/B]/offsetsize;

to :

Code:
double yang=-trtarget.[B]z[/B]/offsetsize;

That did it nicely. It also works with Deltaglider-type vessels that have hover and main engines. Imagine that your favorite XR engines fail ; with this you can continue the navigation on the hovers (though you have to re-calculate the burn durations, which is not that hard). :)
 
So is this an independant MFD or does transX now align all vessels along the Y axis?

Likewise, how hard would it be to apply this to an independant (vessel) autopilot or HUD. I've been struggling with off-axis thrust in my own projects and this seems like it could help a lot.
 
This code is just for TransX (and just for N Molson's installation of TransX) but the same vector maths applies to any MFD that you happen to be writing.
 
I managed to recompile it so that you have the choice in Orbiter between the "standard" TransX MFD and the modified "TransX-Y MFD". I just had to found the name identifier of the MFD. This allows to conveniently switch between the two at any moment.
 
Would you be willing to post that or send me the code?
 
Back
Top