its not perfect as sometimes the wheels are covered by the mesh.
Pretty much unavoidable without hooking the suspension up to an animation.
its not perfect as sometimes the wheels are covered by the mesh.
Pretty much unavoidable without hooking the suspension up to an animation.
Oh I would think that the vessel would be at the surface.
I meant that because of 3 touchdown points there would be some coverage of the wheels. So maybe I need to increase the Y. So I am riding the surface?
Remember, Orbiter now simulates springs. How are those behaving, when you put weight on them?
So how would you add weight to the vessel? Besides coding it.
Oh I would think that the vessel would be at the surface.
Thanks. So the suspension animation will change? So on the LER it has 6 wheels. So each should changed based on what?
Thanks. I guess I will wait. But nothing explains why my crawler spins around on the z axis
?
Is there a way to make a vessel with no springs. Like a base has no springs. I could understand if I placed the crawler and it was ok. But then as it moved it spun around. But this happens when I place it.
Use the old SetTouchdownPoints function?
I used the same touchdown points from 2010. In 2010 it works great but not in 2016.
Same mesh in both.
void SLSCRAWLER::clbkSetClassCaps(FILEHANDLE cfg) {
SetEmptyMass(2721000);
SetSize(40);
SetPMI(_V(133, 189, 89));
SetSurfaceFrictionCoeff(0.005, 0.5);
SetRotDrag (_V(0, 0, 0));
SetCW(0, 0, 0, 0);
SetPitchMomentScale(0);
SetBankMomentScale(0);
SetLiftCoeffFunc(0);
SetTouchdownPoints(_V(0, .001, 20), _V(-15, .001, -20), _V(15, .001, -20));;
The meshes do matter as far as the orientation.
SetTouchdownPoints(tdvtx, NTDVTX);
clbkPreStep(double simt, double simdt, double mjd)
I have this in the class;
This is the only place that sets the touchdown. Since in works in sc3/4 I wonder if it something elseCode:void SLSCRAWLER::clbkSetClassCaps(FILEHANDLE cfg) { SetEmptyMass(2721000); SetSize(40); SetPMI(_V(133, 189, 89)); SetSurfaceFrictionCoeff(0.005, 0.5); SetRotDrag (_V(0, 0, 0)); SetCW(0, 0, 0, 0); SetPitchMomentScale(0); SetBankMomentScale(0); SetLiftCoeffFunc(0); SetTouchdownPoints(_V(0, .001, 20), _V(-15, .001, -20), _V(15, .001, -20));;
The meshes do matter as far as the orientation.
Description
English: Regular tetrahedron and its circumscribed sphere.
Русский: Правильный вписанный тетраэдр ABCD.
Date 23 January 2014, 20:32:06
Source Own work
Author Illustr
void gLP::clbkSetClassCaps (FILEHANDLE cfg), line 110-167
// ==============================================================
// ORBITER MODULE: gLP
//
// gLP.cpp
// generic Launchpad
//
// ==============================================================
#define STRICT
#define ORBITER_MODULE
#include <windows.h>
#include "orbitersdk.h"
#include "resource.h"
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstdio>
extern std::ostream cerr;
BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
// ==============================================================
// Some vessel parameters
// ==============================================================
const double gLP_SIZE = 20.0; // mean radius [m]
const VECTOR3 gLP_CS = {800,800,1600}; // x,y,z cross sections [m^2]
const VECTOR3 gLP_PMI = {2.28,2.31,0.79};// principal moments of inertia (mass-normalised) [m^2]
const VECTOR3 gLP_RD = {1,1,1};//{0.05,0.1,0.05}; // rotation drag coefficients
const double gLP_EMPTYMASS = 5e5; // empty vessel mass [kg]
const double gLP_FUELMASS = 0.0; // max fuel mass [kg]
const double gLP_ISP = 0; // fuel-specific impulse [m/s]
const VECTOR3 gLP_TDP[3] = {{0,-1.5,2},{-1,-1.5,-1.5},{1,-1.5,-1.5}}; // touchdown points [m]
const VECTOR3 gLP_COP = {0,0,0};//{0,0,-0.1}; // centre of pressure for airfoils [m]
const VECTOR3 gLP_DOCK_POS = {0,1.3,-1}; // docking port location [m]
const VECTOR3 gLP_DOCK_DIR = {0,0,1}; // docking port approach direction
const VECTOR3 gLP_DOCK_ROT = {0,1,0}; // docking port alignment direction
// ==============================================================
// gLP class interface
// ==============================================================
class gLP: public VESSEL3 {
public:
gLP (OBJHANDLE hVessel, int flightmodel);
~gLP ();
void clbkSetClassCaps (FILEHANDLE cfg);
int clbkConsumeBufferedKey(DWORD key, bool down, char *kstate);
void shiftActor(int n, double m);
static BOOL CALLBACK ActorDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
void clbkPreStep(double simt, double simdt, double mjd);
private:
static void vlift (VESSEL *v, double aoa, double M, double Re,
void *context, double *cl, double *cm, double *cd);
static void hlift (VESSEL *v, double aoa, double M, double Re,
void *context, double *cl, double *cm, double *cd);
// transformations for control surface animations
static MGROUP_ROTATE trans_Laileron, trans_Raileron;
static MGROUP_ROTATE trans_Lelevator, trans_Relevator;
ATTACHMENTHANDLE h0, h1;
HWND hDlg;
static const int NTDVTX = 4;
TOUCHDOWNVTX tdvtx[NTDVTX];
double Ytarget[4];
};
gLP::gLP (OBJHANDLE hVessel, int flightmodel)
: VESSEL3 (hVessel, flightmodel)
{
}
gLP::~gLP ()
{
}
// animation transformation definitions
static UINT GRP_LWING = 2;
static UINT GRP_RWING = 3;
static VECTOR3 LWING_REF = {-1.3,-0.725,-1.5};
static VECTOR3 LWING_AXIS = {-0.9619,-0.2735,0};
static VECTOR3 RWING_REF = {1.3,-0.725,-1.5};
static VECTOR3 RWING_AXIS = {0.9619,-0.2735,0};
static float AILERON_RANGE = (float)(20.0*RAD);
static float ELEVATOR_RANGE = (float)(30.0*RAD);
MGROUP_ROTATE gLP::trans_Laileron (0, &GRP_LWING, 1, LWING_REF, LWING_AXIS, AILERON_RANGE);
MGROUP_ROTATE gLP::trans_Raileron (0, &GRP_RWING, 1, RWING_REF, RWING_AXIS, AILERON_RANGE);
MGROUP_ROTATE gLP::trans_Lelevator (0, &GRP_LWING, 1, LWING_REF, LWING_AXIS, -ELEVATOR_RANGE);
MGROUP_ROTATE gLP::trans_Relevator (0, &GRP_RWING, 1, RWING_REF, RWING_AXIS, ELEVATOR_RANGE);
HINSTANCE htheModule;
static gLP* theVessel;
// ==============================================================
// Overloaded callback functions
// ==============================================================
// --------------------------------------------------------------
// Set the capabilities of the vessel class
// --------------------------------------------------------------
void gLP::clbkSetClassCaps (FILEHANDLE cfg)
{
//THRUSTER_HANDLE th_main, th_hover, th_rcs[14], th_group[4];
// physical vessel parameters
SetSize(gLP_SIZE);
SetEmptyMass (gLP_EMPTYMASS);
SetPMI (gLP_PMI);
SetCrossSections (gLP_CS);
SetRotDrag (gLP_RD);
// evaluate config-file
double lMass, lSize, lBase=0.0, lTop=1.0;
double x=0,y=0,z=0;
double Base, Top;
char *line;
char lmesh[80];
while(oapiReadScenario_nextline (cfg, line)){
if (!_strnicmp (line, "Mass =", 4)){
sscanf(line+6, "%lf", &lMass);
SetEmptyMass(lMass);
}else if(!_strnicmp (line, "Size =", 4)){
sscanf(line+6, "%lf", &lSize);
SetSize(lSize);
}else if(!_strnicmp (line, "Base =", 4)){
sscanf(line+6, "%lf", &lBase);
}else if(!_strnicmp (line, "RelTop =", 6)){
sscanf(line+8, "%lf", &lTop);
}
};
//sprintf(oapiDebugString(), "Base: %lf ; RolTop: %lf", lBase, lTop);
Base=lBase; Top=lTop+Base;
if(Top<Base) Top=Base+(-lTop);
//SetTouchdownPoints
VECTOR3 td0, td1, td2, td3;
TOUCHDOWNVTX vtxtmp;
double lZ0=GetSize(); double lX1=lZ0/sqrt(3.0);
td0 = _V(0,Base,lZ0);
td1 = _V(-lX1,Base,-lZ0/2);
td2 = _V(lX1,Base,-lZ0/2);
td3 = _V(0,Top,0);
double k = -9.81*(GetEmptyMass()/3)/-0.5;
double c = .95*2*sqrt(GetEmptyMass()*k);
vtxtmp.pos=td0; vtxtmp.stiffness = k; vtxtmp.damping=c; vtxtmp.mu=3;
tdvtx[0]= vtxtmp; Ytarget[0]=td0.y;
vtxtmp.pos=td1;
tdvtx[1]= vtxtmp; Ytarget[1]=td1.y;
vtxtmp.pos=td2;
tdvtx[2]= vtxtmp; Ytarget[2]=td2.y;
vtxtmp.pos=td3;
tdvtx[3]= vtxtmp; Ytarget[3]=td3.y;
SetTouchdownPoints(tdvtx, NTDVTX);
// attachment port definitions
h0=CreateAttachment(true, _V(0,Top,0), _V(0,1,0), _V(0,0,-1), "fVessel");
h0=CreateAttachment(false, _V(0,Top,0), _V(0,1,0), _V(0,0,-1), "tVessel");
// airfoil definitions
// control surface animations
// aerodynamic control surface defintions
// propellant resources
// main engine
// hover engine
// RCS engines
// camera parameters
SetCameraOffset (_V(0,20.0,10.0));
// associate a mesh for the visual
//AddMesh ("blc1arms");
//AddMesh ("blc1arms_base");
}
int gLP::clbkConsumeBufferedKey(DWORD key, bool down, char *kstate){
if (key == OAPI_KEY_SPACE && down && KEYMOD_CONTROL (kstate) && !KEYMOD_ALT(kstate)){
hDlg = CreateDialogParamA(htheModule, MAKEINTRESOURCE(IDD_ABOUT), GetActiveWindow(), ActorDlgProc,(LPARAM)this);
ShowWindow(hDlg, SW_SHOW);
return 1;
}
return 0;
}
void gLP::clbkPreStep(double simt, double simdt, double mjd){
// does not work
/*for(int i=0; i<4; i++){
if(tdvtx[i].pos.y < (Ytarget[i]-0.001)){
tdvtx[i].pos.y += 0.00001;
SetTouchdownPoints(tdvtx, NTDVTX);
}
else if(tdvtx[i].pos.y > (Ytarget[i]+0.001)){
tdvtx[i].pos.y -= 0.00001;
SetTouchdownPoints(tdvtx, NTDVTX);
}
}*/
}
BOOL CALLBACK gLP::ActorDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
theVessel=(gLP*)lParam;
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
EndDialog(hwnd, IDOK);
break;
case IDCANCEL:
DestroyWindow(hwnd);
// = NULL;
return TRUE;
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
void gLP::shiftActor(int n, double m){
// does not work
//if((n > -1)&(n<4)) Ytarget[n] += m;
}
// ==============================================================
// Airfoil lift/drag functions
// ==============================================================
void gLP::vlift (VESSEL *v, double aoa, double M, double Re,
void *context, double *cl, double *cm, double *cd)
{
/*static const double clp[] = { // lift coefficient from -pi to pi in 10deg steps
-0.1,-0.5,-0.4,-0.1,0,0,0,0,0,0,0,0,0,0,-0.2,-0.6,-0.6,-0.4,0.2,0.5,0.9,0.8,0.2,0,0,0,0,0,0,0,0,0,0.1,0.4,0.5,0.3,-0.1,-0.5
};*/
*cl=0.0; *cm=0.0; *cd=0.0;
}
void gLP::hlift (VESSEL *v, double aoa, double M, double Re,
void *context, double *cl, double *cm, double *cd)
{
/*static const double clp[] = { // lift coefficient from -pi to pi in 45deg steps
0,0.4,0,-0.4,0,0.4,0,-0.4,0,0.4
};*/
*cl=0.0; *cm=0.0; *cd=0.0;
}
// ==============================================================
// API callback interface
// ==============================================================
// --------------------------------------------------------------
// Vessel initialisation
// --------------------------------------------------------------
DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
{
return new gLP (hvessel, flightmodel);
}
// --------------------------------------------------------------
// Vessel cleanup
// --------------------------------------------------------------
DLLCLBK void ovcExit (VESSEL *vessel)
{
if (vessel) delete (gLP*)vessel;
}
DLLCLBK void InitModule(HINSTANCE hModule){
htheModule = hModule;
}
BOOL CALLBACK ActorDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
theVessel=(gLP*)lParam;
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDY1INC:
theVessel->shiftActor(0,0.01);
break;
case IDY1DEC:
theVessel->shiftActor(0,-0.01);
break;
case IDY2INC:
theVessel->shiftActor(1,0.01);
break;
case IDY2DEC:
theVessel->shiftActor(1,-0.01);
break;
case IDY3INC:
theVessel->shiftActor(2,0.01);
break;
case IDY3DEC:
theVessel->shiftActor(3,-0.01);
break;
case IDOK:
DestroyWindow(hwnd);
return TRUE;
break;
case IDCANCEL:
EndDialog(hwnd, IDCANCEL);
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
Well. In my case it wasn't the touchdown points casuing the issue. I gutted the cpp and h. So basic info telling which mesh. The issue is on how it moves.
Shuttle A has code where the touchdown and gear move.
SetTouchdownPoints(_V(0, .001, 20), _V(-15, .001, -20), _V(15, .001, -20));;
SetTouchdownPoints(_V(0, 5.45, 20), _V(-15, 5.45, -20), _V(15, 5.45, -20));;
SetTouchdownPoints(_V(0, -15.55, 20), _V(-15, -15.45, -20), _V(15, -15.45, -20));;