# [1.7] Throttle Controlled Avionics

## Recommended Posts

Hmm, I really don't understand then.

Lets throw out 3 dimensions and just work with 2 - X and Z.

You have a plane style vtol (nose points X+) craft with one engine of equal strength pointing downwards (D), rearwards ® and forwards (F). To keep this simple, each engine has no vectoring.

The craft is at a 80deg angle (10 deg from engine R and 80deg from engine D) and is moving directly towards the ground (No horiz motion).

In the current version your code is able to work out to pitch the craft -80deg to align engine D with the momentum vector and thrust.

How come it could not work out that engine R could also be used, if instead it rotated 10deg the other direction? Seeing as 10 > 80, and both engines are identical, it should pick engine R.

Similarly, if the code is (as it seems to be) able to separate out two different sets of momentum vectors (towards the ground and horizontal motion), why can it not do the above for each element of the momentum?

ie imagine the same craft was hovering (no vertical momentum), at 0 deg (Engine D pointing towards ground and thrusting to counteract gravity), could it not work out that the horizontal movement vector is in line with engine F and it can use F to kill horiz vel, while still using engine D to kill vert vel?

##### Share on other sites
Hmm, I really don't understand then.

Lets throw out 3 dimensions and just work with 2 - X and Z.

You have a plane style vtol (nose points X+) craft with one engine of equal strength pointing downwards (D), rearwards ® and forwards (F). To keep this simple, each engine has no vectoring.

The craft is at a 80deg angle (10 deg from engine R and 80deg from engine D) and is moving directly towards the ground (No horiz motion).

In the current version your code is able to work out to pitch the craft -80deg to align engine D with the momentum vector and thrust.

How come it could not work out that engine R could also be used, if instead it rotated 10deg the other direction? Seeing as 10 > 80, and both engines are identical, it should pick engine R.

Similarly, if the code is (as it seems to be) able to separate out two different sets of momentum vectors (towards the ground and horizontal motion), why can it not do the above for each element of the momentum?

ie imagine the same craft was hovering (no vertical momentum), at 0 deg (Engine D pointing towards ground and thrusting to counteract gravity), could it not work out that the horizontal movement vector is in line with engine F and it can use F to kill horiz vel, while still using engine D to kill vert vel?

TCA is not an AI, it can't "work out" anything. I've shown you the equations in general form; complete algorithms are available at GitHub. Please, feel free to examine them if the general form is not sufficient for understanding.

You may also look at MechJeb's RCSBalancer code which does exactly what you want. And don't forget to evaluate its performance, for that matter.

I'm sorry, but I have no other means to answer the "how come" question.

##### Share on other sites

Does this mod still work in .23.5? I recently picked up where I left off on an old save. I can't upgrade because I had too many mods and parts customized and working together for that build.

##### Share on other sites

Hey Allista,

I made an attempt to do this kind of mod using an external library to do the solving. (http://lpsolve.sourceforge.net/5.5/). I found it capable of solving both rotation and translation linear problems for (small) ships with upwards of 10 or so engines.

(see

for a small example)

Have you thought about dropping to a library to try to solve this kind of problem? I can give you some help integrating the lpsolve library, given you seem to understand the maths it is a pretty easy library to use.

If you've done any LP problems by hand the solver is pretty intuitive.

##### Share on other sites
Does this mod still work in .23.5? I recently picked up where I left off on an old save. I can't upgrade because I had too many mods and parts customized and working together for that build.

I doubt it. Don't possess the .23.5 version anymore and all the development was done on .90; but considering .90 API changes in autopilot callbacks it should not be compatible. Sorry.

- - - Updated - - -

Hey Allista,

I made an attempt to do this kind of mod using an external library to do the solving. (http://lpsolve.sourceforge.net/5.5/). I found it capable of solving both rotation and translation linear problems for (small) ships with upwards of 10 or so engines.

(see

for a small example)

Have you thought about dropping to a library to try to solve this kind of problem? I can give you some help integrating the lpsolve library, given you seem to understand the maths it is a pretty easy library to use.

If you've done any LP problems by hand the solver is pretty intuitive.

Looks amazing!

Actually, after the argument here, I have been thinking of at least dropping the calculations into a separate thread for speed, and maybe trying to use some third party solver; certainly, I don't believe I can do a better job than specialized code.

But for me this mod was also an exercise; and I have started from an almost dead project with some code already written, and my time was limited.

Anyway, why don't you just finish your mod? It already has the lpsolve integration and, judging by the video, copes much, much better than TCA!

[uPD] I wonder, though, how does it manage with asymmetric designs that produce unsolvable systems for some input combinations?

Edited by allista

##### Share on other sites
And what of the in-game key binding change in the TCA window? Does it work?

Not appearing on my install....?

##### Share on other sites
Not appearing on my install....?

How on Earth?

The little button in TCA window right beside the "Enable" button. It shows currently used key and pushing it should allow to change it.

##### Share on other sites
How on Earth?

The little button in TCA window right beside the "Enable" button. It shows currently used key and pushing it should allow to change it.

Don't you mean Kerbin?

And yep, it's appearing now. My bad.

That said, having clicked on the button, it comes up 'Enter new key to toggle TCA', but when I press my desired key (the Y key), nothing happens... it doesn't actually bind it at all. In fact, all it does is un-bind the previous setting, and I have no way of getting it to bind again.

##### Share on other sites
Don't you mean Kerbin?

And yep, it's appearing now. My bad.

That said, having clicked on the button, it comes up 'Enter new key to toggle TCA', but when I press my desired key (the Y key), nothing happens... it doesn't actually bind it at all. In fact, all it does is un-bind the previous setting, and I have no way of getting it to bind again.

There's nothing suspicious in the Player.log; and that is very suspicious indeed.

Here, I've compiled a debug version that should spam the log with some messages when you're trying to bind a new key. Try it, please, and share the log.

https://www.dropbox.com/s/hdvhsgwhncv8lof/ThrottleControlledAvionics-v2.1.1.zip?dl=0

##### Share on other sites

As DavidHunter, stock TB button is not displayed for me (win7, KSP 0.90, OpenGL, TCA v2.1, ship with engines ).

Also (related ?) blizzy's TB doesn't appear as well (my own curse it seems) in flight scene.

Assembly is loaded well, no error in log... weird. Shortcut key works as expected, but no window.

Is there any things to check to help solving this ?

##### Share on other sites
As DavidHunter, stock TB button is not displayed for me (win7, KSP 0.90, OpenGL, TCA v2.1, ship with engines ).

Also (related ?) blizzy's TB doesn't appear as well (my own curse it seems) in flight scene.

Assembly is loaded well, no error in log... weird. Shortcut key works as expected, but no window.

Is there any things to check to help solving this ?

I've updated the debug version of TCA, including several log messages that should trace the process of button creation. Please, download it from the link above and test the whole thing again, then share the log.

##### Share on other sites
I've updated the debug version of TCA, including several log messages that should trace the process of button creation. Please, download it from the link above and test the whole thing again, then share the log.

Thanks for the quick answer. Tried it after deleting potentially buggy BTB settings file, BTB button is displayed now .

The window seems a bit too big (there is lot's of empty space around engines data).

A little "issue": throttle control may be adjusted in order to achieve a TWR > 1, sometimes, throttle is too low and TWR fall below 1 for enough time to make ship falling down before TWR get back to a value > 1 (I know, it would not be easy, TCA did already a good job).

Check your pm soon for the log.

##### Share on other sites
Thanks for the quick answer. Tried it after deleting potentially buggy BTB settings file, BTB button is displayed now .

The window seems a bit too big (there is lot's of empty space around engines data).

A little "issue": throttle control may be adjusted in order to achieve a TWR > 1, sometimes, throttle is too low and TWR fall below 1 for enough time to make ship falling down before TWR get back to a value > 1 (I know, it would not be easy, TCA did already a good job).

Check your pm soon for the log.

So the issue with the TB is gone? Great!

Strange though: in your log I only saw plenty of exceptions from AntennaRange. Are you sure you've used the debug version?

Mmm, I'm not quite sure I understand about the TWR. You mean "in some maneuvers TWR becomes <1"?

If so, have your craft some reserve of TWR? Because if the initial TWR is, say, around 1.5, it may not be enough for when some engines are dethrottled in the maneuver.

##### Share on other sites
So the issue with the TB is gone? Great!

Strange though: in your log I only saw plenty of exceptions from AntennaRange. Are you sure you've used the debug version?

Mmm, I'm not quite sure I understand about the TWR. You mean "in some maneuvers TWR becomes <1"?

If so, have your craft some reserve of TWR? Because if the initial TWR is, say, around 1.5, it may not be enough for when some engines are dethrottled in the maneuver.

Yes.

Even stranger, you don't talk about my very own log at all ! (I don't even have any related mod to AR installed)

Forget about it, thinking deeper just shows me it's impossible and right, I would check to have at least a TWR of 1.5 in the future.

##### Share on other sites
Yes.

Even stranger, you don't talk about my very own log at all ! (I don't even have any related mod to AR installed)

My mistake, I've confused another log with yours.

The right one shows just what is expected, no surprises.

##### Share on other sites

Any updates on the FMRS/TCA conflict in the mod? Not pressuring, just asking

##### Share on other sites
Any updates on the FMRS/TCA conflict in the mod? Not pressuring, just asking

I've fixed it, but as the primary goal of the next release is engines groups, it is still in the dev branch.

You may grab the debug version from the previous page, though. Log messages there should not affect performance, and the bug is fixed.

##### Share on other sites

TCA v2.2.0 with the new engine modes system is released.

##### Share on other sites

Hi, got following problem: no TCA Icon in Toolbar, cant do anything.

Ideas are welcome.

Thanks

##### Share on other sites
Hi, got following problem: no TCA Icon in Toolbar, cant do anything.

Ideas are welcome.

Thanks

This happens strangely often. But I still can't figure it out, as there's no errors in any logs and I couldn't reproduce it yet.

Still, things to check, including obvious:

1) vessel has engines

2) if in career mode you have purchased TCA upgrade in R&D

3) you have enabled TCA button in Toolbar for Flight scene

If all the above is true, try to delete/rename Toolbar's configuration file in GameData: the last person who encountered this problem fixed it that way.

##### Share on other sites

Just saw the update and that it has the engine mode setting I asked about! Thanks for taking that into account! Cant wait to get home and try it out!

##### Share on other sites

Sorry, but there are no TCA-Icons to choose, nowhere...

Edit:

Tryed TCA only with Squad Folder, Toolbar, Modmanager and MechJeb2: only the MJ Icons available in Toolbar.

Edited by sBronco

##### Share on other sites
Sorry, but there are no TCA-Icons to choose, nowhere...

Edit:

Tryed TCA only with Squad Folder, Toolbar, Modmanager and MechJeb2: only the MJ Icons available in Toolbar.

Sounds bad. May I see the logs?

##### Share on other sites

Thanks, that version fixed it! Keep up the good work

##### Share on other sites

allista, is there anyway you could keep crafts hovering when you switch to another craft that's within physics range?

Vertical velocity and mechjebs translatron can do this, but those require your craft to be completely balanced.

Reason i ask is because i'd love to be able to land on this thing while it's in the air

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.