C++ Question Help debugging

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,860
Reaction score
2,832
Points
203
Location
Dallas, TX
Thanks. I think the staging is handle by the mode number.

I need to replace the fairing code (double).

Should I do that for the mode? If mode=orbit,orbit no fairing,......
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,860
Reaction score
2,832
Points
203
Location
Dallas, TX
Weird. Why is:
Document
NameValueType
FAIRING_status10ARTEMIS2::FAIRINGStatus
Code:
 enum FAIRINGStatus { SEPARATE,NOT_SEPARATE } FAIRING_status;
Code:
if (FAIRING_status == NOT_SEPARATE)
                blowFairing();
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,752
Reaction score
2,497
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
That looks weird, but you could easily check if that is bad code messing with your enums: Just assign explicit values to the enum classifiers.

enum FAIRINGStatus {SEPARATE = 0, NOT_SEPARATE = 1};
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,860
Reaction score
2,832
Points
203
Location
Dallas, TX
Thanks.

I think this is correct?
Code:
   enum FAIRINGStatus { SEPARATE = 0, NOT_SEPARATE = 1 }FAIRING_status; [\code]
and then initalize:
[code]FAIRING_status = NOT_SEPARATE;; [\code]

I have a break set when it set the mesh and

FAIRING_status==NOT_SEPARATE (1)

when it goes to blow the fairing.

[code]
FAIRING_status==NOT_SEPARATE (1)
NOT_SEPARATE NOT_SEPARATE (1)
Code:
case 10:        // Orbit config
        SetMeshVisibilityMode(3, MESHVIS_EXTERNAL | MESHVIS_VC);//cover
        SetMeshVisibilityMode(2, MESHVIS_EXTERNAL | MESHVIS_VC);//sm
        SetMeshVisibilityMode(12, MESHVIS_ALWAYS);//las
        if (FAIRING_status== NOT_SEPARATE) {///show fairing
            SetMeshVisibilityMode(13, MESHVIS_EXTERNAL | MESHVIS_VC);//fairing
            SetMeshVisibilityMode(14, MESHVIS_EXTERNAL | MESHVIS_VC);//fairing
            SetMeshVisibilityMode(15, MESHVIS_EXTERNAL | MESHVIS_VC);//fairing
        }
        if (FAIRING_status == SEPARATE) {
            SetMeshVisibilityMode(13, MESHVIS_NEVER);//fairing
            SetMeshVisibilityMode(14, MESHVIS_NEVER);//fairing
            SetMeshVisibilityMode(15, MESHVIS_NEVER);//fairing
        }
        break;
[\code]
fairing sep and then a ctd
 

Attachments

  • artemisdebug4.jpg
    artemisdebug4.jpg
    64 KB · Views: 1
  • artemisdebug5.jpg
    artemisdebug5.jpg
    61.9 KB · Views: 1
  • artemisdebug6.jpg
    artemisdebug6.jpg
    27.8 KB · Views: 1
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,860
Reaction score
2,832
Points
203
Location
Dallas, TX
this is the blow fairing code:
Code:
void ARTEMIS2::blowFairing() {
    
        PROPELLANT_HANDLE ph_lhf_aux, ph_rhf_aux;
        THRUSTER_HANDLE th_lhf_aux, th_rhf_aux;

        VESSELSTATUS vs;
        char name[256] = { "" };
        //    THRUSTER_HANDLE th_att_lin[16];
        //    OBJHANDLE h;
        VESSEL* v;
        (FAIRING_status = SEPARATE);
        //    ReloadMeshes();
        CHANGESTATE();
    

        GetStatus(vs);
        vs.flag[0] = 3;
        ofs = _V(0, 0, 0);
        Local2Rel(ofs, vs.rpos);

        sprintf_s(name, "%s-fair1", GetName());
        Local2Rel(ofs, vs.rpos);
        fair1h = oapiCreateVessel(name, "ARTEMIS_FAIR1", vs);
        v = oapiGetVesselInterface(fair1h);

        v->SetEmptyMass(200);
        ph_lhf_aux = v->CreatePropellantResource(5, 5, 1.0);
        th_lhf_aux = v->CreateThruster(_V(0, 0.0, 1.0), _V(0, -0.95, 0.1), 5000.0, ph_lhf_aux, 300.0, 0.0, 0);
        v->SetThrusterLevel(th_lhf_aux, 1.0);
        v->SetEnableFocus(false);
        //******
        GetStatus(vs);
        vs.flag[0] = 3;
        ofs = _V(0, 0, 0);
        Local2Rel(ofs, vs.rpos);

        sprintf_s(name, "%s-fair2", GetName());
        Local2Rel(ofs, vs.rpos);
        //        vs.arot.z += PI;
        fair2h = oapiCreateVessel(name, "ARTEMIS_FAIR2", vs);
        v = oapiGetVesselInterface(fair2h);

        v->SetEmptyMass(200);
        ph_rhf_aux = v->CreatePropellantResource(5, 5, 1.0);
        th_rhf_aux = v->CreateThruster(_V(0, 0.0, 1.0), _V(-0.87, 0.5, 0.1), 5000.0, ph_rhf_aux, 300.0, 0.0, 0);
        v->SetThrusterLevel(th_rhf_aux, 1.0);
        v->SetEnableFocus(false);

        //******
        GetStatus(vs);
        vs.flag[0] = 3;
        ofs = _V(0, 0, 0);
        Local2Rel(ofs, vs.rpos);

        sprintf_s(name, "%s-fair3", GetName());
        Local2Rel(ofs, vs.rpos);
        //        vs.arot.z += PI;
        fair3h = oapiCreateVessel(name, "ARTEMIS_FAIR3", vs);
        v = oapiGetVesselInterface(fair3h);

        v->SetEmptyMass(200);
        ph_rhf_aux = v->CreatePropellantResource(5, 5, 1.0);
        th_rhf_aux = v->CreateThruster(_V(0, 0.0, 1.0), _V(0.87, 0.5, 0.1), 5000.0, ph_rhf_aux, 300.0, 0.0, 0);
        v->SetThrusterLevel(th_rhf_aux, 1.0);
        v->SetEnableFocus(false);
        
}
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,860
Reaction score
2,832
Points
203
Location
Dallas, TX
I think I all ctd fixed.
I think i was missing a texture for rcs.

But now the only think seems to be the touchdown. When it lands it goes crazy. I think the touchdown points are wrong?
Code:
tatic const DWORD ntdvtx_geardown = 3;
static TOUCHDOWNVTX tdvtx_geardown[ntdvtx_geardown] = {
    { _V(0, 0, 12), 26150800, 18409627, 1.6, 0.1 },
    { _V(-2, 0, -12), 26150800, 18409627, 3.0, 0.2 },
    { _V(2, 0, -12), 26150800, 18409627, 3.0, 0.2 }
};
the bottom of the heatshield is Z .78
the capsule is a tailsitter
 

Buck Rogers

Major Spacecadet
Joined
Feb 26, 2013
Messages
457
Reaction score
397
Points
63
26150800, 18409627
those numbers are crazy high! what those the vessel weigh?
26150, 18400 is probably closer

if it sinks in the ground increase values, if acts crazy decrease
those it have wheels? Otherwise you can set the mus all to 0.2, 0.2
 
Last edited:

Buck Rogers

Major Spacecadet
Joined
Feb 26, 2013
Messages
457
Reaction score
397
Points
63
the capsule is a tailsitter
which way is the model facing on the Z axis?

I've just made a jettisionable heatshield, it's facing down (flight direction) on the Z+ axis, the TD points where a nightmare, but I got it figured. Mass 300kg.

Code:
TDP_1_0_POS = -1.73205 1.73205 0.5
TDP_1_0_STIFFNESS = 9432
TDP_1_0_DAMPING = 8304
TDP_1_0_MU = 25
TDP_1_0_MULNG = 25
 
TDP_1_1_POS = -1.73205 -1.73205 0.5
TDP_1_1_STIFFNESS = 9432
TDP_1_1_DAMPING = 8304
TDP_1_1_MU = 25
TDP_1_1_MULNG = 25
 
TDP_1_2_POS = 1.73205 1.73205 0.5
TDP_1_2_STIFFNESS = 9432
TDP_1_2_DAMPING = 8304
TDP_1_2_MU = 25
TDP_1_2_MULNG = 25
 
TDP_1_3_POS = 1.73205 -1.73205 0.5
TDP_1_3_STIFFNESS = 9432
TDP_1_3_DAMPING = 8304
TDP_1_3_MU = 25
TDP_1_3_MULNG = 25
 
TDP_1_4_POS = -2 0 0
TDP_1_4_STIFFNESS = 9432
TDP_1_4_DAMPING = 8304
TDP_1_4_MU = 25
TDP_1_4_MULNG = 25
 
TDP_1_5_POS = 2 0 0
TDP_1_5_STIFFNESS = 9432
TDP_1_5_DAMPING = 8304
TDP_1_5_MU = 25
TDP_1_5_MULNG = 25
 
TDP_1_6_POS = 0 -2 0
TDP_1_6_STIFFNESS = 9432
TDP_1_6_DAMPING = 8304
TDP_1_6_MU = 25
TDP_1_6_MULNG = 25
 
TDP_1_7_POS = 0 0 -0.5
TDP_1_7_STIFFNESS = 9432
TDP_1_7_DAMPING = 8304
TDP_1_7_MU = 25
TDP_1_7_MULNG = 25
 
TDP_1_8_POS = 0 2 0
TDP_1_8_STIFFNESS = 9432
TDP_1_8_DAMPING = 8304
TDP_1_8_MU = 25
TDP_1_8_MULNG = 25
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,860
Reaction score
2,832
Points
203
Location
Dallas, TX
So this is the orion mpcv td and it works. the capsule is a little off the ground.
Code:
static const DWORD ntdvtx_geardown = 6;
static TOUCHDOWNVTX tdvtx_geardown[ntdvtx_geardown] = {
    {_V(0,-3.6, -1.2), 9e4, 1e2, 3.0, 0.2},
    {_V(-3, 2, -1.1), 9e4, 1e2, 3.0, 0.2},
    {_V(3, 2, -1.1), 9e4, 1e2, 3.0, 0.2},
    {_V(0,-5,  3),   8e4, 1e2, 3.0},
    {_V(-5, 4,  3),   8e4, 1e2, 3.0},
    {_V(5, 4,  3),   8e4, 1e2, 3.0}

};
yes Z axis. the mass is 10220
 

Attachments

  • orionlanded.jpg
    orionlanded.jpg
    45.6 KB · Views: 1

Buck Rogers

Major Spacecadet
Joined
Feb 26, 2013
Messages
457
Reaction score
397
Points
63
the bottom of the heatshield is Z .78
is this - 2.78 on the Y axis?
so the models +Z axis is pointing straight down? or up?
if it's pointing down you can do as above (this has four corners btw), otherwise switch +-.
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,860
Reaction score
2,832
Points
203
Location
Dallas, TX
The bottom of the shield is .78. points up
 

Attachments

  • orionlshield.jpg
    orionlshield.jpg
    68.2 KB · Views: 2

Buck Rogers

Major Spacecadet
Joined
Feb 26, 2013
Messages
457
Reaction score
397
Points
63
The bottom of the shield is .78. points up
I take it the shield is not detachable, is it loaded as a seperate mesh? (generally the mesh should be centered around thhe COG?)
If you can send me the whole mesh I'll put it in VB and set the points, probably quicker than making suggestions (I've had some practice recently).
 
Top