Idea Shuttle Fleet recompile for Orbiter 2016

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,757
Reaction score
2,740
Points
203
Location
Dallas, TX
Thanks
I get this from that code:
7 IntelliSense: too few arguments in function call c:\Orbiter2016\Orbitersdk\samples\VENTURESTAR\VS.cpp 854 74 VENTUREstar
Error 2 error C2660: 'oapiGetVesselInterface' : function does not take 0 arguments C:\Orbiter2016\Orbitersdk\samples\VENTURESTAR\VS.cpp 854 1 VENTUREstar
Error 3 error C2227: left of '->GetName' must point to class/struct/union/generic type C:\Orbiter2016\Orbitersdk\samples\VENTURESTAR\VS.cpp 854 1 VENTUREstar
 

Majid

Active member
Joined
Oct 31, 2014
Messages
156
Reaction score
27
Points
43
My bad, not testing these snippets

Code:
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
OBJHANDLE hChild = GetAttachmentStatus(ah);
if (oapiIsVessel(hChild)) { // something is attached!
    sprintf(oapiDebugString(), "%s is attached", oapiGetVesselInterface(hChild)->GetName());
} else sprintf(oapiDebugString(), "nothing is attached");
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,757
Reaction score
2,740
Points
203
Location
Dallas, TX
Thanks
Code:
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
				OBJHANDLE hChild = GetAttachmentStatus(ah);
				if (oapiIsVessel(hChild)) { // something is attached!
					sprintf(oapiDebugString(), "%s is attached", oapiGetVesselInterface(hChild)->GetName());
				}
				else sprintf(oapiDebugString(), "nothing is attached");
			}

Says PAM-1 is attached.
which is correct from the scn

So how to I tell it to do the stuff to hchild.
 

Majid

Active member
Joined
Oct 31, 2014
Messages
156
Reaction score
27
Points
43
Great! One step at a time. Run this code and tell me if releasing works without a CTD.

Code:
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
OBJHANDLE hChild = GetAttachmentStatus(ah);
if (oapiIsVessel(hChild)) { // something is attached!
         VESSEL *v = oapiGetVesselInterface(hChild);
	sprintf(oapiDebugString(), "%s is attached", 
        v->GetName());
        DetachChild(ah, 5);
}
else sprintf(oapiDebugString(), "nothing is attached");
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,757
Reaction score
2,740
Points
203
Location
Dallas, TX
Code:
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
		OBJHANDLE hChild = GetAttachmentStatus(ah);
		if (oapiIsVessel(hChild)) { // something is attached!
			VESSEL *v = oapiGetVesselInterface(hChild);
			sprintf(oapiDebugString(), "%s is attached",
				v->GetName());
			DetachChild(ah, 5);
		}
		else sprintf(oapiDebugString(), "nothing is attached");
				//else sprintf(oapiDebugString(), "nothing is attached");
			}

I got a CTD and the sat was not seen

I have a separate key for detaching though

---------- Post added at 08:27 PM ---------- Previous post was at 08:24 PM ----------

I reran I get nothing is attached and then ctd
 

Majid

Active member
Joined
Oct 31, 2014
Messages
156
Reaction score
27
Points
43
Where are your running the code now?

Run this in clbkPreStep or clbkPostStep, make sure nothing else is in those methods to prevent CTD from other sources. What happens? When you press your key to release, what code is run?

THIS piece of code should not cause a CTD unless I'm mistaken:

Code:
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
if (ah == NULL) {
   sprintf(oapiDebugString(), "Attachment Handle is NULL");
}
else {
OBJHANDLE hChild = GetAttachmentStatus(ah);
if (oapiIsVessel(hChild)) { // something is attached!
         VESSEL *v = oapiGetVesselInterface(hChild);
	sprintf(oapiDebugString(), "%s is attached", 
        v->GetName());
        DetachChild(ah, 5);
}
else sprintf(oapiDebugString(), "nothing is attached");
}


---------- Post added at 02:32 AM ---------- Previous post was at 02:30 AM ----------

But basically you'll want to run something like the above piece of code whenever releasing. I don't know the entirety of your source file so it's hard to tell where the CTD is coming from.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,757
Reaction score
2,740
Points
203
Location
Dallas, TX
So I took the detach child line out and it worked:
Code:
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
		OBJHANDLE hChild = GetAttachmentStatus(ah);
		if (oapiIsVessel(hChild)) { // something is attached!
			VESSEL *v = oapiGetVesselInterface(hChild);
			sprintf(oapiDebugString(), "%s is attached",
				v->GetName());
			//DetachChild(ah, 1);
		}
		else sprintf(oapiDebugString(), "nothing is attached");
				//else sprintf(oapiDebugString(), "nothing is attached");
			}


I have this for detach:
Code:
if (key == OAPI_KEY_F6){
			if (spintable == 0)	spintable = 1;
			else if (spintable == 3) DetachChild(sat_attach1, 1.0);

			return 1;
		}

CTRL f6 once starts the spin when at the correct rate? spintable =3 then press CTRLf6 again and it detaches

---------- Post added at 08:39 PM ---------- Previous post was at 08:33 PM ----------

This is in poststep
Code:
if (SPIN1 == 1){



		if ((spintable == 1) && (rotchange <= .50))rotchange = rotchange + .001;//OPERATE SPINTABLE and if rate change is less than .3 do not increase
		ANGULAR_VEL = 2 * PI * (rotchange);//apply rot to ang vel



		//sprintf(oapiDebugString(), " phi %d tilt %f spintable %f", spintable, ANGULAR_VEL, rotchange);
		if (phi < 0)phi = 0;
		//if (phi >1.2)phi = 1.2;
		xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
		xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
		if ((spintable == 1) || (spintable == 3)) phi = ANGULAR_VEL *simt;  //move ase attachment and ius
		ROT = _V(sin(phi), 0, cos(phi));
		if ((spintable == 1) && (rotchange >= .50)) spintable = 3;  // up to speed
		//SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
		SetAttachmentParams(sat_attach1, pl1_ofs, pl1_dir, ROT);//satellite
		//sets new attachment rotation values for saving
		pl1_rot.x = ROT.x;
		//pl4_dir.x = DIR.x;
		pl1_rot.y = ROT.y;
		//pl4_dir.y = DIR.y;
		pl1_rot.z = ROT.z;
		
		ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
		OBJHANDLE hChild = GetAttachmentStatus(ah);
		if (oapiIsVessel(hChild)) { // something is attached!
			VESSEL *v = oapiGetVesselInterface(hChild);
			sprintf(oapiDebugString(), "%s is attached",
				v->GetName());
			//DetachChild(ah, 1);
		}
		else sprintf(oapiDebugString(), "nothing is attached");
				//else sprintf(oapiDebugString(), "nothing is attached");
			}

when I press CTRL f6 the 2nd time it dettached
now to get it to spin
 

Majid

Active member
Joined
Oct 31, 2014
Messages
156
Reaction score
27
Points
43
This doesn't make much sense.

Code:
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
		OBJHANDLE hChild = GetAttachmentStatus(ah);
		if (oapiIsVessel(hChild)) { // something is attached!
			VESSEL *v = oapiGetVesselInterface(hChild);
			sprintf(oapiDebugString(), "%s is attached",
				v->GetName());
			//DetachChild(ah, 1);

The detach child call cannot cause any problems if the oapiIsVessel check passes. You were likely getting CTD due to other code interactions.

I advise against caching attachment handles like you seem to be doing here.
Code:
if (key == OAPI_KEY_F6){
			if (spintable == 0)	spintable = 1;
			else if (spintable == 3) DetachChild(sat_attach1, 1.0);

			return 1;
		}

Your code to detach really should be this, with all the checks (minus the debug calls ofc):
Code:
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
if (ah == NULL) {
   sprintf(oapiDebugString(), "Attachment Handle is NULL");
}
else {
OBJHANDLE hChild = GetAttachmentStatus(ah);
if (oapiIsVessel(hChild)) { // something is attached!
         VESSEL *v = oapiGetVesselInterface(hChild);
	sprintf(oapiDebugString(), "%s is attached", 
        v->GetName());
        DetachChild(ah, 5);
}
else sprintf(oapiDebugString(), "nothing is attached");
}
You have to detach the vessel *first* and then you can give it angular velocity.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,757
Reaction score
2,740
Points
203
Location
Dallas, TX
Thanks. But on your code wouldn't it automatically detach? I want the attachment point to spin and then press a key and release.

So then on the angular velocity where should it go?
 

Majid

Active member
Joined
Oct 31, 2014
Messages
156
Reaction score
27
Points
43
Adding the spin is easy. Right BEFORE DetachChild, you get the attachment status and get the child's OBJHANDLE then call SetAngularVel like so.

Code:
        OBJHANDLE hChild = GetAttachmentStatus(sat_attach1);
        DetachChild(sat_attach1, 1.0);
        if (oapiIsVessel(hChild)) {
             VESSEL *vChild = oapiGetVesselInterface(hChild);
              vChild->SetAngularVel(...)
        }


---------- Post added at 02:48 AM ---------- Previous post was at 02:46 AM ----------

Thanks. But on your code wouldn't it automatically detach? I want the attachment point to spin and then press a key and release.

So then on the angular velocity where should it go?

The code I posted is for when you do the final detach. The point I'm trying to drive home is the if statements and sanity checks to prevent CTD's. Just because you expect something to be attached doesn't mean it always will be. So detaching against some cached attachment handle is very dangerous and error prone.

So on first keypress you set off some flag to start rotating the attachment point and then on the second keypress you use my code to detach, and you won't have to cache any handles. My code shouldn't be in clbkPreStep or clbkPostStep, that was just to try and diagnose the CTD's.
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,757
Reaction score
2,740
Points
203
Location
Dallas, TX
THanks

So I added if spintable =4 which means the attachment spinning is at the rate and the 2nd CTRL F6 is pressed

Code:
if (SPIN1 == 1){//spintable#1



        if ((spintable == 1) && (rotchange <= .50))rotchange = rotchange + .001;//OPERATE SPINTABLE and if rate change is less than .3 do not increase
        ANGULAR_VEL = 2 * PI * (rotchange);//apply rot to ang vel



        //sprintf(oapiDebugString(), " phi %d tilt %f spintable %f", spintable, ANGULAR_VEL, rotchange);
        if (phi < 0)phi = 0;
        //if (phi >1.2)phi = 1.2;
        xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
        xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
        if ((spintable == 1) || (spintable == 3)) phi = ANGULAR_VEL *simt;  //move ase attachment and ius
        ROT = _V(sin(phi), 0, cos(phi));
        if ((spintable == 1) && (rotchange >= .50)) spintable = 3;  // up to speed
        //SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
        SetAttachmentParams(sat_attach1, pl1_ofs, pl1_dir, ROT);//satellite
        //sets new attachment rotation values for saving
        pl1_rot.x = ROT.x;
        //pl4_dir.x = DIR.x;
        pl1_rot.y = ROT.y;
        //pl4_dir.y = DIR.y;
        pl1_rot.z = ROT.z;
        
        ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
        OBJHANDLE hChild = GetAttachmentStatus(ah);
        if (oapiIsVessel(hChild)) { // something is attached!
            VESSEL *v = oapiGetVesselInterface(hChild);
            sprintf(oapiDebugString(), "%s is attached",
                v->GetName());
            if (spintable == 4){//spin is complete
                OBJHANDLE hChild = GetAttachmentStatus(sat_attach1);
                DetachChild(sat_attach1, 1.0);
                if (oapiIsVessel(hChild)) {
                    VESSEL *vChild = oapiGetVesselInterface(hChild);
                    vChild->SetAngularVel(_V(0, 0, 2));
                }
            }
        }
        else sprintf(oapiDebugString(), "nothing is attached");
                //else sprintf(oapiDebugString(), "nothing is attached");
            }
No CTD but the sat jumps away and no spinning.

---------- Post added at 09:03 PM ---------- Previous post was at 08:56 PM ----------

OK confused

1sk Key CTRL f6 sets spintable to 1 that starts the attachment to spin. when it gets to the desired rate then spintable is set to 3. Then press CTRL F6 again now spintable =4 and dettach the sat.

---------- Post added at 09:10 PM ---------- Previous post was at 09:03 PM ----------

For some reason when I had it detach from the key it would detach fine. Now it jumps high

---------- Post added at 09:15 PM ---------- Previous post was at 09:10 PM ----------

Code:
if (KEYMOD_CONTROL(kstate)) {
		if (key == OAPI_KEY_F6){
			if (spintable == 0)	spintable = 1;
			else if (spintable == 3) {
				spintable = 4;//DetachChild(sat_attach1, 1.0);
				DetachChild(sat_attach1, 1.0);
			}
			return 1;
		}
and
Code:
		ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
		OBJHANDLE hChild = GetAttachmentStatus(ah);
		if (oapiIsVessel(hChild)) { // something is attached!
			VESSEL *v = oapiGetVesselInterface(hChild);
			sprintf(oapiDebugString(), "%s is attached",
				v->GetName());
			if (spintable == 4){//spin is complete
				OBJHANDLE hChild = GetAttachmentStatus(sat_attach1);
				//DetachChild(sat_attach1, 0.001);
				if (oapiIsVessel(hChild)) {
					VESSEL *vChild = oapiGetVesselInterface(hChild);
					vChild->SetAngularVel(_V(2, 0, 0));
				}
			}
		}
		else sprintf(oapiDebugString(), "nothing is attached");
				//else sprintf(oapiDebugString(), "nothing is attached");
			}

no ctd or jumps But no spinning sat:(
 

Majid

Active member
Joined
Oct 31, 2014
Messages
156
Reaction score
27
Points
43
Remove the code from clbkPreStep or clbkPostStep and move it to here:

Code:
if (KEYMOD_CONTROL(kstate)) {
		if (key == OAPI_KEY_F6){
			if (spintable == 0)	spintable = 1;
			else if (spintable == 3) {
				spintable = 4;
                                OBJHANDLE hChild = GetAttachmentStatus(sat_attach1);
				DetachChild(sat_attach1, 1.0);
                                if (oapiIsVessel(hChild)) {
					VESSEL *vChild = oapiGetVesselInterface(hChild);
					vChild->SetAngularVel(_V(2, 0, 0));
				}
			}
			return 1;
		}
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,757
Reaction score
2,740
Points
203
Location
Dallas, TX
Works thanks. Is there a way to set the angular Velocity to 50 rpm on the z axis?
 

Majid

Active member
Joined
Oct 31, 2014
Messages
156
Reaction score
27
Points
43
Works thanks. Is there a way to set the angular Velocity to 50 rpm on the z axis?

1 rotation is 360 degrees, 50 rotations is equal to 18000 degrees/minute, which is 300 degrees/second. Go to the scenario editor, open a scn with a dg in orbit and use the scenario editor to give 300 degrees/s angular velocity in z axis and confirm if that looks right. If it does, then just copy the code from the scn editor.

---------- Post added at 03:55 AM ---------- Previous post was at 03:50 AM ----------

Code:
VECTOR3 avel;
avel.data[0] = 0;
avel.data[1] = 0;
avel.data[2] = 300*RAD;
vChild->SetAngularVel(avel);
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,757
Reaction score
2,740
Points
203
Location
Dallas, TX
Thanks.:):)
Code:
if ((spintable == 1) && (rotchange <= .50))rotchange = rotchange + .001;//OPERATE SPINTABLE and if rate change is less than .3 do not increase
		ANGULAR_VEL = 2 * PI * (rotchange);//apply rot to ang vel



		//sprintf(oapiDebugString(), " phi %d tilt %f spintable %f", spintable, ANGULAR_VEL, rotchange);
		if (phi < 0)phi = 0;
		//if (phi >1.2)phi = 1.2;
		xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
		xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
		if ((spintable == 1) || (spintable == 3)) phi = ANGULAR_VEL *simt;  //move ase attachment and ius
		ROT = _V(sin(phi), 0, cos(phi));
		if ((spintable == 1) && (rotchange >= .50)) spintable = 3;  // up to speed
		//SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
		SetAttachmentParams(sat_attach1, pl1_ofs, pl1_dir, ROT);//satellite
		//sets new attachment rotation values for saving
		pl1_rot.x = ROT.x;
		//pl4_dir.x = DIR.x;
		pl1_rot.y = ROT.y;
		//pl4_dir.y = DIR.y;
		pl1_rot.z = ROT.z;

		ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
		OBJHANDLE hChild = GetAttachmentStatus(ah);
		if (oapiIsVessel(hChild)) { // something is attached!
			VESSEL *v = oapiGetVesselInterface(hChild);
			//	sprintf(oapiDebugString(), "%s is attached",
			//	v->GetName());
		}



Code:
if (KEYMOD_CONTROL(kstate)) {
			if (key == OAPI_KEY_F6){
				if (spintable == 0)	spintable = 1;
				else if (spintable == 3) {
					spintable = 4;
					OBJHANDLE hChild = GetAttachmentStatus(sat_attach1);
					DetachChild(sat_attach1, 1.0);
					if (oapiIsVessel(hChild)) {
						VESSEL *vChild = oapiGetVesselInterface(hChild);
						VECTOR3 avel;
						avel.data[0] = 0;
						avel.data[1] = 0;
						avel.data[2] = 300 * RAD;
						vChild->SetAngularVel(avel);
					}
				}
				
				return 1;
			}
Works great. the only thing I noticed it seem the rotation of attachment was clockwise and release was counter clock wise?

Not sure which direction it should be.

Am I not sure the spinning rate I have is 50 rpm either.

---------- Post added at 05:44 AM ---------- Previous post was at 05:38 AM ----------

seem very good at attachments. Could you look at the Bepi issue.

I had it attached and then when unattached rotate. It did but when detach it went up rather than out. So I tried docking but when dock and then that vessel is attached it goes bad:
https://drive.google.com/open?id=1oq9gR-N0oavFMQ3B4RYJ04BOWfuTXpZG

---------- Post added at 08:11 PM ---------- Previous post was at 05:44 AM ----------

Another question:

I want just control surfaces in atmosphere and rcs in space.
Code:
ATMPRESSURE = GetAtmPressure();
if (ATMPRESSURE >.1)//in atmosphere so use control surfaces
{
	//EnableRCS(true);
	SetADCtrlMode(7);// enable all control surfaces
	(GetAttitudeMode() == RCS_NONE);
}
else {
	//EnableRCS(false);
	SetADCtrlMode(0);//disable control surface
	(GetAttitudeMode() == RCS_ROT);
	(GetAttitudeMode() == RCS_LIN);
}

but I get rcs on the pad on the Earth
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,757
Reaction score
2,740
Points
203
Location
Dallas, TX
Thanks. The launch works. What needs some work is the before launch.
As I read the SF doc. By pressing CTRL f6 the spintable rotates and maybe increases in rotation. When it hits 50 rpm then it stops increasing and maintains that 50 rpm. Then when released it will spin to a stop. So the spin table is an attachment point.
So in the scn SPIN1 is listed that lets it to use 1 attachment.
If my code when Spintable ==1 then start the spin. When it reaches 50? then spintable =3.
Code:
if (SPIN1 == 1){//spintable#1



		if ((spintable == 1) && (rotchange <= .50))rotchange = rotchange + .001;//OPERATE SPINTABLE and if rate change is less than .3 do not increase
		ANGULAR_VEL = 2 * PI * (rotchange);//apply rot to ang vel



		//sprintf(oapiDebugString(), " phi %d tilt %f spintable %f", spintable, ANGULAR_VEL, rotchange);
		if (phi < 0)phi = 0;
		//if (phi >1.2)phi = 1.2;
		xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
		xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
		if ((spintable == 1) || (spintable == 3)) phi = ANGULAR_VEL *simt;  //move ase attachment and ius
		ROT = _V(sin(phi), 0, cos(phi));
		if ((spintable == 1) && (rotchange >= .50)) spintable = 3;  // up to speed
		//SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
		SetAttachmentParams(sat_attach1, pl1_ofs, pl1_dir, ROT);//satellite
		//sets new attachment rotation values for saving
		pl1_rot.x = ROT.x;
		//pl4_dir.x = DIR.x;
		pl1_rot.y = ROT.y;
		//pl4_dir.y = DIR.y;
		pl1_rot.z = ROT.z;

		ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
		OBJHANDLE hChild = GetAttachmentStatus(ah);
		if (oapiIsVessel(hChild)) { // something is attached!
			VESSEL *v = oapiGetVesselInterface(hChild);
			//	sprintf(oapiDebugString(), "%s is attached",
			//	v->GetName());
		}

		
		//else sprintf(oapiDebugString(), "nothing is attached");
		//else sprintf(oapiDebugString(), "nothing is attached");
	
}

Not sure about the rate increase and the end point of 50 rpm
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,757
Reaction score
2,740
Points
203
Location
Dallas, TX
So 3 issues. Really 1 the other 2 are extra.
So I want the shuttle to use Control surfaces in atmosphere and RCS in space.
Code:
ATMPRESSURE = GetAtmPressure();
if (ATMPRESSURE >.1)//in atmosphere so use control surfaces
{
	//EnableRCS(true);
	SetADCtrlMode(7);//set control surface enable
	(GetAttitudeMode() == RCS_NONE);
}
else {
	//in space
	SetADCtrlMode(0);//disable control surfaces
	(GetAttitudeMode() == RCS_ROT);
	(GetAttitudeMode() == RCS_LIN);
}

But in atmosphere both work? Not really sure what determines that in the real shuttle.

So the other 2. It would nice to display the rpm and angle of the IUS/ase.
SF did that in the MFD. But I would like to display it on the HUD.

Code:
if (USEIUS == 1){
		//tilt of ase/IUS
		

		if (tilt == 1)tiltvalue = .6;  //first step
		if (tilt == 3)tiltvalue = 1.0;  //2nd step
		//phi = phi + .001;//move up second step
		if (tilt == 1)		phi = (phi + .001);//move up
		if (tilt == 2)		phi = (phi - .001);//move down
		if (tilt == 4)		phi = (phi + .001);//move down
		if ((tilt == 1) && (phi > tiltvalue))tilt = 3;  //reaches limit so 1st stop
		if ((tilt == 4) && (phi > tiltvalue))tilt = 0;  //reaches limit so 2nd stop
		if ((tilt == 2) && (phi < 0))tilt = 0;  //reaches limit so stop
		if (phi < 0)phi = 0;
		if (phi >1.0)phi = 1.0;
		//phi = 1;
		xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
		xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
		//if ((tilt == 1) || (tilt == 4) || (tilt == 2))phi = phi *simt;  //move ase attachment and ius
		DIR = _V(0, sin(phi), cos(phi));

		SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
		SetAttachmentParams(sat_attach1, pl1_ofs, DIR, pl1_rot);//ius
		//sets new attachment rotation values for saving
		pl1_dir.x = DIR.x;
		pl4_dir.x = DIR.x;
		pl1_dir.y = DIR.y;
		pl4_dir.y = DIR.y;
		pl1_dir.z = DIR.z;
		pl4_dir.z = DIR.z;

	}

	if (SPIN1 == 1){//spintable#1



		if ((spintable == 1) && (rotchange <= .50))rotchange = rotchange + .001;//OPERATE SPINTABLE and if rate change is less than .3 do not increase
		ANGULAR_VEL = 2 * PI * (rotchange);//apply rot to ang vel



		//sprintf(oapiDebugString(), " phi %d tilt %f spintable %f", spintable, ANGULAR_VEL, rotchange);
		if (phi < 0)phi = 0;
		//if (phi >1.2)phi = 1.2;
		xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
		xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
		if ((spintable == 1) || (spintable == 3)) phi = ANGULAR_VEL *simt;  //move ase attachment and ius
		ROT = _V(sin(phi), 0, cos(phi));
		if ((spintable == 1) && (rotchange >= .50)) spintable = 3;  // up to speed
		//SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
		SetAttachmentParams(sat_attach1, pl1_ofs, pl1_dir, ROT);//satellite
		//sets new attachment rotation values for saving
		pl1_rot.x = ROT.x;
		//pl4_dir.x = DIR.x;
		pl1_rot.y = ROT.y;
		//pl4_dir.y = DIR.y;
		pl1_rot.z = ROT.z;

		ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
		OBJHANDLE hChild = GetAttachmentStatus(ah);
		if (oapiIsVessel(hChild)) { // something is attached!
			VESSEL *v = oapiGetVesselInterface(hChild);
			//	sprintf(oapiDebugString(), "%s is attached",
			//	v->GetName());
		}

		
		//else sprintf(oapiDebugString(), "nothing is attached");
		//else sprintf(oapiDebugString(), "nothing is attached");
	
}

So if using the IUS then show the angle of tilt and if using spin table display the rpm
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,757
Reaction score
2,740
Points
203
Location
Dallas, TX
So I got the rcs issue fixed. But not sure about the rotation dispaly
Code:
ATMPRESSURE = GetAtmPressure();
if (ATMPRESSURE >.1)//in atmosphere so use control surfaces
{
	//EnableRCS(true);
	SetADCtrlMode(7);//set control surface enable
	(SetAttitudeMode(0));//no rcs
}
else {
	//in space
	SetADCtrlMode(0);//disable control surfaces
	(SetAttitudeMode(1) );
	(SetAttitudeMode(2) );
}

}
 

Gargantua2024

The Desktop Orbinaut
Joined
Oct 14, 2016
Messages
1,072
Reaction score
1,278
Points
128
Location
San Jose Del Monte, Bulacan
Hi there...I just recently downloaded Space Shuttle 2016 last week and I can find it's great! The Multistage2015-implemented launches made it possible to also insert historical launch audios as well (will share launch scenarios much much later).

However, I find that deploying satellites with IUS, PAM-D, and Centaur-G (borrowed from Velcro Rockets) upper stages not working. I tried pressing Ctrl+F6 or Ctrl+F8 but it just remained inside the payload bay. I even tried to add the lines USEIUS, SPIN1, SPIN2, and SPIN3 on the scenario files to no avail. I wonder, how do I deploy these satellites properly out?

Thanks;)
 
Top