Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter SDK
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.

Reply
 
Thread Tools
Old 08-02-2019, 07:49 PM   #31
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Thanks. Weird while running the debug no ctd on hover. BUt the craft doesn't fly correctly.



but now it runs in regular mode

---------- Post added at 02:49 PM ---------- Previous post was at 11:17 AM ----------

So redid the TDpoint:
Code:
static const DWORD ntdvtx_geardown = 3;
static TOUCHDOWNVTX tdvtx_geardown[ntdvtx_geardown] = {
	{ _V(0, 0, 10), 1e6, 1e5, 1.6, 0.1 },
	{ _V(-3.5, 0, -1), 1e6, 1e5, 3.0, 0.2 },
	{ _V(3.5, 0, -1), 1e6, 1e5, 3.0, 0.2 } };
But now the hover quickly rises the vessel up and in orbit
Code:
	ph_main = CreatePropellantResource(FUELMASS);

	th_hover[0] = CreateThruster(_V(5, 0, 5), _V(0, 1, 0), 10/ 4, ph_main, RCS_ISP);
	th_hover[1] = CreateThruster(_V(-5, 0, 5), _V(0, 1, 0), 10 / 4, ph_main, RCS_ISP);
	th_hover[2] = CreateThruster(_V(5, 0, -5), _V(0, 1, 0), 10/ 4, ph_main, RCS_ISP);
	th_hover[3] = CreateThruster(_V(-5, 0, -5), _V(0, 1, 0), 10 / 4, ph_main, RCS_ISP);


	thg_hover = CreateThrusterGroup(th_hover, 4, THGROUP_HOVER);
gattispilot is online now   Reply With Quote
Old 08-02-2019, 10:36 PM   #32
kuddel
Donator
Default

Another thing that sometimes makes debugging hard (especially when dealing with CTDs) is that your stack might got corrupted somehow, so you can not easily track the point where the error occurred.

A usually good approach is to think about what should happen.
In our case: What method should be called when you apply hover....
clbkConsumeBufferedKey is a thing that comes to mind. Now set a break point there and step through in ever smaller steps until you either found no bug, or found the issue.

clbkPreStep rsp. clbkPostStep are also called very often, so these sometimes contain small bugs....working with break point in those methods however is 'kind of nerve wrecking as they are called very often


However, working with code that doesn't work usually teaches you the most!
Work with that. You have to climb the hill to get the fun down slide

---------- Post added at 00:36 ---------- Previous post was at 00:24 ----------

....and a little hint: The (API-)documentation also gives some hints on how the methods should behave.


Not only once did I thought I knew how a method should be implemented until I re-read the documentation and found out: I didn't

Last edited by kuddel; 08-02-2019 at 10:28 PM.
kuddel is offline   Reply With Quote
Thanked by:
Old 08-03-2019, 12:28 PM   #33
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

I thought I read about the not level having to do with the touchdown points. I tried Fred's code and the DG values and still a lot of pitch.

---------- Post added at 07:28 AM ---------- Previous post was at 06:31 AM ----------

So I used these values was able to lift off. not too much pitch. but drifts to the side.

Code:
const double MAXSPEED = 10; /* (2.78m/s = 10km/h) */
const double MASS = 4500;
const double FUELMASS = 1000;
const double RCS_ISP = 2900000000000;

Code:
	PROPELLANT_HANDLE ph_main;
	ph_main = CreatePropellantResource(FUELMASS);

	th_hover[0] = CreateThruster(_V(5, 0, 5), _V(0, 1, 0), 50000/ 4, ph_main, RCS_ISP);
	th_hover[1] = CreateThruster(_V(-5, 0, 5), _V(0, 1, 0), 50000 / 4, ph_main, RCS_ISP);
	th_hover[2] = CreateThruster(_V(5, 0, -5), _V(0, 1, 0), 50000/ 4, ph_main, RCS_ISP);
	th_hover[3] = CreateThruster(_V(-5, 0, -5), _V(0, 1, 0), 50000 / 4, ph_main, RCS_ISP);


	thg_hover = CreateThrusterGroup(th_hover, 4, THGROUP_HOVER);
gattispilot is online now   Reply With Quote
Old 08-03-2019, 01:56 PM   #34
4throck
Enthusiast !
 
4throck's Avatar
Default

How about using fred's Vessel Builder for this ? Even if you need a C++ vessel latter on, all the parameters will be the same (mass, thruster locations and power, fuel, etc).
4throck is offline   Reply With Quote
Old 08-04-2019, 01:41 PM   #35
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Thanks. did that. I got it up but the pitch changes. Since I added rcs I can horizon level. But the GS changes. Shouldn't that be 0 or small.

How can one make small altitude change?

I still like the movement via moving the Vessels lat and Long. BUt no altitude adjustment

---------- Post added at 08:41 AM ---------- Previous post was at 07:29 AM ----------

So by changing the touchdown Y value I can rise and lower. Not sure why the camera looking down direction doesn't seem to change
Code:
if (KEYDOWN(kstate, OAPI_KEY_NUMPAD7)) {

		//MOVEUP = 1;
		Height_From_Ground = Height_From_Ground + .1;
			SetTouchdownPoints(td, 4);
	}
	if (KEYDOWN(kstate, OAPI_KEY_NUMPAD9)) {

		//MOVEdown = 1;

	if (Height_From_Ground>0)	Height_From_Ground = Height_From_Ground - .1;
		SetTouchdownPoints(td, 4);
	}
Code:
void DRAGONFLYTITAN::SelectCockpitView(int CAM) {
	switch (CAM) {
	case 0: //FRONT
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraOffset(_V(0, height+1, 3.121));
		break;
	case 1: //bottom
		SetCameraDefaultDirection(_V(0, -1, 0));
		SetCameraOffset(_V(0, Height_From_Ground, 0));
		break;
	
	}
}
gattispilot is online now   Reply With Quote
Old 08-19-2019, 03:44 PM   #36
martins
Orbiter Founder
Default

Here is another option:

Since the quadcopter simulation problem had me intrigued, I have written a plugin for a generic quadcopter. It will be included in the next beta commit, whenever I find time to upload it. You are welcome to adapt the code for your Titan drone.Mine is currently Earth-based, so it will require adjustment for atmospheric and gravitational parameters, as well as vessel geometry.

I have so far implemented simple vertical velocity and attitude control, which makes it usable, but I also want to write some higher level autopilot modes, like flying to a specific point, or flying a course defined by waypoints. Possibly even following another vessel.

Btw. the mesh is my own, so it's going to be extremely basic - essentially just a placeholder, so you know where the copter is. If you or anybody else wants to contribute something better I'd be most grateful.
martins is offline   Reply With Quote
Old 08-19-2019, 04:39 PM   #37
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Thanks. Look forward to it.
gattispilot is online now   Reply With Quote
Reply

  Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter SDK


Thread Tools

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


All times are GMT. The time now is 08:02 PM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.