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 offline   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 offline   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 offline   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 offline   Reply With Quote
Old 08-23-2019, 01:17 AM   #38
martins
Orbiter Founder
Default

I have uploaded a new Orbiter commit that includes the Quadcopter implementation (in Orbitersdk/samples/Vessel/Quadcopter). It's work in progress, but should be enough to play with the code.

There are currently three control loops implemented: vertical speed (controlled by manual throttle setting), pitch and bank attitude (controlled by manual pitch and roll input), and yaw velocity (controlled by manual yaw input).
Vertical speed is limited to +/-5m/s, and attitude is limited to 45degrees tilt. I've also implemented an "auto heading" mode that rotates the copter into the direction of movement for speeds above 5m/s. When it kicks in, the manual yaw control is disabled. I'm not sure if this is useful, but give it a go and disable it if you want.

You can also disable the control loops altogether and try direct control mode: RPM setting with throttle control, front/back RPM differentials with pitch controls, and left/right RPM differentials with roll controls. In practice this won't be very useful because it makes it very difficult to control the quadcopter.
martins is offline   Reply With Quote
Old 08-23-2019, 11:44 AM   #39
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Thanks. Not sure how to get it though?
gattispilot is offline   Reply With Quote
Old 08-23-2019, 01:11 PM   #40
martins
Orbiter Founder
Default

http://orbit.medphys.ucl.ac.uk/betainstall.html
martins is offline   Reply With Quote
Thanked by:
Old 08-24-2019, 07:15 PM   #41
kuddel
Donator
Default

Could it be that a configuration file for the quadcopter (class) is missing?
Code:
000000.000: >>> ERROR: No vessel class configuration file found for:
000000.000: ============================ ERROR: ===========================
000000.000: Quadcopter
000000.000: [Vessel::OpenConfigFile | ..\Vessel.cpp | 243]
000000.000: ===============================================================
000000.000: >>> TERMINATING <<<


---------- Post added at 21:15 ---------- Previous post was at 21:05 ----------

For the provided quadcopter.dll the Mesh and Config can be copied from the sources:
Code:
xcopy .\Orbitersdk\samples\Vessel\Quadcopter\Config\Quadcopter.cfg .\Config\Vessels\Quadcopter.cfg
xcopy .\Orbitersdk\samples\Vessel\Quadcopter\Meshes\quadcopter.msh .\Meshes\Quadcopter\quadcopter.msh
...so no immediate need for an update of the repository.
kuddel is offline   Reply With Quote
Thanked by:
Old 08-30-2019, 01:05 PM   #42
martins
Orbiter Founder
Default

The missing mesh and config files should be fixed in the latest beta. It also adds a Lua interface for accessing some of the autopilot modes. No documentation yet, so you'll have to check the code to see what is available and how to call it.
martins is offline   Reply With Quote
Thanked by:
Old 08-30-2019, 01:20 PM   #43
martins
Orbiter Founder
Default

Not having access to a real-life drone myself, I have a question about how the controls generally work. Specifically, are the pitch and roll controls vessel-relative (e.g. pushing the pitch control stick pitches the the drone down with respect to its own forward direction) or operator-relative (e.g. pushing the pitch controller pitches the drone away from you, no matter its current heading).

I can see that the latter mode could be useful when the drone is too far away to see its orientation, where pulling the stick will always bring it back towards you. The first mode would obviously be reasonable if you have a live feed from the onboard camera, and you can use the controller as a virtual cockpit.
martins is offline   Reply With Quote
Old 08-30-2019, 02:13 PM   #44
Face
Beta Tester
 
Face's Avatar

Default

Quote:
Originally Posted by martins View Post
 Not having access to a real-life drone myself, I have a question about how the controls generally work. Specifically, are the pitch and roll controls vessel-relative (e.g. pushing the pitch control stick pitches the the drone down with respect to its own forward direction) or operator-relative (e.g. pushing the pitch controller pitches the drone away from you, no matter its current heading).
Most drones I know about use the vessel-relative mode, but there are many consumer-drones (low price, low weight, cam) that also implement special modes for e.g. selfies that come close to your described operator-relative mode. It's more of a PR gag, though.
Face is offline   Reply With Quote
Thanked by:
Old 08-30-2019, 09:43 PM   #45
kuddel
Donator
Default

Quote:
Originally Posted by martins View Post
 It also adds a Lua interface for accessing some of the autopilot modes. No documentation yet, so you'll have to check the code to see what is available and how to call it.
@martins:
As you mention Lua documentation:
Many stock vessel code has Lua interfaces, that need documentation.
I volunteer to add them as far as I can do it.
Do you have any preferences on how I can provide them?
- A dedicated (.lua) file containing only doc, or
- Inline documentation in code (header or source), or
- any other way?

It should mainly make your generation process as seamless as possible,
...so make a wish

Last edited by kuddel; 09-03-2019 at 01:44 PM.
kuddel is offline   Reply With Quote
Thanked by:
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:16 AM.

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.