Maneuver Node¶
Contents
A planned velocity change along an orbit. These are the nodes that you can set in the KSP user interface. Setting one through kOS will make it appear on the in-game map view, and creating one manually on the in-game map view will cause it to be visible to kOS.
Warning
Be aware that a limitation of KSP makes it so that some vessels’ maneuver node systems cannot be accessed. KSP appears to limit the maneuver node system to only functioning on the current PLAYER vessel, under the presumption that its the only vessel that needs them, as ever other vessel cannot be maneuvered. kOS can maneuver a vessel that is not the player vessel, but it cannot overcome this limitation of the base game that unloads the maneuver node system for other vessels.
Be aware that the effect this has is that when you try to use some of these commands on some vessels, they won’t work because those vessels do not have their maneuver node system in play. This is mostly only going to happen when you try to run a script on a vessel that is not the current player active vessel.
Creation¶
- NODE(time, radial, normal, prograde)¶
- Parameters
- Returns
You can make a maneuver node in a variable using the
NODEfunction. The radial, normal, and prograde parameters represent the 3 axes you can adjust on the manuever node. The time parameter represents when the node is along a vessel’s path. The time parameter has two different possible meanings depending on what kind of value you pass in for it. It’s either an absolute time since the game started, or it’s a relative time (ETA) from now, according to the following rule:Using a TimeSpan for time means it’s an ETA time offset relative to right now at the moment you called this function:
// Example: This makes a node 2 minutes and 30 seconds from now: SET myNode to NODE( TimeSpan(0, 0, 0, 2, 30), 0, 50, 10 ). // Example: This also makes a node 2 minutes and 30 seconds from now, // but does it by total seconds (2*60 + 30 = 150): SET myNode to NODE( TimeSpan(150), 0, 50, 10 ). Using a TimeStamp, or a Scalar number of seconds for time means it's a time expressed in absolute universal time since game start:: // Example: A node at: year 5, day 23, hour 1, minute 30, second zero: SET myNode to NODE( TimeStamp(5,23,1,30,0), 0, 50, 10 ). // Using a Scalar number of seconds for time also means it's // a time expressed in absolute universal time (seconds since // epoch): // Example: A node exactly one hour (3600 seconds) after the // campaign started: SET myNode to NODE( 3600, 0, 50, 10 ). Either way, once you have a maneuver node in a variable, you use the :global:`ADD` and :global:`REMOVE` commands to attach it to your vessel's flight plan. A kOS CPU can only manipulate the flight plan of its :ref:`CPU vessel <cpu vessel>`.
Once you have created a node, it’s just a hypothetical node that hasn’t been attached to anything yet. To attach a node to the flight path, you must use the command
ADDto attach it to the ship.
- ADD¶
To put a maneuver node into the flight plan of the current CPU vessel (i.e.
SHIP), justADDit like so:SET myNode to NODE( TIME:SECONDS+200, 0, 50, 10 ). ADD myNode.
You should immediately see it appear on the map view when you do this. The
ADDcommand can add nodes anywhere within the flight plan. To insert a node earlier in the flight than an existing node, simply give it a smallerETAtime and thenADDit.Warning
As per the warning above at the top of the section, ADD won’t work on vessels that are not the active vessel.
- REMOVE¶
To remove a maneuver node from the flight path of the current CPU vessel (i.e.
SHIP), justREMOVEit like so:REMOVE myNode.
Warning
As per the warning above at the top of the section, REMOVE won’t work on vessels that are not the active vessel.
- NEXTNODE¶
NEXTNODEis a built-in variable that always refers to the next upcoming node that has been added to your flight plan:SET MyNode to NEXTNODE. PRINT NEXTNODE:PROGRADE. REMOVE NEXTNODE.
Currently, if you attempt to query
NEXTNODEand there is no node on your flight plan, it produces a run-time error. (This needs to be fixed in a future release so it is possible to query whether or not you have a next node).Warning
As per the warning above at the top of the section, NEXTNODE won’t work on vessels that are not the active vessel.
The special identifier
NEXTNODEis a euphemism for “whichever node is coming up soonest on my flight path”. Therefore you can remove a node even if you no longer have the maneuver node variable around, by doing this:REMOVE NEXTNODE.
- HASNODE¶
- Type
- Access
Get only
Returns true if there is a planned maneuver
ManeuverNodein the CPU vessel’s flight plan. This will always return false for the non-active vessel, as access to maneuver nodes is limited to the active vessel.
- ALLNODES¶
- Type
ListofManeuverNodeelements- Access
Get only
Returns a list of all
ManeuverNodeobjects currently on the CPU vessel’s flight plan. This list will be empty if no nodes are planned, or if the CPU vessel is currently unable to use maneuver nodes.Note
If you store a reference to this list in a variable, the variable’s instance will not be automatically updated if you
ADDorREMOVEmaneuver nodes to the flight plan.Note
Adding a
ManeuverNodeto this list, or a reference to this list will not add it to the flight plan. Use theADDcommand instead.
Structure¶
- structure ManeuverNode¶
Here are some examples of accessing the suffixes of a
ManeuverNode:// creates a node 60 seconds from now with // prograde = 100 m/s SET X TO NODE(TIME:SECONDS+60, 0, 0, 100). ADD X. // adds maneuver to flight plan PRINT X:PROGRADE. // prints 100. PRINT X:ETA. // prints seconds till maneuver PRINT X:TIME. // prints exact UT time of manuever PRINT X:DELTAV // prints delta-v vector REMOVE X. // remove node from flight plan // Create a blank node SET X TO NODE(0, 0, 0, 0). ADD X. // add Node to flight plan SET X:PROGRADE to 500. // set prograde dV to 500 m/s SET X:ETA to 30. // Set to 30 sec from now PRINT X:ORBIT:APOAPSIS. // apoapsis after maneuver PRINT X:ORBIT:PERIAPSIS. // periapsis after maneuver
Members¶ Suffix
Type (units)
Access
Description
Vector(m/s)Get only
The burn vector with magnitude equal to delta-V
Vector(m/s)Get only
Alias for
DELTAVScalar(s)Get/Set
Time until this maneuver
Scalar(s)Get/Set
Universal Time of this maneuver
Scalar(m/s)Get/Set
Delta-V along prograde
Scalar(m/s)Get/Set
Delta-V along radial to orbited
BodyScalar(m/s)Get/Set
Get only
Expected
Orbitafter this maneuver
- ManeuverNode:DELTAV¶
- Access
Get only
- Type
The vector giving the total burn of the node. The vector can be used to steer with, and its magnitude is the delta V of the burn.
- ManeuverNode:BURNVECTOR¶
Alias for
ManeuverNode:DELTAV.
- ManeuverNode:ETA¶
- Access
Get/Set
- Type
The number of seconds until the expected burn time. If you SET this, it will actually move the maneuver node along the path in the map view, identically to grabbing the maneuver node and dragging it.
- ManeuverNode:TIME¶
- Access
Get/Set
- Type
The time of the node in universal time, rather than ETA relative to the current time. This should be the same as adding
ManeuverNode:ETAtoTIME:SECONDS.
- ManeuverNode:PROGRADE¶
- Access
Get/Set
- Type
The delta V in (meters/s) along just the prograde direction (the yellow and green ‘knobs’ of the maneuver node). A positive value is a prograde burn and a negative value is a retrograde burn.
- ManeuverNode:RADIALOUT¶
- Access
Get/Set
- Type
The delta V in (meters/s) along just the radial direction (the cyan knobs’ of the maneuver node). A positive value is a radial out burn and a negative value is a radial in burn.
- ManeuverNode:NORMAL¶
- Access
Get/Set
- Type
The delta V in (meters/s) along just the normal direction (the purple knobs’ of the maneuver node). A positive value is a normal burn and a negative value is an anti-normal burn.