Question Ranger (and other ships) from Interstellar?

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Illegal instruction.... is your CPU really old?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire

The Computer is 2 years old. using visual studio 2013 for coding

Well, you have two strange errors there:

bad_alloc suggests that you run out of memory somewhere.
illegal instruction usually means that a CPU instruction is not implemented.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Thanks. And maybe because it is out of memeory it isn't drawing the meshes correctly?

How can I see where/what is causing the issue?

I got screen Hunter and got some more images of missing mesh parts.

https://dl.dropboxusercontent.com/u/71242599/ScreenHunter_17%20Jun.%2008%2005.55.jpg

https://www.dropbox.com/s/w3z1bnkgri2foj8/ScreenHunter_18%20Jun.%2008%2005.56.jpg?dl=0


Well I guess I can go back to the drawing board and recode this. We have alot of specialized code to deal with moving mfd,.....

I guess to get it to fly better greater rcs to maintain a level flight?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
I got screen Hunter and got some more images of missing mesh parts.

Could also be caused by bad animations. Can't see the screen captures right now, will have to wait.

But the bad_alloc stuff suggests something really odd, since DX9 for example does not choke on SSU and the beta even works with dozens of GB of texture data.

Orbiter is most of the time a classic "garbage in - crash out" application (though it tends to garbage in-garbage out). bad alloc could also suggest a rapid memory leak in your application. You constantly request new entities, without freeing them then. Orbiter is still a 32 bit application, so you can't expect it to have more than 4GB flat memory.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Orbiter is most of the time a classic "garbage in - crash out" application (though it tends to garbage in-garbage out). bad alloc could also suggest a rapid memory leak in your application. You constantly request new entities, without freeing them then. Orbiter is still a 32 bit application, so you can't expect it to have more than 4GB flat memory.

Is there a way to tell how memory it is using. When I get home I can check for the release stuff.

Since the Endurance works good. I might re-use that code. For now. The big part will be the animation of the seats and mfd's. Now sure if I am up to that:)
 

Hielor

Defender of Truth
Donator
Beta Tester
Joined
May 30, 2008
Messages
5,580
Reaction score
2
Points
0
Likely means you have a buffer overrun (or similar memory access problem) somewhere in your code.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Thanks. not sure where though. So I think I made totally redo this

---------- Post added 06-09-16 at 05:46 AM ---------- Previous post was 06-08-16 at 03:39 PM ----------

Well I redid this. But now I get a ctd so I ran the debugger and no ctd. Nothing in the log either.

VSOP87(B) Neptune: Precision 1e-006, Terms 391/2024
Finished initialising world
Module LANDER100C.dll ........ [Build 160609, API 100830]
---------------------------------------------------------------
>>> WARNING: Obsolete API function used: VESSEL::SetBankMomentScale
At least one active module is accessing an obsolete interface function.
Addons which rely on obsolete functions may not be compatible with
future versions of Orbiter.
---------------------------------------------------------------
Module UMmu.dll .............. [Build 140111, API 100830]
Finished initialising status
Finished initialising camera
Finished initialising panels
Finished setting up render state
Another tester gets a runtime error referencing transX
https://dl.dropboxusercontent.com/u/71242599/Lander crash[2].jpg
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Well I was told a memory leak. But for now did it another way.

Not sure how to get the Lander to fly and not drop. I have looked at the Shuttle A.

Code:
SetSize(11);
	SetEmptyMass(11000.0);
	SetCW(0.3, 0.3, 0.6, 0.9);
	SetWingAspect(1.7);
	SetWingEffectiveness(2.5);
	SetCrossSections(_V(71.59, 206.57, 50.58));
	SetRotDrag(_V(3.5, 3.5, 3.5));
	if (GetFlightModel() >= 1) {
		SetPitchMomentScale(1e-4);
		SetBankMomentScale(1e-4);
	}
	SetPMI(_V(32.49, 38.14, 23.67));
	SetTrimScale(0.08);
	SetCameraOffset(_V(0, 3, 10.1));
	SetTouchdownPoints(_V(0, -.003, 5.7), _V(-3.448, -.003, -5.0), _V(3.448, -.003, -5.0));;

Code:
	CreateAirfoil(LIFT_VERTICAL, _V(0, 0, 0), Lander_MomentCoeff, 8, 140, 0.1);

Code:
void Lander_MomentCoeff(double aoa, double M, double Re, double *cl, double *cm, double *cd)
{
	int i;
	const int nabsc = 7;
	static const double AOA[nabsc] = { -180 * RAD, -90 * RAD, -30 * RAD, 0 * RAD, 60 * RAD, 90 * RAD, 180 * RAD };
	static const double CL[nabsc] = { 0, 0, -0.004, 0, 0.008, 0, 0 };
	static const double CM[nabsc] = { 0, 0, 0.0014, 0, -0.0012, 0, 0 };

	for (i = 0; i < nabsc - 1 && AOA[i + 1] < aoa; i++);
	double f = (aoa - AOA[i]) / (AOA[i + 1] - AOA[i]);
	*cl = CL[i] + (CL[i + 1] - CL[i]) * f;  // aoa-dependent lift coefficient
	*cm = CM[i] + (CM[i + 1] - CM[i]) * f;  // aoa-dependent moment coefficient
	double saoa = sin(aoa);
	double pd = 0.045 + 0.4*saoa*saoa;  // profile drag
	*cd = pd + oapiGetInducedDrag(*cl, 0.1, 0.7) + oapiGetWaveDrag(M, 0.75, 1.0, 1.1, 0.04);
	// profile drag + (lift-)induced drag + transonic/supersonic wave (compressibility) drag
}
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Here are some interior images of the Lander.
LANDERCOCKPIT1_zpsvxb1qfvu.jpg


CASE is our information display

LANDERCOCKPIT4_zps5jcyzapa.jpg

looking forward 0 chair motion

LANDERCOCKPIT1A_zpsn9cwyavd.jpg


LANDERCOCKPIT3_zpsvxjviztm.jpg


Things working on.

HUD center needs to move when switching between pilot and copilot
HUD needs to turn off when chairs are animated (Not sure how to code that)
View needs to follow chair motion. I have set a vector for the view I just need to change the vector to follow the animation

2 rangers ready for launch.
RANGERLAUNCH2_zpsrfj4fwwp.jpg
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Any ideas about this. The Endurance has 16 attachments for cargos. but we are getting distortion of the cargos.

Endurancecargodistortion.jpg

endurancecargodistortion2.jpg



here is the Endurance attachment info.

Code:
CARGO1 = CreateAttachment(false, _V(0, -20.2, 1.12), _V(0, -1, 0), _V(0, 0, -1), "CARGO1");
	CARGO2 = CreateAttachment(false, _V(0, -21.75, 1.12), _V(0, -1, 0), _V(0, 0, -1), "CARGO2");
	CARGO3 = CreateAttachment(false, _V(-17.7, -10.15, 1.12), _V(-.866, -.5, 0), _V(0, 0, -1), "CARGO3");//-17.7 -10.15 1.12  -.866 -.5 0
	CARGO4 = CreateAttachment(false, _V(-19.2, -11.0, 1.12), _V(-.866, -.5, 0), _V(0, 0, -1), "CARGO4");//-19.2 -11.0 1.12
	CARGO5 = CreateAttachment(false, _V(-20.3, 0, 1.12), _V(-1, 0, 0), _V(0, 0, -1), "CARGO5");
	CARGO6 = CreateAttachment(false, _V(-21.8, 0, 1.12), _V(-1, 0, 0), _V(0, 0, -1), "CARGO6");
	CARGO7 = CreateAttachment(false, _V(-17.7, 10.15, 1.12), _V(-.866, .5, 0), _V(0, 0, -1), "CARGO7");
	CARGO8 = CreateAttachment(false, _V(-19.2, 11.0, 1.12), _V(-.866, .5, 0), _V(0, 0, -1), "CARGO8");
	CARGO9 = CreateAttachment(false, _V(0, 20.2, 1.12), _V(0, 1, 0), _V(0, 0, -1), "CARGO9");
	CARGO10 = CreateAttachment(false, _V(0, 21.75, 1.12), _V(0, 1, 0), _V(0, 0, -1), "CARGO10");
	CARGO11 = CreateAttachment(false, _V(17.7, 10.15, 1.12), _V(.866, .5, 0), _V(0, 0, -1), "CARGO11");
	CARGO12 = CreateAttachment(false, _V(19.2, 11.0, 1.12), _V(.866, .5, 0), _V(0, 0, -1), "CARGO12");
	CARGO13 = CreateAttachment(false, _V(20.3, 0, 1.12), _V(1, 0, 0), _V(0, 0, -1), "CARGO13");
	CARGO14 = CreateAttachment(false, _V(21.8, 0, 1.12), _V(1, 0, 0), _V(0, 0, -1), "CARGO14");
	CARGO15 = CreateAttachment(false, _V(17.7, -10.15, 1.12), _V(.866, -.5, 0), _V(0, 0, -1), "CARGO15");
	CARGO16 = CreateAttachment(false, _V(19.2, -11.0, 1.12), _V(.866, -.5, 0), _V(0, 0, -1), "CARGO16");

and the cargo
Code:
P 0 -1.67 0  0 0 -1  0 1 0  POD

It seems the ones that are visually distorted are 3,4,7,8,11,12,15,16. These are the ones NOT at 90 degrees.

---------- Post added 06-20-16 at 05:21 AM ---------- Previous post was 06-19-16 at 06:57 AM ----------

OK. I have run into an issue I hope someone can help.

To save on frame rates we go to the section to change the vc. So if thrust changes refresh the data.

So we have a section to show which cargopod is selected. The value is PODSel.
in the
void TESTVC::clbkPostStep(double simt, double simdt, double mjd)
Code:
if (PODSel != PODSel_last_drawn){
		PODSel_last_drawn = PODSel;
		oapiVCTriggerRedrawArea(0, AID_FUELSTATUS);
	}
So if PODSel is not the same as PODSel_last_drawn then go to retrigger the vc

I can see in the debugger that PODSel=11 and PODSel_last_drawn=10
So they are not the same so it should go to retrigger thevc. But it doesn't

It only triggers when I switch the view.

Code:
void TESTVC::RedrawPanel_Fuelstatus(SURFHANDLE surf, int part)

{
	
	
	
	//SURFHANDLE const tex3 = oapiGetTextureHandle(meshhg_VC,5 );
	char cbuf[20];
	HDC hDC = oapiGetDC(surf);



	
	level2 = GetPropellantMass(tank);

	SelectObject(hDC, g_Param.hBrush[3]);//green box

	level3 = ((level2 / FUELMASS)*237);
	Rectangle(hDC, 110, 34, (int)(110.0 + level3), 75);  //fuel

	//THRUST
	level = GetThrusterLevel(th_main[0]);
	//double level2 = GetPropellantMass(tank);

	SelectObject(hDC, g_Param.hBrush[3]);//green box
	Rectangle(hDC, 114, 111, (int)(114 + level * (346 - 114)), 160);//thrust
	//POD
	SetTextColor(hDC, RGB(0, 153, 0));
	SetTextAlign(hDC, TA_LEFT);
	SetBkMode(hDC, TRANSPARENT);

	SelectObject(hDC, g_Param.hFont[2]);

	if (PODSel == 1) {
		sprintf(cbuf, "POD 1 Selected", 14);
		TextOut(hDC, 144, 400, cbuf, strlen(cbuf));
	}
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Distortion usually means one of the direction vectors is not normalized to length 1.0

(x² + y² + z² = 1)

This can also be happening on the POD cargo end.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Thanks

I hate to have extra attachment points on the pods.

So if on the endurance the pod attachment is :
_V(-.866, -.5, 0), _V(0, 0, -1) what should the pod attachment look like?

now if I can fix the retrigger vc issue:)
 
Last edited:

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
now if I can fix the retrigger vc issue:)

Why is the first parameter for the VC ID 0 in your call? If you want to trigger a redraw independent of the VC position in which the area was defined, use -1.

Code:
	/**
	* \brief Triggers a redraw notification for a virtual cockpit area.
	* \param vc_id virtual cockpit identifier
	* \param area_id area identifier (as specified during area registration)
	* \note This function triggers a call to the VESSEL2::ovcVCRedrawEvent() callback function in the vessel module.
	* \note The redraw notification is normally only sent if vc_id is equal to the currently
	*  active virtual cockpit position (>=0). To invoke the redraw notification
	*  independent of the currently active position, set vc_id to -1.
	*/
OAPIFUNC void       oapiVCTriggerRedrawArea (int vc_id, int area_id);
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
THanks. I will change that. I was just looking at that:thumbup:

Now to fix attachment distort

well on the Endurance the attachment is
_V(-.866, -.5, 0) and -.866^2 + -5^2 +0^2 =1

but 0, 0, -1 0^2+0^2+-1^2 =-1 so is this okay?

---------- Post added 06-21-16 at 04:49 AM ---------- Previous post was 06-20-16 at 07:10 AM ----------

vc fixed. Now i am bit confused on the attachments. the the cargoes are at 12,2,3,4,6,8,9,10 o'clock. So the cargo at 2 would be at 60 degrees, with 0 at the top.
then you get the sin and cosine, right?
that make it cos -.9524 and sin -.30481
 
Last edited:

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire

vc fixed. Now i am bit confused on the attachments. the the cargoes are at 12,2,3,4,6,8,9,10 o'clock. So the cargo at 2 would be at 60 degrees, with 0 at the top.
then you get the sin and cosine, right?
that make it cos -.9524 and sin -.30481


Depends on the coordinate system - remember, Orbiter is left-handed. Also you should make sure you are using the correct angular unit system - degrees or radians.

sin(60°) = 0.86602540378443864676372317075294
cos(60°) = 0.5
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Well That is what I have the sin part is rounded.
_V(.866, .5, 0), _V(0, 0, -1), "CARGO11");

I wonder if it is the issue that the pods is:
P 0 -1.67 0 0 0 -1 0 1 0 POD
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Well That is what I have the sin part is rounded.
_V(.866, .5, 0), _V(0, 0, -1), "CARGO11");

I wonder if it is the issue that the pods is:
P 0 -1.67 0 0 0 -1 0 1 0 POD

Yes, you have a small rounding error, but that is less than 1/1000th in the end.

Are you modifying the attachments somewhere, for example for updating the positions after loading the scenario?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Yes. I am moving the attachments out and in.
here the attachment is created.

Code:
CARGO3 = CreateAttachment(false, _V(-17.7, -10.15, 1.12), _V(-.866, -.5, 0), _V(0, 0, -1), "CARGO3");
initial position of attacment

Code:
CARGO3_pos.x = -17.7;
	CARGO3_pos.y = -10.15;
	CARGO3_pos.z = 1.12;
	CARGO3_INT_POS = 1.12;

Code:
if (PODSel == 3){
		//SendHudMessage("Rack 3 Selected");
		if (CARGO3_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO3_status == RACK_RAISING) {
				if (CARGO3_proc > 0.0) CARGO3_proc = max(0.0, CARGO3_proc - da);
				else                CARGO3_status = RACK_UP;
			}
			else {
				if (CARGO3_proc < 1.0) CARGO3_proc = min(1.0, CARGO3_proc + da);
				else                CARGO3_status = RACK_DOWN;
			}
			if (CARGO3_status == RACK_UP)SendHudMessage("Rack 1 Retracted");
			if (CARGO3_status == RACK_DOWN)SendHudMessage("Rack 1 Extended");
		}
CARGO3_pos.z = CARGO3_INT_POS - (CARGO3_proc * 5);
	SetAttachmentParams(CARGO3, CARGO3_pos, _V(-.866, -.5, 0), _V(0, 0, -1));
	}
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Are you sure this is the only place? and there are no mismatches with CARGO3 somewhere?
 
Top