Problem Need Payload M. design help

tauruslittrow84

New member
Joined
Nov 12, 2011
Messages
58
Reaction score
0
Points
0
Want to add payload manager to my own vessel. Medium-Low with C ++ writing. But nevertheless cutting and pasting from PM SDK user guide.pdf and
PMdemonstrator.cpp has helped BUT this .cpp of mine does compile successfully however my vessel has no payload manager still. I'm leaving a lot out? I have listed the necessary files on the linker and PayloadManager.dll is in modules. VStudio always says succeeded, no errors, 1 warning..that pM.dll was ignored because there was no referrals for it or something like that. Any help? Here is the .cpp

==============+=================================================
//chippersat
//Class description for chippersat vessel class
//
//Addon author: Addon Developer
//Orbiter (C) 2002-2012 Martin Schweiger
//All rights reserved
//
//This file was generated by Xantcha's Orbiter vessel template
// ==============================================================

#include "chippersat.h"
#include "PayloadManager.h"


class chippersat:
public VesselWithPM<chippersat>
{
public:
chippersat (OBJHANDLE hObj, int fmodel);
~chippersat ();
/* Custom methods of your vessel
.........
.........
.........
*/
}

// ==============================================================
// Some vessel parameters
// ==============================================================
const double MASS = 500;
const double FUELMASS = 750.0;
const double ISP = 5e4;
const double MAXMAINTH = 3e4;
const double MAXHOVERTH = 1.5e4;
const double MAXRCSTH = 2e2;


// ==============================================================
// Overloaded callback functions
// ==============================================================
// --------------------------------------------------------------
// Set the capabilities of the vessel class
// --------------------------------------------------------------
void chippersat::clbkSetClassCaps (FILEHANDLE cfg)
{
THRUSTER_HANDLE th_main, th_hover;
THRUSTER_HANDLE th_rcs[34], th_group[4];
SetSize (3.5); //size parameter

// mass
SetEmptyMass (MASS);
//aerodynamic properties
SetCW (0.3, 0.3, 0.6, 0.9);
SetCrossSections (_V(10.5,15.0,5.8));
SetRotDrag (_V(0.6,0.6,0.35));
SetPitchMomentScale (1e-4);
SetBankMomentScale (1e-4);
//principal moment of inertia
SetPMI (_V(2.28,2.31,0.79));

// propellant resource
PROPELLANT_HANDLE hpr = CreatePropellantResource (FUELMASS);

// ***************** thruster definitions *******************
PARTICLESTREAMSPEC contrail_main = {
0, 5.0, 16, 200, 0.15, 1.0, 5, 3.0, PARTICLESTREAMSPEC::DIFFUSE,
PARTICLESTREAMSPEC::LVL_PSQRT, 0, 2,
PARTICLESTREAMSPEC::ATM_PLOG, 1e-4, 1
};
PARTICLESTREAMSPEC contrail_hover = {
0, 5.0, 8, 200, 0.15, 1.0, 5, 3.0, PARTICLESTREAMSPEC::DIFFUSE,
PARTICLESTREAMSPEC::LVL_PSQRT, 0, 2,
PARTICLESTREAMSPEC::ATM_PLOG, 1e-4, 1
};
PARTICLESTREAMSPEC exhaust_main = {
0, 2.0, 20, 200, 0.05, 0.1, 8, 1.0, PARTICLESTREAMSPEC::EMISSIVE,
PARTICLESTREAMSPEC::LVL_SQRT, 0, 1,
PARTICLESTREAMSPEC::ATM_PLOG, 1e-5, 0.1
};
PARTICLESTREAMSPEC exhaust_hover = {
0, 2.0, 10, 200, 0.05, 0.05, 8, 1.0, PARTICLESTREAMSPEC::EMISSIVE,
PARTICLESTREAMSPEC::LVL_SQRT, 0, 1,
PARTICLESTREAMSPEC::ATM_PLOG, 1e-5, 0.1
};
th_main = CreateThruster (_V(0,0,-4.35), _V(0,0,1), MAXMAINTH, hpr, ISP);
CreateThrusterGroup (&th_main, 1, THGROUP_MAIN);
AddExhaust (th_main, 8, 1, _V(0,0,-4.35), _V(0,0,-1));

th_hover = CreateThruster (_V(0,0,-4.35), _V(0,0,1), MAXHOVERTH, hpr, ISP);
CreateThrusterGroup (&th_hover, 1, THGROUP_HOVER);
AddExhaust (th_hover, 8, 1, _V(0,0,-4.35), _V(0,0,-1));


AddExhaustStream (th_hover, _V(0,0,-10), &contrail_hover);
AddExhaustStream (th_main, _V(0,0,-10), &contrail_main);
AddExhaustStream (th_hover, _V(0,0,-5), &exhaust_hover);
AddExhaustStream (th_main, _V(0,0,-5), &exhaust_main);

th_rcs[ 0] = CreateThruster (_V( 1,0, 3), _V(0, 1,0), MAXRCSTH, hpr, ISP);
th_rcs[ 1] = CreateThruster (_V( 1,0, 3), _V(0,-1,0), MAXRCSTH, hpr, ISP);
th_rcs[ 2] = CreateThruster (_V(-1,0, 3), _V(0, 1,0), MAXRCSTH, hpr, ISP);
th_rcs[ 3] = CreateThruster (_V(-1,0, 3), _V(0,-1,0), MAXRCSTH, hpr, ISP);
th_rcs[ 4] = CreateThruster (_V( 1,0,-3), _V(0, 1,0), MAXRCSTH, hpr, ISP);
th_rcs[ 5] = CreateThruster (_V( 1,0,-3), _V(0,-1,0), MAXRCSTH, hpr, ISP);
th_rcs[ 6] = CreateThruster (_V(-1,0,-3), _V(0, 1,0), MAXRCSTH, hpr, ISP);
th_rcs[ 7] = CreateThruster (_V(-1,0,-3), _V(0,-1,0), MAXRCSTH, hpr, ISP);
th_rcs[ 8] = CreateThruster (_V( 1,0, 3), _V(-1,0,0), MAXRCSTH, hpr, ISP);
th_rcs[ 9] = CreateThruster (_V(-1,0, 3), _V( 1,0,0), MAXRCSTH, hpr, ISP);
th_rcs[10] = CreateThruster (_V( 1,0,-3), _V(-1,0,0), MAXRCSTH, hpr, ISP);
th_rcs[11] = CreateThruster (_V(-1,0,-3), _V( 1,0,0), MAXRCSTH, hpr, ISP);
th_rcs[12] = CreateThruster (_V( 0,0,-3), _V(0,0, 1), MAXRCSTH, hpr, ISP);
th_rcs[13] = CreateThruster (_V( 0,0, 3), _V(0,0,-1), MAXRCSTH, hpr, ISP);
th_rcs[14] = CreateThruster (_V( 1,0, 0), _V(0, 1,0), MAXRCSTH, hpr, ISP);
th_rcs[15] = CreateThruster (_V( 1,0, 0), _V(0,-1,0), MAXRCSTH, hpr, ISP);
th_rcs[16] = CreateThruster (_V(-1,0, 0), _V(0, 1,0), MAXRCSTH, hpr, ISP);
th_rcs[17] = CreateThruster (_V(-1,0, 0), _V(0,-1,0), MAXRCSTH, hpr, ISP);
th_rcs[18] = CreateThruster (_V(0, 3, 0), _V(0,-1,0), MAXRCSTH, hpr, ISP);
th_rcs[19] = CreateThruster (_V(0, 3, 0), _V(0,-1,0), MAXRCSTH, hpr, ISP);
th_rcs[20] = CreateThruster (_V(0, 3, 0), _V(0,-1,0), MAXRCSTH, hpr, ISP);
th_rcs[21] = CreateThruster (_V(0, 3, 0), _V(0,-1,0), MAXRCSTH, hpr, ISP);
th_rcs[22] = CreateThruster (_V(0,-3, 0), _V(0, 1,0), MAXRCSTH, hpr, ISP);
th_rcs[23] = CreateThruster (_V(0,-3, 0), _V(0, 1,0), MAXRCSTH, hpr, ISP);
th_rcs[24] = CreateThruster (_V(0,-3, 0), _V(0, 1,0), MAXRCSTH, hpr, ISP);
th_rcs[25] = CreateThruster (_V(0,-3, 0), _V(0, 1,0), MAXRCSTH, hpr, ISP);
th_rcs[26] = CreateThruster (_V(3, 0, 0), _V(-1,0,0), MAXRCSTH, hpr, ISP);
th_rcs[27] = CreateThruster (_V(3, 0, 0), _V(-1,0,0), MAXRCSTH, hpr, ISP);
th_rcs[28] = CreateThruster (_V(3, 0, 0), _V(-1,0,0), MAXRCSTH, hpr, ISP);
th_rcs[29] = CreateThruster (_V(3, 0, 0), _V(-1,0,0), MAXRCSTH, hpr, ISP);
th_rcs[30] = CreateThruster (_V(-3,0, 0), _V( 1,0,0), MAXRCSTH, hpr, ISP);
th_rcs[31] = CreateThruster (_V(-3,0, 0), _V( 1,0,0), MAXRCSTH, hpr, ISP);
th_rcs[32] = CreateThruster (_V(-3,0, 0), _V( 1,0,0), MAXRCSTH, hpr, ISP);
th_rcs[33] = CreateThruster (_V(-3,0, 0), _V( 1,0,0), MAXRCSTH, hpr, ISP);



th_group[0] = th_rcs[0];
th_group[1] = th_rcs[2];
th_group[2] = th_rcs[5];
th_group[3] = th_rcs[7];
CreateThrusterGroup (th_group, 4, THGROUP_ATT_PITCHUP);

th_group[0] = th_rcs[1];
th_group[1] = th_rcs[3];
th_group[2] = th_rcs[4];
th_group[3] = th_rcs[6];
CreateThrusterGroup (th_group, 4, THGROUP_ATT_PITCHDOWN);

th_group[0] = th_rcs[14];
th_group[1] = th_rcs[17];
CreateThrusterGroup (th_group, 2, THGROUP_ATT_BANKLEFT);

th_group[0] = th_rcs[15];
th_group[1] = th_rcs[16];
CreateThrusterGroup (th_group, 2, THGROUP_ATT_BANKRIGHT);

th_group[0] = th_rcs[26];
th_group[1] = th_rcs[27];
th_group[2] = th_rcs[28];
th_group[3] = th_rcs[29];
CreateThrusterGroup (th_group, 4, THGROUP_ATT_LEFT);

th_group[0] = th_rcs[30];
th_group[1] = th_rcs[31];
th_group[2] = th_rcs[32];
th_group[3] = th_rcs[33];
CreateThrusterGroup (th_group, 4, THGROUP_ATT_RIGHT);

th_group[0] = th_rcs[8];
th_group[1] = th_rcs[11];
CreateThrusterGroup (th_group, 2, THGROUP_ATT_YAWLEFT);

th_group[0] = th_rcs[9];
th_group[1] = th_rcs[10];
CreateThrusterGroup (th_group, 2, THGROUP_ATT_YAWRIGHT);

th_group[0] = th_rcs[18];
th_group[1] = th_rcs[19];
th_group[2] = th_rcs[20];
th_group[3] = th_rcs[21];
CreateThrusterGroup (th_group, 4, THGROUP_ATT_DOWN);

th_group[0] = th_rcs[22];
th_group[1] = th_rcs[23];
th_group[2] = th_rcs[24];
th_group[3] = th_rcs[25];
CreateThrusterGroup (th_group, 4, THGROUP_ATT_UP);

CreateThrusterGroup (th_rcs+12, 1, THGROUP_ATT_FORWARD);
CreateThrusterGroup (th_rcs+13, 1, THGROUP_ATT_BACK);

SetCameraOffset (_V(0,0.8,0));
SetDockParams (_V(0,1.3,-1), _V(0,1,0), _V(0,0,-1));
SetTouchdownPoints (_V(0.4,0.2,2), _V(-0.4,0.5,2), _V(0.5,0.2,2));

static BEACONLIGHTSPEC beacon1;
static VECTOR3 beacon1pos = {1.5,-1.75,.37};
static VECTOR3 beacon1col = {.1, .2, .992};

beacon1.shape = (BEACONSHAPE_STAR);
beacon1.pos = &beacon1pos;
beacon1.col = &beacon1col;
beacon1.size = (.7);
beacon1.falloff = (0.6);
beacon1.period = (13);
beacon1.duration = (7);
beacon1.tofs = (2);
beacon1.active = true;

AddBeacon (&beacon1);


static BEACONLIGHTSPEC beacon2;
static VECTOR3 beacon2pos = {-1.35,1.49,1.23};
static VECTOR3 beacon2col = {1,0,0};

beacon2.shape = (BEACONSHAPE_STAR);
beacon2.pos = &beacon2pos;
beacon2.col = &beacon2col;
beacon2.size = (.7);
beacon2.falloff = (0.6);
beacon2.period = (9);
beacon2.duration = (5);
beacon2.tofs = (3);
beacon2.active = true;

AddBeacon (&beacon2);

static BEACONLIGHTSPEC beacon3;
static VECTOR3 beacon3pos = {-1.35,1.49,-.85};
static VECTOR3 beacon3col = {0,1,0};

beacon3.shape = (BEACONSHAPE_STAR);
beacon3.pos = &beacon3pos;
beacon3.col = &beacon3col;
beacon3.size = (.7);
beacon3.falloff = (0.6);
beacon3.period = (9);
beacon3.duration = (5);
beacon3.tofs = (5);
beacon3.active = true;

AddBeacon (&beacon3);


// visual specs
AddMesh ("chippersat");
}


// --------------------------------------------------------------
// Save/load vessele state to/from scenario
// --------------------------------------------------------------
void chippersat::clbkLoadStateEx (FILEHANDLE scn, void *vs)
{ //commented code is for reference only

char *line;
while (oapiReadScenario_nextline (scn, line)) {
//if (!strnicmp (line, "SOMEPARAM", 9)) {
// sscanf (line+9, "%lf", somevar);
//} else {
ParseScenarioLineEx (line, vs);
// unrecognised option - pass to Orbiter's generic parser
//}
}
}

void chippersat::clbkSaveState (FILEHANDLE scn)
{ //commented code is for reference only

//char cbuf[256];
// default vessel parameters
VESSEL2::clbkSaveState (scn);

// custom parameters
//sprintf (cbuf, "%0.1f", somefloatpara,);
//oapiWriteScenario_string (scn, "SOMEPARAM", cbuf);
}

// --------------------------------------------------------------
// Called at each simulation time step before the state is updated
// --------------------------------------------------------------
void chippersat::clbkPreStep (double simt, double simdt, double mjd)
{ //do something
}

// --------------------------------------------------------------
//Keyboard state handler. Check OrbiterAPI reference for details
// --------------------------------------------------------------
int chippersat::clbkConsumeBufferedKey (DWORD key, bool down, char *kstate)
{ return 0;
}


// ==============================================================
// API callback interface
// ==============================================================
// --------------------------------------------------------------
// Vessel initialisation
// --------------------------------------------------------------
DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
{
return new chippersat (hvessel, flightmodel);
}

// --------------------------------------------------------------
// Vessel cleanup
// --------------------------------------------------------------
DLLCLBK void ovcExit (VESSEL *vessel)
{
if (vessel) delete (chippersat*)vessel;
}


// Scenario Editor definations
DLLCLBK void secInit (HWND hEditor, OBJHANDLE hVessel){
//Here you can define your own Scenario Editor vessel-specific pages
//...

//Define PayloadManager Scenario Editor interface
PayloadManager::DefineScenarioEditorPage(hEditor, hVessel);
}
 
Top