![](https://forum.kerbalspaceprogram.com/uploads/set_resources_17/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
![](https://forum.kerbalspaceprogram.com/uploads/set_resources_17/84c1e40ea0e759e3f1505eb1788ddf3c_default_photo.png)
pixartist
Members-
Posts
126 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by pixartist
-
KSP Flight Computer Node docs (outdated - will be updated soon) Download Alpha 0.3.3 Changes - Added Get Yaw, Pitch, Roll nodes - Fixed Altitude over ground - Fixed dragged node connections not being deleted when their origin node is deleted Example: How to get to Orbit (Outdated, but there is a launch subroutine included which will bring you into orbit with the latest release) Album: http://imgur.com/a/n4fOT - The vehicle is a simple rocket: http://i.imgur.com/CRGVCoX.jpg - This is the main program, it uses subroutines to keep it simple and clean: http://i.imgur.com/XBnTHPg.jpg - This is the prelaunch subroutine. It initializes the vessel and launches it: http://i.imgur.com/qJ9BBdN.jpg - This is the automatic staging, self-explanatory: http://i.imgur.com/dFph6TS.jpg - This is the gravity turn, it rotates the vessel from up to east during the execution. It stopes executing when the given apoapsis is reached. TurnEnd is the altitude where it will have rotated by 90° to the side: http://i.imgur.com/5DvOwSF.jpg - This is the circulation burn, it burns until apoapsis + periapsis = 2x altitude, ensuring that the vessel is exactly between apoapsis and periapsis. The heading is locked to the east: http://i.imgur.com/jmlT21G.jpg That's it! Here is the flight: Older versions: Alpha 0.3.2 - Reorganized GUI into a better structure, using multiple standardized windows - Added Action buttons which can be used to trigger code via a button press (Node is under Events) - You can now pan within the program editor via drag and drop Alpha 0.3.1 - Changed duplicate node key from shift to ctrl - GUI overhaul - Window states are saved - Windows are draggable - Windows are resizable - Added Watch Value node (Any value type can be connected to this) - Watched values are displayed in the small default window - Added toggle RCS node - Added Body Radius node - Added Body Mass node - Added Gravitational Constant node - Added Time Node - Fixed Fuel Empty Node - Most Event nodes now can be toggled via boolean input - Included example subroutines - Got a new line drawing algorithm - Update: Hotfix for multiple Watch Value node enables in 0.3.1 Alpha 0.2.7 - Reduced Gui button size - Changed all values to double - Overhauled the location nodes. World location is a temporary world space coordinate rotated into navball space, geo locations are geographic constant coordinates. Conversion nodes added - Added Select number node - Added Sign node - This update will probably break all your programs, sorry :/ Alpha 0.2.5 - Program loading hotfix Alpha 0.2.4 - Fixed FuelEmpty and Subroutine Entry & Exit Alpha 0.2.3 - Changed ALL heading values to Vector3 and relative to the navball - You can now copy a node by dragging it while holding SHIFT!! - Subroutines can now be edited in place Alpha 0.2.2 - Added gravity vector node - Added Dot product nodes - Added Vector3 to heading node - Fixed Magnitude node - Fixed Normalize node - Added Exception handling to subroutines Alpha 0.2.1 - Changed heading nodes to use absolute direction vectors - Added transformation node from absolute to navball heading Alpha 0.2 - Added Subroutines allowing fully customizable, sharable custom nodes - Major UI Overhaul - Major code refactoring - Added log window - Small window is draggable - Subroutines are stored in GameData\FlightComputer\Subroutines Alpha 0.1.9 - Added markers indication if a node is being executed - Added ActionGroup node (aftokinito) - Added StageCount node (aftokinito) Alpha 0.1.8 - Added compression, reducing storage space 10 fold+ Alpha 0.1.7 - Fixed FuelEmpty node - Added heading towards target node Alpha 0.1.6 - Added exception handling to assembly finder - Added Delta / second node - Added DT (Delta Time) node - Added SAS Controller strength node Alpha 0.1.5 - Added gravity node - Added mass node - Added max thrust node - Changed delta to delta/s - Added vector operators Alpha 0.1.4 - Added categories for vector nodes - Fixed greater node - Added lesser node - Added Magnitude nodes (V2/V3) - Added Normalize nodes (V2/V3) - Addec Vector2 variable type Alpha 0.1.3 -Changed connection cancelling button from middle mouse to rmb -Added custom action group actions Alpha 0.1.2 -Added pitch,yaw and roll setting nodes -Removed "Set Value" node -Changed coloring of Flight Stats and Vector3 Alpha 0.1.1 - Changed paths to work on linux systems 0.1 first release - First release How to use The component is in the science section and uses the barometer (?) model currently. It's called "Flight Computer". Features: Fully programmable vessel behavior via Visual Programming Easy addition of custom nodes (Base classes are in a seperate assembly) Variables Internal abstraction of rotation values into Navball Heading vectors + roll in order to simplify rotation management Planned features: Actiongroup event binding DONE Subroutines DONE Saving of separate programs / subroutines DONE Possibly communication with mechjeb Get heading relative to other bodies DONE Multiple program tabs Make Aircraft work 100% DONE Add indicator for nodes that are being executed DONE More default nodes Demo Video: Basic workflow example: Tell me what kind of nodes you would like to see, what kind of behaviors you would like to implement Source code on GitHub, License: GNU GPL version 3 FAQ - How do I delete a node? Press the little x button - How to I remove connections? Right click on a connector - How do I cancel making a connection? Right click - How do I get a value from a node without changing the current value? You don't need to execute a node in order to get the ouput values. ONLY execute nodes when you want to execute the active part of the node. You can get all outputs from any node without executing it (Variable nodes for example, should only be executed to change the value of the variable. If you want to get the value, simple connect the output, not the execution) What happens if I make a circular connection? In most cases involved nodes will crash and be removed. Certainly connections like this are not valid code. I will update this with more examples of crashing programs. Contributors: https://github.com/aftokinito
-
Quaternions are driving me insane!
pixartist replied to pixartist's topic in KSP1 C# Plugin Development Help and Support
hehe, because I used Vector3.up - forward first and then inverted it, for testing purposes by adding *-1... -
Quaternions are driving me insane!
pixartist replied to pixartist's topic in KSP1 C# Plugin Development Help and Support
I FINALLY managed to tackle this ..... by drawing everything on paper and thinking for quite a while. It turns out there is a pretty simple solution: Quaternion relRot = Program.VesselInfo.WorldToReference(Program.VesselInfo.VesselOrientation, VesselInformation.FrameOfReference.Navball); Vector3 forward = relRot * Vector3.up; double roll = forward.SignedAngle((Vector3.up - forward)*-1, relRot * Vector3.forward); //the signed angle method: public static float SignedAngle(this Vector3 normal, Vector3 a, Vector3 { return Mathf.Atan2( Vector3.Dot(normal, Vector3.Cross(a, ), Vector3.Dot(a, ) * Mathf.Rad2Deg; } I create a vector going from UP (0,1,0) to the up vector of the vessel (which is basically the forward vector, it's the point on the navball). The I simply calculate the angle between that and the actual forward vector of the vessel along the up axis of the vessel. -
Quaternions are driving me insane!
pixartist replied to pixartist's topic in KSP1 C# Plugin Development Help and Support
No, that's not how euler angles work. The rotations are applied one after another. They are not simple rotations around world axis. -
Quaternions are driving me insane!
pixartist replied to pixartist's topic in KSP1 C# Plugin Development Help and Support
I already convert the rotation of the vessel into the navball / surface frame of reference. Have a look at the code in my post. Also I think euler angles are not suitable to remove roll from a transformation because their values are absolute and not relative to the body. (As far as I know) -
Quaternions are driving me insane!
pixartist replied to pixartist's topic in KSP1 C# Plugin Development Help and Support
Yes, I have worked with Quaternions before, but still I would not know how to counter the roll of a transformation with euler-angles. Any idea? Is my question even understandable ? -
I am trying to prevent ANY roll from happening when setting up a new SAS target: //get target vector(navball) Vector3 v = new Vector3(In("E/W").AsFloat(), In("U/D").AsFloat(), In("N/S").AsFloat()).normalized; //create rotation Quaternion rot = Quaternion.LookRotation(v, Vector3.up) * Quaternion.Euler(90, 0, 0); Quaternion roll = Quaternion.identity; //keep absolute roll ? if (In("Keep Roll").AsBool()) { //read current rotation (navball) Quaternion relRot = Program.VesselInfo.WorldToReference(Program.VesselInfo.VesselOrientation, VesselInformation.FrameOfReference.Navball); //calculate current roll Vector3 absUp = (Vector3.forward * -1f); Vector3 dir = relRot * Vector3.up; Vector3 up = relRot * absUp; float rollC = Mathf.Atan2( Vector3.Dot(dir, Vector3.Cross(absUp, up)), Vector3.Dot(absUp, up)) * Mathf.Rad2Deg; //get navball horizontal angles float angleC = Mathf.Atan2(dir.z, dir.x); float angleT = Mathf.Atan2(v.z, v.x); //delta of angles float d = Mathf.DeltaAngle(angleC, angleT); //add delta to current angle roll = Quaternion.AngleAxis(rollC + d, v); } else { roll = Quaternion.AngleAxis(In("Roll").AsFloat(), v); } rot = roll * rot; //apply sas target Program.SASController.SASTarget = Program.VesselInfo.ReferenceToWorld(rot, VesselInformation.FrameOfReference.Navball); Unfortunately this does not work, and debugging quaternions without any actual debugging is a nightmare. Could anyone provide me with a way to make a quaternion but keep the roll component of another quaternion intact? By that I don't mean that the roll value should be the same, contrary, the roll value will most likely change. I want a change of HEADING only, while preventing any roll from happening relative to the navball UP.
-
Help with quaternion multiplication
pixartist replied to pixartist's topic in KSP1 C# Plugin Development Help and Support
A direction vector, e.g. unit vector in space coords. -
I have finally managed to convert absolute quaternions to navball quaternions like this: public Quaternion ReferenceToWorld(Quaternion localRotation, FrameOfReference reference) { switch (reference) { case FrameOfReference.Navball: return (OrbitalOrientation * localRotation) * Quaternion.Euler(90, 0, 0); default: return Quaternion.identity; } } public Quaternion WorldToReference(Quaternion worldRotation, FrameOfReference reference) { switch (reference) { case FrameOfReference.Navball: return (Quaternion.Inverse(OrbitalOrientation) * worldRotation) * Quaternion.Inverse(Quaternion.Euler(90, 0, 0)); default: return Quaternion.identity; } } Now I would like to do the same conversion with vector3s. The problem I have is, I can't apply the Quaternion.Euler(90, 0, 0) last, because you can not multiplay Vector3 * Quaternion. How would I have to rearrange this in order to keep the result but have the local/world rotation last in the multiplication order ?
-
Hi, I need to draw simple colored line. Debug.DrawLine does not work, what would be the best way to do this ?