Orbiter-Forum [SDK Question] Touchdown points definition 2016
 Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

 Orbiter SDK Orbiter software developers post your questions and answers about the SDK, the API interface, LUA, meshing, etc.

 11-14-2016, 01:43 PM #106 gattispilot Addon Developer Thanks. So the suspension animation will change? So on the LER it has 6 wheels. So each should changed based on what?
 11-14-2016, 02:03 PM #107 jedidia shoemaker without legs Quote: Oh I would think that the vessel would be at the surface. Yes, but since the touchdown points are simulating suspension, your altitude will still vary. As long as your wheels don't account for that, they'll dip into the ground. Currently this is a bit tough to do (see my last few posts), so I hope the Doctor will implement some way to let us know the current compression of a touchdown point in the future.
 11-14-2016, 02:07 PM #108 Urwumpe Certain Super User Quote: Originally Posted by gattispilot  Thanks. So the suspension animation will change? So on the LER it has 6 wheels. So each should changed based on what? To explain you what jedidia already found out: There is no way right now to query the current positions of the touchdown points from Orbiter to solve the animation. You only tell Orbiter with your definition: With 0N weight force on the suspension, your wheel would be at this position. And you tell it: By compressing the suspension by one meter, the spring force grows from 0N to x N. double the distance and the force doubles. Hookes Law implemented in Orbiters API. One solution: You know at rest on Earth your touchdown point will be at a known position in the mesh. You know your spacecraft will weight about m kg. You have a spring constant of c. So, in your definition you add simply the following distance to your touchdown point in the mesh: So, you need to place your mesh right now either in a way, that it looks correct at equilibrium (all oscillations damped, flat surface, all springs compressed by weight). Or you calculate yourself, how far away each wheel is from the surface and animate it accordingly (which is the Pandoras Box of all solutions, because solving every small subproblem creates new problems to solve) Also Orbiter uses a much simpler way of solving the suspension mechanisms (A simple linear spring, no unsprung weight) than it actually is in reality. Could be important for the rover animations, but I doubt anybody except mechanical engineers would notice the difference. Or Jeremy Clarkson. Last edited by Urwumpe; 11-14-2016 at 02:14 PM.
 Thanked by:
 11-14-2016, 02:19 PM #109 gattispilot Addon Developer Thanks. I guess I will wait. But nothing explains why my crawler spins around on the z axis
 11-14-2016, 02:21 PM #110 Urwumpe Certain Super User Quote: Originally Posted by gattispilot  Thanks. I guess I will wait. But nothing explains why my crawler spins around on the z axis We have one potential explanation in SSU, which can be summarized as: There is no stable solution by Orbiters iterative solver to the differential equation system of the touchdown points because the initial guess presented in the scenario file is too far away from the solution, and thus, the PDE does not converge. I suspect this applies especially to vehicles where the following factors make it much harder to find a solution: High mass Huge spring constant Last edited by Urwumpe; 11-14-2016 at 02:24 PM.
 11-14-2016, 02:27 PM #111 gattispilot Addon Developer ? 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.
 11-14-2016, 03:27 PM #112 Urwumpe Certain Super User Quote: Originally Posted by gattispilot  ? 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?
 Thanked by:
 11-14-2016, 03:35 PM #113 gattispilot Addon Developer Quote: Originally Posted by Urwumpe  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.
 11-14-2016, 04:39 PM #114 Urwumpe Certain Super User Quote: Originally Posted by gattispilot  I used the same touchdown points from 2010. In 2010 it works great but not in 2016. Same mesh in both. You only use the same numbers. You are not using the same API functions. You are not even using the same numbers for the same entity in the Orbiter API. The touchdown points in one function are different to the touchdown points in the other. Its a bit said that I have to tell you this again but: Stop guessing. Stop fooling yourself. Know what the hell you are doing. Read the manual about what the functions do, which you want to use. Know what the numbers, which you give to Orbiter mean in that context. Be precise. Even a single changed word in a definition can change everything. PS: And you should already know that the meshes in Orbiter doesn't matter. I can replace the Space Shuttle mesh in SSU by Donald Trump nude in Superman pose and it will still fly like a Space Shuttle. It only feels wrong.
 11-14-2016, 04:52 PM #115 gattispilot Addon Developer I have this in the class; Code: 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));; This is the only place that sets the touchdown. Since in works in sc3/4 I wonder if it something else The meshes do matter as far as the orientation. Last edited by gattispilot; 11-14-2016 at 04:54 PM.
 11-14-2016, 04:59 PM #116 Urwumpe Certain Super User Quote: Originally Posted by gattispilot  The meshes do matter as far as the orientation. No, not at all. Rotate the mesh by 180°, and your vessels Z-axis will still point forward. It only looks different from outside.
 11-14-2016, 11:48 PM #117 mike-c Orbinaut TOUCHDOWNVTX reset? Is there a way to modify TOUCHDOWNVTX during VESSEL-lifetime? If i call Code: SetTouchdownPoints(tdvtx, NTDVTX); in Code: clbkPreStep(double simt, double simdt, double mjd) a second time (even with the same values), i find my vessel at NaN. Thanks in advance... ---------- Post added at 11:48 PM ---------- Previous post was at 10:50 PM ---------- Quote: Originally Posted by gattispilot  I have this in the class; Code: 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));; This is the only place that sets the touchdown. Since in works in sc3/4 I wonder if it something else The meshes do matter as far as the orientation. If following could help: this generic Launchpad-VESSEL sets up touchdown-points right after martins calculation, given above: See here Quote: Description English: Regular tetrahedron and its circumscribed sphere. Русский: Правильный вписанный тетраэдр ABCD. Date 23 January 2014, 20:32:06 Source Own work Author Illustr It reads the common params (Mass[k], Size[m]) and the custom params (Base[m], RelTop[m]) from .cfg-file. On a circle (in intersecting z =H-O-A at Base) TD[0]=, TD[1]= and TD[2]= are placed in equal distance and "loaded" with Mass/3. Then above formulas are applied giving . TD[3]= is placed in z=Base+RelTop, and an attachment placed right there (not so interesting for your purpose). From this values TOUCHDOWNVTX -record is filled and set. You find it in Code: void gLP::clbkSetClassCaps (FILEHANDLE cfg), line 110-167 I would like to have the TD1-3 to (extend,retract) on command to Level out uneven ground, but this seems not to work this way. Anyway, here the little vessel (mark you, this will work only if CoG=_V(0,0,0) =): Code: // ============================================================== // ORBITER MODULE: gLP // // gLP.cpp // generic Launchpad // // ============================================================== #define STRICT #define ORBITER_MODULE #include #include "orbitersdk.h" #include "resource.h" #define _USE_MATH_DEFINES #include #include 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 (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; }
 Thanked by:
 11-15-2016, 11:51 AM #118 gattispilot Addon Developer 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.
 Thanked by:
 11-15-2016, 02:49 PM #119 mike-c Orbinaut Quote: Originally Posted by gattispilot  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. Anyway, good news if your crawler is crawling now. will follow your hint
 Thanked by:
 11-25-2016, 05:14 PM #120 gattispilot Addon Developer Not sure why making the Y value more negative raises the vessel above the ground? You can see the lower value is 0 Code: SetTouchdownPoints(_V(0, .001, 20), _V(-15, .001, -20), _V(15, .001, -20));; put the vessel on the ground. Code:  SetTouchdownPoints(_V(0, 5.45, 20), _V(-15, 5.45, -20), _V(15, 5.45, -20));; but this places the mesh/vessel into the ground. if I use this: Code: SetTouchdownPoints(_V(0, -15.55, 20), _V(-15, -15.45, -20), _V(15, -15.45, -20));; I should be 12.17 alt. and about 8 degrees down in pitch. not sure why?
 Thanked by:

 Posting Rules BB code is On Smilies are On [IMG] code is On HTML code is Off You may not post new threads You may not post replies You may not post attachments You may not edit your posts
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Orbiter-Forum.com     Announcements     Meets & Greets Orbiter Space Flight Simulator     Orbiter Web Forum         OFMM         Orbiter Forum Space Station         Simpit Forum     General Questions & Help     MFD Questions & Help     Hardware & Software Help     Tutorials & Challenges     Orbiter SDK     Orbiter Visualization Project     Orbiter Beta » Orbiter Project Orbiter Addons     OrbitHangar Addons & Comments     Addons     Addon Development     Addon Requests     Addon Support & Bugs         Addon Developer Forums     Orbiter Lua Scripting Far Side of the Moon     Spaceflight News     Math & Physics     Astronomy & the Night Sky     Backyard Rocketry     Brighton Lounge     International Forum

All times are GMT. The time now is 08:24 AM.