Request New Shepard vehicle and tower

Re: Launch pad release of rocket....
Not sure why this code is not working?
...............
VESSEL3* v;
OBJHANDLE hvessel = GetAttachmentStatus(PAD1);

thrust = (v->GetThrusterLevel(hvessel));
....................
try the following maybe?
Code:
OBJHANDLE hvessel = GetAttachmentStatus(PAD1);
VESSEL2* v = (VESSEL2*)oapiGetVesselInterface(hvessel);

thrust = v->GetThrusterGroupLevel(THGROUP_MAIN);
 
Thanks. I think that works except I get a ctd
And running debugger I get the symbol not loaded it ctd when detaching

So here apply thrust to new sheppard and the thrust shows. when over .95 thrusthold counts down. when 0 ctd.

this is weird. so now when I run the scenario. fire up the rocket and switch to the launch table it ctd.


void BOLAUNCHTABLE::clbkPostStep (double simt, double simdt, double mjd)
{
//OBJHANDLE hvessel = oapiGetVesselByName("BlueOrigin/NewShephard"); //or whatever it is


OBJHANDLE hvessel = GetAttachmentStatus(PAD1);
VESSEL2* v = (VESSEL2*)oapiGetVesselInterface(hvessel);

thrust = v->GetThrusterGroupLevel(THGROUP_MAIN);




// VESSEL3* v;
// OBJHANDLE hvessel = GetAttachmentStatus(PAD1);

// thrust = (v->hvessel->GetThrusterHandleByIndex(0));


sprintf(oapiDebugString(), "rockettHRUST %0.4f thrustholdtime %0.4f", thrust, thrustholdtime);
if (thrust > 0.95)
{
thrustholdtime -= simdt;
if (thrustholdtime <= 0.0)
{
DetachChild(PAD1);
}
}
else
{
thrustholdtime = 3.0;
}
}
 

Attachments

  • boltabledebugx.jpg
    boltabledebugx.jpg
    52.4 KB · Views: 1
The detach child line is causing a CTD. I don't know if because the launch table is attached to the rocket and the pad.

I might redone the whole thing. And make the lauchtable mesh part of the rocket and pad. If rocket is attached then show the table. Then make it seen on the rocket has it is beening carried on the hauler
 
The detach child line is causing a CTD. I don't know if because the launch table is attached to the rocket and the pad.
So when your rocket is released, this line
Code:
GetAttachmentStatus(PAD1);
is going to return NULL, isn't it? So anything downstream that needs a valid hVessel is going to fail.

So you need to put in a conditional, you could do this:
Code:
void BOLAUNCHTABLE::clbkPostStep (double simt, double simdt, double mjd)
{
OBJHANDLE hvessel = GetAttachmentStatus(PAD1);

if(hVessel)
    {
    VESSEL2* v = (VESSEL2*)oapiGetVesselInterface(hvessel);
    thrust = v->GetThrusterGroupLevel(THGROUP_MAIN);
    ..... do stuff ......
    }

}
 
if(hVessel) { VESSEL2* v = (VESSEL2*)oapiGetVesselInterface(hvessel); thrust = v->GetThrusterGroupLevel(THGROUP_MAIN);
Thanks. it releases. but it shifts location.
the rocket and launch table are at the same place.

BlueOrigin:newsheppard
STATUS Landed Earth
POS -104.7571331 31.4229649
HEADING 359.08
ALT 12.459
AROT 153.599 13.182 -5.588
ATTACHED 0:0,BlueOrigin/Launch_table
AFCMODE 7
PRPLEVEL 0:1.000000 1:1.000000
NAVFREQ 0 0
LEGS 0 0.0000
SPEEDBRAKE 0 0.0000
RINGFIN 0 0.0000
FILTER 0 0.0000
APST 0 0 0 0 0 0 0 0.0000 0 0
LPRM NULL
END
BlueOrigin/Launch_table:BOlaunchTable
STATUS Landed Earth
POS -104.7571331 31.4229649
HEADING 359.08
ALT 3.999
AROT 59.222 -6.734 -12.643
ATTACHED 0:0,BOLaunchPad
AFCMODE 7
NAVFREQ 0 0
END
 

Attachments

  • newsheppardterrain.jpg
    newsheppardterrain.jpg
    91.2 KB · Views: 2
I don't understand why when release it shifts to here. I might make the launchpad to show the launchtable as a mesh. Then when the rocket is release the animation of the pad will work
 

Attachments

  • newsheppardterrain1.jpg
    newsheppardterrain1.jpg
    38.1 KB · Views: 3
No idea. launching from the launchpad does the same thing. thrust applied and then when release shifts.
 
No idea. launching from the launchpad does the same thing. thrust applied and then when release shifts.
Strange.
Some things you could try:
1. Move all the "rocket release" code into the clbkPreStep(....) section.
2. Check your attachment point parameters for typos, make sure vectors are normalised and orthogonal, etc.
That's about all I can think of 🤷‍♂️
 
Thank.
this in
void BOLAUNCHPAD::clbkPreStep(double SimT, double SimDT, double MJD) {
OBJHANDLE hVessel = GetAttachmentStatus(ROCKET);

if (hVessel)
{
VESSEL2* v = (VESSEL2*)oapiGetVesselInterface(hVessel);
thrust = v->GetThrusterGroupLevel(THGROUP_MAIN);






// VESSEL3* v;
// OBJHANDLE hvessel = GetAttachmentStatus(PAD1);

// thrust = (v->hvessel->GetThrusterHandleByIndex(0));


sprintf(oapiDebugString(), "rockettHRUST %0.4f thrustholdtime %0.4f", thrust, thrustholdtime);
if (thrust > 0.95)
{
thrustholdtime -= simdt;
if (thrustholdtime <= 0.0)
{
DetachChild(ROCKET);
}
}
else
{
thrustholdtime = 3.0;
}
}
}
the thrusthold does not countdown.

ROCKET = CreateAttachment(false, _V(0.00, 3.841, 0.00), _V(0, 1, 0), _V(0, 0, 1), "PAD", false);

i remove the thrusthold and worked great
 
Right is real, left is orbiter. need to go back and add some pad terrain,....
 

Attachments

  • BOPAD.jpg
    BOPAD.jpg
    55.7 KB · Views: 15
  • NS34A.jpg
    NS34A.jpg
    9.5 KB · Views: 15
Been working on the terrain/building.
original and updated. So now the new shepard can launch and the capsule has chutes. I need to look at the shepard at the auto land.
Thanks for the help in testing,,,,,
 

Attachments

  • cornranchtank1.jpg
    cornranchtank1.jpg
    64.8 KB · Views: 9
  • botank2.jpg
    botank2.jpg
    85.5 KB · Views: 9
  • botank1.jpg
    botank1.jpg
    76 KB · Views: 9
I made a NS34 scenario. I got a CTD when I separated the capsule. But ran the debugger an no ctd.
Questions. On launch at around 60km I released the capsule. I released the capsule and it shot forward and then the rocket went through it.
Should the rocket is slow by then so it would not go thru the capsule?

I tried the auto land. I think it might have too much fuel? It did correct but it crashed and then up righted
 

Attachments

  • ms34c.jpg
    ms34c.jpg
    27.9 KB · Views: 5
  • ns34a.jpg
    ns34a.jpg
    33.9 KB · Views: 6
  • ns34d.jpg
    ns34d.jpg
    26.6 KB · Views: 5
  • nsb.jpg
    nsb.jpg
    97.6 KB · Views: 6
  • Like
Reactions: GLS
Thank.
this in
void BOLAUNCHPAD::clbkPreStep(double SimT, double SimDT, double MJD) {
OBJHANDLE hVessel = GetAttachmentStatus(ROCKET);

if (hVessel)
{
VESSEL2* v = (VESSEL2*)oapiGetVesselInterface(hVessel);
thrust = v->GetThrusterGroupLevel(THGROUP_MAIN);






// VESSEL3* v;
// OBJHANDLE hvessel = GetAttachmentStatus(PAD1);

// thrust = (v->hvessel->GetThrusterHandleByIndex(0));


sprintf(oapiDebugString(), "rockettHRUST %0.4f thrustholdtime %0.4f", thrust, thrustholdtime);
if (thrust > 0.95)
{
thrustholdtime -= simdt;
if (thrustholdtime <= 0.0)
{
DetachChild(ROCKET);
}
}
else
{
thrustholdtime = 3.0;
}
}
}
the thrusthold does not countdown.

ROCKET = CreateAttachment(false, _V(0.00, 3.841, 0.00), _V(0, 1, 0), _V(0, 0, 1), "PAD", false);

i remove the thrusthold and worked great
Is that the exact code that you are compiling? You are using "simdt" in the logic, but the argument is called "SimDT".
For this, the only variable you need to declare in the class is a "double thrustholdtime". Also, it is a good idea to replace the "3.0" with a constant "const double HOLD_DOWN_TIME = 3.0;// seconds", and initialize thrustholdtime with it. Once it is working, you can then fine tune the hold down time just by changing that const.
 
Thanks.
I wonder if I should code something for main engine cut off. Like if alt>50000 then thrust =0:

I need a way to tell the capsule that it is separated. then if below 2000 deploy chutes
 
I wonder if I should code something for main engine cut off. Like if alt>50000 then thrust =0:
The reality was probably a bit more complex: it needs prop to land, and the apogee should be above 100km. I don't know what the priority is, but I'd guess it is to have enough prop to land the booster, so a minimum propellant check should be made first, and then check if the current apogee is above 100km.


C++:
const double MIN_PROP_TO_LAND = 0.1;// 10% of total
const double TGT_AP = 100000;// target altitude 100km



bool engine_cutoff = false;

if (GetPropellantLevel() <= MIN_PROP_TO_LAND)
{
    // shutdown to keep enough prop to land
    engine_cutoff = true;
}
else
{
    double v = 0;// current vertical velocity in m/s
    double h = 0;// current altitude meters

    VECTOR3 v3;
    oapiGetAirspeedVector( this, FRAME_HORIZON, &v3 );
    v = v3.y;
    oapiGetAltitude( this, &h );

    double ap = h + ( (v * v) / (2 * G));
    if (ap >= TGT_AP)
    {
        // shutdown as target apogee has been reached
        engine_cutoff = true;
    }
}

if (engine_cutoff == true)
{
    SetThrusterLevel( MAIN_THRUSTER, 0.0 );
}
Totally and completely untested, with some Orbiter functions written from memory, so probably wrong. I think that apogee calculation should be good enough. Parameters should be fine-tuned, especially the needed prop to land.
Also, the flight should be broken into phases, so different sets of logic control the vehicle: prelaunch, ascent, coast, landing, post-landing.


I need a way to tell the capsule that it is separated.
Use the a similar attachment check as you did for the pad.
 
I think MEShutt off is around 50,000m.

On the capsule.

I think this is right?
But the capsule is a child attachment.
void ORION2NEW::clbkPostStep(double simt, double simdt, double mjd)
{

OBJHANDLE hVessel = GetAttachmentStatus(NScapsule);

if (!hVessel)
{
mode = 3;
}


h = GetAltitude(ALTMODE_GROUND);


if ((mode==3) && (h<2000))SetConfig4_Chute();//dettach and below 2000
 
and this: I get a ctd

void NEWSHEPPARD::clbkPreStep(double SimT, double SimDT, double MJD)
{

const double MIN_PROP_TO_LAND = 0.1*54000;// 10% of total
const double TGT_AP = 50000;// target altitude 100km 50km
//double PropellantLevel;
//PropellantLevel = (GetPropellantMass(hProp));

bool engine_cutoff = false;
if (((GetPropellantMass(hProp) <= MIN_PROP_TO_LAND)))engine_cutoff = true;
//if (PropellantLevel < MIN_PROP_TO_LAND)engine_cutoff = true;
//if (GetPropellantLevel() <= MIN_PROP_TO_LAND)

else
{
double v = 0;// current vertical velocity in m/s
double h = 0;// current altitude meters
VECTOR3 v3;
oapiGetAirspeedVector(this, FRAME_HORIZON, &v3);
v = v3.y;
oapiGetAltitude(this, &h);

double ap = h + ((v * v) / (2 * G));
if (ap >= TGT_AP)
{
// shutdown as target apogee has been reached
engine_cutoff = true;
}
}

if (engine_cutoff == true)
{
SetThrusterLevel(th_main[0], 0.0);
}



}
 
I guess we need a drag brake applied automatically?
 

Attachments

  • 491601399_997367362503708_1884179279088452852_n.jpg
    491601399_997367362503708_1884179279088452852_n.jpg
    77.9 KB · Views: 4
Based on the average, MECO is usually somewhere around 50-57 km altitude. I think it ends up being around 50 km in Orbiter because that's when the apogee in the Orbit MFD shows around 105 km.
 
Back
Top