Comments (10)
I think you are mistaken, you have never been able to set THROTTLE or STEERING since I have used KOS unless it was slipped in in some update and I never saw it (but I don't think so). And the reason that you can't has to do with how Kerbal Space Program is actually coded.
To be specific, the way that the steering and throttle get hooked into requires that they be told what they should be at everytime, and if you dont tell them, they go back to what they were set at by the manual controls.
from kos.
@GraemeWilde while it's true that "SET" controlling has never worked in the past, and it's true how you describe KSP steering working, it's not necessarily true that kOS can't implement it so that it would work. I think it could. Like this:
When a LOCK THROTTLE statement is run , it does this right now:
- Make a function tied to the identifier "THROTTLE". (throwing away the old one if any exists.)
- Fill the contents of that function with the opcode instructions generated from the expression.
When a SET THROTTLE statement is run , it could be implemented to do this:
- Make a function tied to the identifier "THROTTLE". (throwing away the old one if any exists.)
- Right NOW, run the opcode instructions generated from the expression, leaving the current result on top of the stack.
- Fill the contents of that function with the opcode for 'return foo' where foo is a hardcoded constant equal to the current value seen on top of the stack.
Thus it's still a function call like the rest of the fly by wire code is expecting, but the value it returns is an unchanging constant until the next time someone runs a SET THROTTLE command, so it would behave just like SET would be expected to behave.
And obviously I used THROTTLE as the example but the same would need to be done for the other fly by wire special identifiers.
I've looked at the code a bit and I think this could work, but I'm not confident enough yet to give implementing it a try myself. I leave it for other two who are more experienced with kOS to look at the idea and decide whether or not they think it's reasonable.
(Actually now that I think of it, technically the above change could be done universally for all SET's regardless of whether they're being used for fly by wire or not. I'm not saying that's a good idea but it would create logically identical results to how SET works now (although take slightly more time to execute so I'm not saying it's necessarily a good idea). )
from kos.
@Dunbaratu I'm not sure exactly what you mean, I'm reading this as
SET THROTTLE TO 0.5. and it would stay there until you change it? But LOCK THROTTLE can already do that?
What I would expect SET THROTTLE/STEERING to do would by to set the throttle at a certain place but then allow it to be changed manually by the user with ctrl/shift. However when I played around with FlyByWire it wouldn't allow this.
from kos.
I was suggesting a design change that might allow SET it to work for fly by wire. I wasn't claiming that it currently works.
What I was suggesting, to put it in terms like kosscript would be written, was something like this:
When kOS sees code like this:
SET THROTTLE TO some_math_expression.
That behind the scenes it could do something akin to this:
SET temp_internal_value TO some_math_expression.
LOCK THROTTLE TO temp_internal_value.
Where temp_internal_value is not even named in the identifier dictionary - it's just kept on top of the stack long enough to look at it and build a function that returns it as a constant value.
That way when the value of some_expression_here changes later, throttle doesn't change, as one would expect from a SET.
from kos.
Ah ok, I see what your saying. When I think SET THROTTLE I think set it as in you could then manually change it with ctrl/shift, like as in it wouldn't be stuck at what KOS sets it at, and could be changed by the user.
What your proposing is quite possible, and from the FlyByWire side (I don't know about the KOS side) wouldn't be that difficult. I don't really see that it would be that useful though as its not that big a deal having a kos variable floating around just to hold the throttle value.
from kos.
I didn't realize that's what you meant. Yes that would be a lot harder to implement - to set the controls once and then relinquish control back to the user. The reason that would be hard to implement is that the vessel doesn't instantaneously jump to the requested orientation and throttle. If you SET STEERING to a direction, many calls to Update and FlyByWire will have occurred in the time it took to get the vessel to rotate to the requested setting. So its a bit fuzzy about "how long" to take control before giving it back.
Perhaps instead of a "SET" the logic could be to notice the moment the player presses a ship control key and give control to the player as soon as they try (sort of how a lot of real world airplane autopilots work - they release control when the pilot movies the yoke.)
Well, I don't think this is that easy to deal with given that I now know what was intended.
from kos.
It sounds like we are talking about new features rather than a bug. Is this correct? if so ill move it out of the v0.12 milestone
from kos.
The thing @GraemeWilde mentioned in a comment would be a new feature. But I'm not sure about the original post of the thread, which was by @xyztdev and may have been talking about something different to what @GraemeWilde was talking about.
I don't know.
from kos.
Concerning the original post, as far as I know you were never able to SET the THROTTLE or STEERING, although I could be wrong. If so this wouldn't be a bug.
Concerning what I mentioned, I think it might be a decent feature to add for the THROTTLE, and actually I now realize its really simple to do with C# in ksp using FlightInputHandler.state.mainThrottle.
from kos.
I am going to close this because i dont see the need, please correct me if im wrong
from kos.
Related Issues (20)
- Stack misalignment bug HOT 3
- Scope seems to be considered differently 'on board' and 'in Archive' HOT 4
- Resizing terminal repeatedly causes a memory leak [BUG]
- Feature Request: "On Script Error" setting on controller part
- Setting part module field value has no effect for some mods
- docs:"make latexpdf" generates only 19 pages (and they are almost empty) HOT 1
- Some system monospace fonts are not recognized by kOS terminal HOT 2
- Redundancy in compiled form of UNTIL
- Changing the active vessel using `kuniverse` from IVA mode will break the internal camera until the next scene change HOT 4
- KOSVesselModule can populate allInstances dictionary with an ID of 0
- KOSVesselModules has a memory leak problem
- Terminal breaks when something is typed that extends beyond the terminal window
- ship:control:mainthrottle doesn't work unless some other raw control is set [BUG]
- Global vars 'undefined' in local scope after running any program. HOT 6
- Undefined var when checking if the same var is defined HOT 2
- make sure kosnametag doesn't spend time updating
- Get create-release up and running
- Get docs building on github actions
- CI: changelog updating
- Function gets called when checking if a var with same name is defined HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kos.