GithubHelp home page GithubHelp logo

boris-barboris / atmosphereautopilot Goto Github PK

View Code? Open in Web Editor NEW
47.0 12.0 16.0 15.79 MB

Plugin for Kerbal Space Program

License: GNU General Public License v3.0

C# 66.20% MATLAB 24.30% C++ 2.61% Cuda 6.79% C 0.02% Shell 0.08%

atmosphereautopilot's Introduction

AtmosphereAutopilot

Plugin for Kerbal Space Program.

Original author: Boris-Barboris.

Contributors:

  • radistmorse (aka Morse on KSP forum) - Neo-GUI design and implementation.
  • CraigCottingham - Cruise flight and speed control GUI refactoring, coordinate input to waypoint mode.
  • Hotel26 - usability fixes for old-GUI Cruise flight waypoint control.
  • Boop from KSP forum - vessel.LandedOrSplashed bug squasher.

License: GNU GPL version 3

Dependencies

ModuleManager.

For developers

How to build:

You need to build two dlls: AtmosphereAutopilot.UI.dll and AtmosphereAutopilot.dll. Both can be built from MS Visual studio on Windows using AtmosphereAutopilot.sln.
On Linux you need to run build.sh from root directory, wich requires the following packages:

  • monodevelop (look for msbuild binary availability)
  • zip Results will be in AtmosphereAutopilot/bin/Release folder.

General description

Atmosphere autopilot is a modular atmospheric flight control system library. It's meant to be a foundation for multiple high-level programs - "Autopilots", wich will aid KSP player in one way or another, implying atmospheric flight. Autopilots are mutually exclusive - only one or none at all may be active at the active vessel at one given moment. They are provided by the library with means of automatic reflection-based serialization\deserialization and ugly, but lazy and customizable GUI interaction.

Autopilots are modular entities. They can use basic, provided by main library components (like controllers and models), or they can define their own components and share them with other Autopilots. Those components will be called "Autopilot modules", or simply - "Modules". Every sealed child of AutopilotModule wich is not a StateController is treated by the library like a Module. Sealed StateController children are treated as Autopilots.

Stock and FAR aerodynamics are supported.

GUI concept

AA icon is placed in Application Launcher toolbar during flight. It's contents will visualize a list of all Autopilots and Modules, created for active vessel. For every vessel "Autopilot Module Manager" will be created regardless. Turning on a "MASTER SWITCH" on it's window will create required context of Autopilots and Modules for this vessel. Under the master switch all Autopilots will be listed, for the user to choose one of them as an active one. Hotkey for Master switch is letter P, autoPilot. Can be changed in Global_settings.cfg file, Autopilot_module_manager section.

Craft settings window contains shotrcuts to most used moderation and tuning parameters of the craft, as well as provides basic preset functionality. Presets are saved in "Global_settings.cfg"/settings_wnd/profiles section.

Each Autopilot and Module has it's own GUI window. All of them (even inactive ones) are accessible from AA button in Application Launcher, some of them are accessible from Autopilot window hierarchy (that's up to Autopilot developer to decide, what particular Modules should be accessible from it's GUI). Window positions are serialized (preserved between flights and game sessions) in "Global_settings.cfg" file.

Neo-GUI

Alternative, more condensed but less powerfull way of representing AppLauncher window can be turned on by setting AtmosphereAutopilot/use_neo_gui to true in Global_settings.txt config file. It is read every scene change, so the shift can be made without shutting KSP down. While it's active, "Autopilot Module Manager" is still accessible using hotkeys. Standard GUI has logical priority over Neo-GUI.

Hotkeys

"Hotkey manager" window is placed into Application Launcher window list. It's contents are registered hotkeys, wich can be changed during runtime. There are two main hotkeys:

  • "Master switch" - toggles Master Switch.
  • Shift + "Master switch" - toggles GUI of "Autopilot Module Manager".

Others are very module-specific and will not be described here.

Craft implications and limitations

"Control from here" part is facing prograde, with close-to-zero angle of attack bias. Planar symmetry is implied (left and right side of the plane are mirrored), as well as good degree of pitch-yaw and pitch-roll control isolation. Axial engine symmetry is strongly recommended. No wind mods are supported, as well as any mods, wich are changing control surface, rcs and engine gimbaling behaviour.

WARNING: DO NOT USE AEROBRAKES AS CONTROL SURFACES, USE THEM ONLY AS BRAKES!

Default Autopilots descriptions

Standard Fly-By-Wire

In general, FBW (Fly-By-Wire) is an abstraction Autopilot. It is designed to aid in player-controlled flight on generic (space)plane, providing a soft layer between user joystick\keyboard input and control surface outputs. Main goals:

  • Auto-trimming.
  • AoA and G-force moderation.
  • Sideslip handling.
  • Fighting oscillations.

FBW uses three controllers - pitch, roll and yaw. Pitch is handled by "Pitch ang vel controller", roll by "Roll ang vel controller" and yaw is handled by "Sideslip controller" in plane mode, or directly by "Yaw ang vel controller" in "Rocket mode". In Rocket mode pitch and yaw axes are treated the same - it's usefull in case player wants to use FBW for rocket launches. FBW is effective only on small (<25 degrees) AoA values, though control is possible on all regimes. It's just that it's quality will degrade from inadequacy of linearization assumptions. "Moderation" button is toggling all pitch and yaw moderations - usefull for low speed VTOL action or for fighting overmoderation bugs. Pitch moderation is turned off for 2 seconds after taking-off to prevent overmoderation-related crashes.

"Coordinated turn" - pseudo-pitch hold to assist in performing coordinated turns.

Hotkeys:

  • "FBW moderation" - default hotkey for Moderation is letter O, mOderation.
  • "FBW rocket mode" - default hotkey unassigned.
  • "FBW coord turn" - default hotkey unassigned.

Speed control - throttle automation to maintain speed setpoint. Handeled by "Prograde thrust controller".

Mouse Director

Mouse Director (MD) is declarative autopilot, crafted with idea to let the user to define desired airspeed direction with camera position. Autopilot then tries to comply with this surface-relative velocity setpoint. MD is inherently-linear, so only relatively small angles of attack are allowed. All AoA moderations are forcefully turned on during it's operation.

MD uses "Director controller", wich uses two AoA controllers: pitch "AoA controller" and yaw "Sideslip controller", and "Roll ang vel controller" for roll. Currently, planar asymmetry of a plane is not taken into account (sideslip noise is still too noticeable in zero-lift convergence problem), sideslip is always at zero setpoint. If your craft requires nonzero sideslip to fly straight, MD is not a very good solution right now, use FbW in the rocket mode.

Short GUI description:

Speed control - throttle automation to maintain speed setpoint. Handeled by "Prograde thrust controller".

Cruise Flight controller

Cruise Flight (CF) is high-level autopilot, designet for travel automation. Just like MD, CF is inherently-linear, so only relatively small angles of attack are allowed. All AoA moderations are forcefully turned on during it's operation.

CF uses "Director controller" for controlling velocity vector and "Prograde thrust controller" for throttle automation. Functions:

  • Simple leveling.
  • Baromethric height and airspeed control.
  • Primitive waypoint functionality, picking point on planet surface (mouse click) on the map and flying to it.

Short GUI description:

  • Level - simple leveling regime. Upon activation, CF will save surface-relative inclination of velocity and will follow it. If altitude is not set, will keep vertical speed at zero.
  • Course - follows azimuth setpoint, set in field desired course. If altitude is not set, will keep vertical speed at zero. On high latitudes (>80 degrees) will switch to Level mode.
  • Waypoint - primitive waypoint following. Designed for pick-and-fly functionality. When activated, pick waypoint button appears under mode tabs, as well as waypoint latitude-longtitude representation and distance to it in straight line (through planet core). Waypoint control is turned off when destination is closer than 200 meters to be followed by Level mode activation.
  • desired course - azimuth in degrees to follow in Course mode.
  • Speed control - throttle automation to maintain speed setpoint. Handeled by "Prograde thrust controller
  • Vertical motion control - activate altitude or vertical speed or ascent angle (FPA) control. Otherwise vertical speed is kept at zero.
  • Altitude - hold altitude, meters above sea level.
  • Vertical speed - hold vertical speed, meters per second.
  • FPA - flight-path angle, hold ascent/descent angle, degrees.

"Advanced options" description:

  • pseudo-FLC - toggle for pseudo-FLC (Flight Level Change) control law for ascend. Will force CF to respect speed setpoint and craft thrust parameters when choosing ascent angle.
  • flc margin - default value 15 m/s. Span of pseudo-FLC algorithm relaxation region. Decrease if don't want to tolerate errors in speed. Algorithm will not converge below some minimal value, so be careful.
  • strength mult - default value 0.75. Will be multiplied in the runtime on Director controller's strength to restrain maneuvers. Tune to achieve slover or faster behaviour.
  • height relax time - default value 6.0 seconds. Time frame of proportional control law jurisdiction, related to relaxation behaviour. Tune to prevent overshooting, if really needed.
  • height relax Kp - gain for proportional law, decrease to slow down relaxation.
  • max climb angle - default value 30 degrees. Global limit on climb and drop maneuver velocity pitch. Will sometimes be exceeded, it's okay.
  • use keys - use pitch and yaw keys to control course and altitude\vertical speed setpoints. This flag is toggled by "CF keys input mode" hotkey.
  • hotkey course sens - tweak to manage course setpoint change speed.
  • hotkey altitude sens - tweak to manage altitude setpoint change speed.
  • hotkey vertspeed sens - tweak to manage vertical speed setpoint change speed.
  • hotkey vertspeed snap - tweak to manage vertical speed snap to zero margin.

Hotkeys:

  • "Pitch keys" - alter vertical motion setpoint, altitude or vertical speed (whatever is active at the moment).
  • "Yaw keys" - alter course setpoint.
  • "CF keys input mode" - default hotkey is Right Alt, toggles whether Pitch and yaw is used to control setpoints.
  • "CF vertical control" - toggles Vertical motion control.
  • "CF altitude\vertical speed" - toggles between Altitude and Vertical speed modes.

AoA-hold

AoA-hold (AoAH) maintains pitch Angle-of-Attack setpoint. Pitch AoA moderation is forcefully turned on during it's operation.

AoAH is very similar to Standard Fly-By-Wire. It uses "AoA controller" for pitch, roll is handled by "Roll ang vel controller" and yaw is handled by "Sideslip controller".

Short GUI description:

  • use keys - use pitch keys to control AoA setpoint.
  • hotkey sensitivity - tweak to manage AoA setpoint change speed.
  • Pitch moderation - if enabled, AoA will be limited by craft settings.
  • Speed control - throttle automation to maintain speed setpoint. Handeled by "Prograde thrust controller".

Hotkeys:

  • "Pitch keys" - alter pitch AoA setpoint.
  • "FBW moderation" - default hotkey for Moderation is letter O, mOderation.

Default Modules descriptions

Flight Model

It is a fundamental craft analysis module. It performs motion and dynamics evaluation, as well as analysis of craft aerodynamics. VTOL engine balancing is also handled by Flight Model (though it will probably change in the future). This Module will probably be used by every single other Autopilot and module.

Short GUI description (consult source code for more deatils and insight):

  • Three sections for three craft principal axes, each contains:
    • ang vel - angular velocity of a craft as a mechanical system of rigid bodies, radians / second. Positive for pitch up, yaw right, roll right.
    • ang acc - angular acceleration, produced by numerical diffirentiation.
    • AoA - angle of attack, degrees. Positive for pitch up, yaw right. For roll it's the angle between wing chord and airspeed vector, projected on frontal plane.
  • has csurf - is true if Flight Model has found control surfaces on the craft. It is important for aerodynamics regressor to know it.
  • Five "trainers", linear regressors. They are analyzing craft performance history and try (and fail horribly) to produce linear models of aerodynamic torques and forces. Their GUIs are filled with magic numbers you should never need to change.
  • balance engines - toggles engine-balancing algorithm for VTOLs. Has a hotkey.
  • balancer steering k - gain for attitude control using engines. Use zero to keep them static. Default value 1.
  • Lift acc - acceleration, provided by aerodynamic lift in the direction of plane spine.
  • Slide acc - acceleration, provided by aerodynamic lift in the direction of plane right wing.
  • sum acc - vector of total craft acceleration in PhysX reference frame.
  • pitch gravity acc - gravitational acceleration, projected on craft spine vector.
  • pitch engine acc - engines-induced acceleration, projected on craft spine vector.
  • pitch noninert acc - coriolis + centrifugal acceleration, projected on craft spine vector.
  • yaw gravity acc - gravitational acceleration, projected on craft right wing vector.
  • yaw engine acc - engines-induced acceleration, projected on craft right wing vector.
  • yaw noninert acc - coriolis + centrifugal acceleration, projected on craft right wing vector.
  • aoa virtual gain - default value 0.95. Gain of virtual rotation filter. Used to provide virtual craft rotation in case of interpart oscillations. 0.0 - pure control from part rotation. 1.0 - pure virtual.
  • MOI - moment of inertia of the craft.
  • CoM - center of mass of the craft in PhysX reference frame.
  • Vessel mass - self explanatory.
  • Reaction wheels - overall torque capability of reaction wheel systems.
  • RCS pos - estimated torque capability of RCS system when user input is positive.
  • RCS neg - estimated torque capability of RCS system when user input is negative.
  • e torque - engines-induced torque in craft principal reference frame.
  • e thrust - engines thrust in craft principal reference frame.
  • two vectors on engine torque linear estimations. They are used to adress gimbaling capabilities of a craft.

Hotkeys:

  • "Thrust balancing" - toggles balance engines button.

Director controller

Middle-level model-reference controller, follows a setpoint of surface velocity and acceleration vectors. Input: velocity vector and acceleration vector. Output: AoA, sideslip and roll angular velocity.

Short GUI description:

  • strength - default value 0.95. Measure of agressiveness of acceleration output of MD. Precise control multiplies output acceleration by the factor of 0.4. Serialized per vessel design.
  • roll stop k - default value 1.0, used to prevent overshooting, magic number.
  • angular error - error in radians between desired velocity vector and current one.
  • max angular v - estimate on current maneuver maximum angular velocity.
  • stop time roll - estimate on 90-degrees bank maneuver stop time.
  • relaxation margin - default value 0.01 radians. Margin of relaxed acceleration output. Magic number. Increase to fight overshooting (rarely needed).
  • angle relaxation k - default value 0.1. Relaxation gain, magic number. Decrease to fight oscillations.
  • max neg g - default value 8.0. Maximum negative g-force tolerate. May be useful for players, who are using G-force effects mods. Serialized per vessel design.
  • min rollover alt - default value 150.0 meters. Under this terrain altitude setpoint rolling over to prevent large negative g-force will be forbiden to decrease probability of deadly maneovers.
  • desired pitch lift - desired lift-induced acceleration, projected on spinal vector.
  • desired pitch acc - desired total acceleration, projected on spinal vector.
  • desired pitch v - desired angular velocity for pitch, calculated from previous value.
  • allow spine down - global flag to allow turning spine down to prevent negative G-force.
  • roll acc factor - angular acceleration factor estimate of roll rotation model.
  • roll acc filter - default value 4.0. filter gain for smoothing roll acc factor evolution noise.
  • roll cubic K - default value 0.3. Cubic descent gain for roll. Increase for faster roll control, decrease for lower overshooting and oscillations.
  • roll cubic relax frame - default value 10.0. Relaxation frame for cubic descent phase. Magic nubmer.
  • roll relax Kp - default value 0.1. Relaxation gain for roll.
  • roll error filter margin - default value 3.0. Margin for smoothing roll angle oscillations. Magic number.
  • roll error filter k - default value 0.5. Filter gain for roll angle smoothing on relaxation regime.
  • max roll v - estimate of constrained maximum roll angular velocity.
  • roll error - current bank error in radians.
  • roll_cubic - true when in cubic descent regime for roll.
  • snapping boundary - default vaulue 3 degrees. On low bank error modes we will transition from cubic relaxation to proportional relaxation (like in roll controller wing leveler code).
  • desired aoa - output to "AoA controller".
  • desired sideslip - output to "Sideslip controller".

Pitch, roll and yaw angular acceleration controllers

Low level dynamics inversion angular acceleration controllers. Input: desired angular acceleration (and yaw output for roll controller). Output: pitch\roll\yaw control state.

Short GUI description:

  • Csurf output - current expected virtual control surface position, wich is usually lagged from control signal.
  • write telemetry button - primitive logging capability for further matlab analysis. .csv logs are saved in KSP\Resources directory to be read by plotter.m viewer. It is a debug utility.
  • desired acc - desired acceleration, passed to this controller from above.
  • model predicted acc - predicted by model acceleration for the next frame.
  • authority - linear axial authority, complicated thing, do not bother. Should always be positive though.
  • angular acc - angular acceleration, duplicate of Flight Model ang acc field.
  • output - control state output, is passed to vessel in FlightCtrlState object.

Pitch and yaw angular velocity controllers

Model-reference controllers, that perform pitch and yaw angular velocity control with respect to moderation and controllability restrictions. Input: [-1, 1] user input or desired angular velocity. Output: desired angular acceleration, passed to angular acceleration controller.

When navball is in surface mode, controller is dealing with surface-oriented reference frame. Zero input will keep zero angular velocity relative to the ground - useful on planes. In orbit navball mode inertial reference frame will be used - usefull for spacecrafts. Precision mode (CAPS LOCK) multiplies input by the factor of 0.33 (precision mode factor option in global_settings.txt) to provide more precise control, or to aid with control on high physical warp regimes. To ignore precision mode, unser watch precision mode toggle in respected ang vel controllers.

Short GUI description:

  • Auto trim button - turn on of you want control trim to preserve after controller shutdown. Off by default.
  • max\min input aoa - estimated maximum angle of attack (radians), achievable by locking control to 1.0 or -1.0. When craft is statically unstable, this value is 0.6 of the controllability region boundary - it helps to stay reliable on unstable planes.
  • max\min input v - equilibrium angular velocities on max\min input aoa flight regimes.
  • max\min g aoa - estimated maximum angle of attack considering g-force moderation.
  • max\min g v - respective equilibrium angular velocities.
  • max\min aoa v - equlibrium angular velocities for set by user AoA limit.
  • moder filter - default value - 3.0. Used to filter out rapid changes or oscillations in flight model to provide more smooth boundary condition evolution. Magic number.
  • quadr Kp - default value - 0.3. Contoller uses parabolic descent model of angular velocity to it's desired value. Those descent parameters are governed by this koefficient. Larger values may cause overshoot from wrong control surface lag handling. Lower values will slow down control. Magic number.
  • kacc quadr - parabollic steepness of control, governed by control utilities authority and craft characteristics. Should be positive.
  • kacc smoothing - default value - 10.0. Filter gain for slow and smooth "kacc quadr" evolution. Magic number.
  • relaxation k - default value - 1.0. Controller uses relaxed linear descent on very small velocity error regimes. This koefficient governs relaxation frame size.
  • relaxation Kp - default value - 0.5. Relaxation gain itself.
  • relaxation frame - default value - 1. How many velocity frames will be averaged as current angular velocity. This is an old deprecated way of fighting oscillations, keep it 1.
  • relax count - for how many frames velocity is in relaxation state.
  • transit max v - very rough, but safe estimation of maximum non-overshooting velocity in transit maneuver (from 0.0 AoA to maximum AoA).
  • res max\min aoa - AoA limits, that will actually govern controller in the current frame. Are chosed as the most strict ones from previously listed.
  • res max\min v - respective equilibrium angular velocities.
  • scaled aoa - how far away current AoA is from it's limit.
  • scaled restr v - result of moderation algorithm.
  • Moderate AoA button - toggle angle of attack moderation. Is necessary for safe flight, but can be turned off, for example, during re-entry to provide maximum-drag profile. Required to be ON, if this controller is governed by upper-level AoA controller.
  • Moderate G-force button - toggle G-force moderation. Moderates centifugal acceleration of trajectory, not the full one, so G-meeter on navball will sometimes exceed maximum value (it is a correct behaviour).
  • max AoA - default value - 15.0 degrees. User-entered AoA limit. Recommended values [5.0, 25.0]. Serialized on per-design basis.
  • max G-force - default value - 10.0 g's. Self-explanatory. Serialized on per-design basis.
  • angular vel - current angular velocity of a craft in corresponding axis.
  • output acceleration - output, produced by controller.
  • input deriv limit - default value - 5.0. Artificial inertia gain. User input derivative is clamped by this value. Decrease for more inertia, increase for sharpness. Serialized globally.
  • prev input - previous controller input.
  • Max v construction - default value - 0.5 (rad/sec). Global angular velocity restriction. Is introduced to provide comfortable control by limiting vessel rotation capabilities. 0.5 is good for most crafts. Serialized on per-design basis.
  • desired v - desired angular velocity, not yet processed by moderation.

Roll angular velocity controllers

Model-reference controller, that perform roll angular velocity control and wing leveling. Input: [-1, 1] user input or desired angular velocity. Output: desired angular acceleration, passed to angular acceleration controller.

Precision mode (CAPS LOCK) divides input by the factor of 3 to provide more precise control, or to aid with control on high physical warp regimes.

Short GUI description (except identical from previous module):

  • Wing leveler - toggle to level wings automaticly, if craft is close to zero bank angle. Zero angle is not horizontal one, but the normal one to the trajectory plane - good for leveling on non-zero pitch while yawing.
  • Snap angle - default value - 3.0 degrees. Decides, when to activate wing leveler.
  • angle btw hor - when wings are close to snapped state, this is the angle in radians. Is needed if snap angle is large and sin(x)<>x.
  • angle btw hor sin - sinus of the horizont angle.
  • snapping Kp - snapping speed gain. Default avlue - 0.25. Larger values seem to be too agressive, too large oscillate.

AoA and Sideslip controllers

Model-reference controllers with self-explanatory names. Input: [-1, 1] user input or desired AoA. Output: desired angular velocity. Both require respective angular velocity controllers to have AoA moderation on, because it uses respective angular velocity controller limitation values as governers.

Short GUI description:

  • AoA - respective angle of attack in radians.
  • desired aoa - processed by controller input in radians.
  • output v - controller output.
  • desired aoa equilibr v - equilibrium angular velocity on desired angle of attack. For example, nosedive angular velocity on nose-heavy plane, wich will keep AoA at zero.
  • filter k - filter gain to smooth changes in equilibrium v estimation. Default value - 4.0.
  • relaxation frame - relaxation frame count, used for close-to desired behaviour. Default value - 2.
  • relaxation factor - default value 0.1. Proportional gain of relaxation smoothing.
  • cubic barrier - default value 1.0 seconds. AoA controller uses quadratic descent profile for long evolutions and cubic for short (less than "cubic barrier" seconds). Used to prevent overshooting.
  • cubic KP - default value 0.3. Gain for cubic profile steepness evaluation.
  • cubic mode - true if controller is now in cubic mode.

Prograde thrust controller

Hybrid model-reference or PID controller. Input: desired surface velocity. Output: throttle. Can be switched to PID control and manually tuned, if user is not satisfied with it's performance.

Short GUI description:

  • pid Kp - if used in PID mode, it's the proportional PID gain.
  • pid Ki - integrad PID gain.
  • pid Kd - derivative PID gain.
  • desired v - self explanatory.
  • current v - self explanatory.
  • break spd margin - when surface speed is exceeding desired by this margin, brakes will be used. On groud breaks are used without margin.
  • Use breaks - controller is using "Breaks" action group.
  • prograde thrust - thrust vector projection on prograde direction.
  • Kp v - proportional gain on velocity error. Default value - 0.5, e.g. on 1 m/s error it will be 0.5 m/s^2 desired acceleration. Decrease if don't like overshooting on very slow jets.
  • acc filter k - default value 1. Filter gain for acceleration moving average. Magic number.
  • relaxation acc error - default value 0.1 m/s^2. Error margin for filter activation. Magic number.
  • use PID - toggle if you want to manually tune controller, or using strange engines.
  • hotkey_speed_factor - tweak to change throttle hotkey sensitivity.
  • use_throttle_hotkeys - toggle speed setpoint handling by hotkeys.

Hotkeys:

  • "Throttle keys" - alter velocity setpoint by using stock throttle hotkeys (Shift and LCntrl by default).
  • "Speed control toggle" - toggles speed control ON and OFF.

atmosphereautopilot's People

Contributors

boris-barboris avatar hebarusan avatar hotel26 avatar hsjasperism avatar krisalyssa avatar lisias avatar radistmorse avatar t2fat2fly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atmosphereautopilot's Issues

Serialize Use_breaks

Hello, could we make the Use_breaks field in the thrust controller serializable? I can't save the settings, and every load of the game, I have to manually unset it. Tried adding use_breaks=False to global settings and vessel design, no dice.

I'm not a C# dev, but I think the culprit is that it isn't serializable:

On a related note, could we also fix 2 minor issues: When use_breaks is on (default), I can't manually use the breaks, and when the module is actively breaking, and I press the "master switch" [P], the breaks keep on.

Cheers.

Question: Bank Angle

I've been trying to find a way to set a max bank angle but can't seem to find anything in the documentation. Is this something that is possible with Atmosphere Autopilot?

Different PID value for different side

When flying at extreme conditions, the control authority for pitching up and pitching down is becoming very different.
When I fly my stock-aero Eve SSTO with stock propeller engines at 10km+ at eve, since pitch-stability tend to roll your craft to AoA=0 but at 16km you need very high AoA - and you need pitch-stability or fuel tank's angular lift will ruin everything, AA will pitch down a lot (10m/s delta-vertical-vel) when you input a down control , but pitch up a little (1m/s delta-vertical-vel) when you input a up control (standard FBW). This is the most severe when you are climbing with barely acceleratable power (counting the thrust of props, only -200L/D, plus L=G means that Acc=G/200, and prop already set to max since I bind prop torque with main throttle) and near-stalling (10deg AoA) at 16.9km of Eve. Increasing the final altitude and velocity is very important for making Eve SSTO to orbit.
screenshot264
Btw, I still want to thank you for making this amazing mod, with the help of AA I can easily climb to 16km without consuming EC (solar bay, with SAS I can only climb to 14.5km before consuming EC), and climb to 140m/s@16900m, with SAS I got best 138m/s@16250m, same craft. (This craft is capable for Eve Orbit@90km with 1 Kerbal+Seat, 20 airlocks, and 150m/s nuclear dv, 1500m/s ion dv that is already enough for making it home.

Neo-GUI not working in 1.8

The way assetBundles are working changed somewhere around unity 2017, and now the "old way" became deprecated. This patch changes things on the loading front.

Also, building the assetBundle is now a real pain, since importing something dependent on UnityEngine.UI in the unity editor is broken in 2019.2.2 which KSP uses. You need to manually put the UnityEngine.UI.dll into the "plugins" folder, open the project, then import the AA.UI.dll, then import the prefab, then remove the UnityEngine.UI.dll, because importing it breaks other stuff, then pray to some unity gods or something... So I decided to just add the already exported bundle as a binary. Hopefully it will last another several years.
diff.txt
I didn't do it as a pull request because I'm lazy :)

NullReferenceExceptions

[EXC 11:53:01.074] NullReferenceException: Object reference not set to an instance of an object
	VesselAutopilot.SetAutopilotTarget (System.Boolean initialize) (at <9d71e4043e394d78a6cf9193ad011698>:0)
	VesselAutopilot.SetAutopilot (System.Boolean initialize) (at <9d71e4043e394d78a6cf9193ad011698>:0)
	VesselAutopilot.Update () (at <9d71e4043e394d78a6cf9193ad011698>:0)
	Vessel.Update () (at <9d71e4043e394d78a6cf9193ad011698>:0)

Here's the entire log.

KSP.log

AA-Button disappears when RCSBuildAid is installed

Hi!
For some strange reason, the AA-Button is not present, if the RCSBuildAid plugin is installed

http://forum.kerbalspaceprogram.com/threads/35996-1-0-2-RCS-Build-Aid-v0-7-2
https://github.com/m4v/RCSBuildAid

Removing RCSBuildAid makes the AA-Button appear again.
I could produce this in a clean install, so interaction with a 3rd mod can be excluded.

Update: The offending file is apparently RCSBuildAid/Plugins/RCSBuildAidToolbar.dll
This is the source coude of the file: https://github.com/m4v/RCSBuildAid/blob/master/RCSBuildAidToolbar/Toolbar.cs

Probably-unimportant stuff

AoA is limited to less than the set value when in precision mode with the pitch rate limit enabled.

user_controlled seems to never get reset to false when user input returns to 0. Might be intentional and only used for the sideslip moderation, but it should be renamed if so.

AoA cruise mode

Description:
Create an AoA cruise mode, when you input a W/S control, it just changes desired AoA.
(Still take my Eve SSTO as an example: it is tuned between -0.7deg and 0.2deg at 300-1700m/s.)

Improve visibility of mouse director indicator

Default indicator is colored red, but in actual play the indicator's visibility is not so good. Some improvements are requested. Potential improvements may be:

  1. add a white outline to the indicator
  2. use a black bar with white outline or white bar with black outline as the indicator
  3. make it configurable, can be set through dragging images into mod folder and editing the .cfg files

Locally built code doesn't run

First, an introduction: I have more than 25 years experience in software development, but it's been about 18 years since I've done anything remotely related to Windows development (including C# and Mono). It's entirely possible that there's something I'm not doing that's immediately obvious to someone else.

Since I'm running on Mac OS X, I have installed Xamarin Studio 6.1.1 build 15, Mono 4.6.1, and GTK+ 2.24.23.

I forked the source code repository and cloned it locally. I opened the solution file, set the active configuration to Debug, cleaned, and built the solution (the level above the AtmosphereAutopilot, AtmosphereAutopilot.GUI, and TestingConsole projects). Four errors in TestingConsole, but the other two projects appear to have built okay [1]. I copied the files in bin/Debug to GameData/AtmosphereAutopilot, overwriting what was already there.

When I launch KSP with the code built locally, I get this in KSP.log:

[ERR 19:46:11.924] AssemblyLoader: Exception loading 'AtmosphereAutopilot': System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
  at AssemblyLoader.LoadAssemblies () [0x00000] in <filename unknown>:0

Additional information about this exception:

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.FlightModel' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.DirectorController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.AngularAccAdaptiveController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.AngularVelAdaptiveController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.PitchYawAngularVelocityController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.PitchAngularVelocityController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.RollAngularVelocityController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.YawAngularVelocityController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.MouseDirector' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.CruiseController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.ProgradeThrustController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.AoAController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.SideslipController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.PitchAoAController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.StandardFlyByWire' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.TopModuleManager' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.TopModuleManager+CraftSettingsWindow' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'PartMass' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'EngineMoment' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.AngularAccAdaptiveController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.PitchYawAngularAccController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.PitchYawAngularAccController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'AtmosphereAutopilot.AngularAccAdaptiveController' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'CenterIndicator' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'CruiseMode' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'HeightMode' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

 System.TypeLoadException: Could not load type 'SettingsProfile' from assembly 'AtmosphereAutopilot, Version=1.5.7.0, Culture=neutral, PublicKeyToken=null'.

To make sure this isn't a debug-versus-release thing, I changed the configuration to Release, cleaned, built again [2], and copied the resulting files to GameData/AtmosphereAutopilot. Same results.

Since we appear to be running completely different systems to develop, I'm not going to ask you to diagnose my system. (If you already know why it's not working for me, I wouldn't turn down that answer, however. ๐Ÿ˜„ ) What would help is if you could describe or document how you build the code. Hopefully that will show me if I'm missing some essential step or steps.

I'm happy to document/edit the build instructions in a new section in README.md once this is working.

[1] The first time I built AtmosphereAutopilot, I got an error because the .csproj file has a hardcoded reference to the COPY command, which Mac OS X doesn't have. Until I figure out how to copy README.md in a cross-platform-safe fashion, I've commented it out of the .csproj file. I don't think this should cause my built code to fail.

[2] The first time I built with the Release configuration, I got an error because the output paths in the .csproj file are hardcoded to refer to an installation under Steam, which isn't valid for me (I have the full app from Squad). I edited the .csproj file so the output paths are bin/Release instead. Since my results were the same as when I built with the Debug configuration, I don't think this is the cause of my local code failing either.

Deployed control surfaces behave differently than stock

Deployed surfaces are not movable by the autopilot or manual controls. That might have been intended, but it should be optional or per-surface controllable, and can be done by disabling pitch/yaw/roll for that control surface anyway. Without the mod, the deploy angle is an offset to the user-input angle, not an override.

Additionally, change speed is dependent on deploy angle, see the line below from SyncModuleControlSurface.cs. It's likely that the intention was to only use the sign of deployAngle.

deflection = deflection + deployAngle * Common.Clampf(target - normdeflection, spd_factor);

Cant set waypoint on cruise flight

When i try to set a waypoint using cruise flight and press on "Select waypoint" "map: pick" and select a planet using the map i get a popup saying "missed"

image

Setting in ControlSurface is gone

I know AA uses SyncModuleControlSurface module instead of stock ModuleControlSurface.
But there is a problem like this :

when a plane's ModuleControlSurfacevalue like authoritylimitor or deployAngle is modified in pure stock ksp,
and when I load this plane in AA ksp, that settings value is gone and setting in action group is also gone.

this is stock module value in .craft.

MODULE
{
	name = ModuleControlSurface
	isEnabled = True
	mirrorDeploy = False
	usesMirrorDeploy = True
	ignorePitch = False
	ignoreYaw = True
	ignoreRoll = False
	deploy = False
	deployInvert = False
	partDeployInvert = False
	deployAngle = 0 // <- here
	authorityLimiter = 150 // <- here
	stagingEnabled = True
	EVENTS
	{
	}
	ACTIONS
	{
		ActionToggle
		{
			actionGroup = Brakes // <- here
			wasActiveBeforePartWasAdjusted = False
		}
		ActionExtend
		{
			actionGroup = None
			wasActiveBeforePartWasAdjusted = False
		}
		ActionRetract
		{
			actionGroup = None
			wasActiveBeforePartWasAdjusted = False
		}
	}
	AXISGROUPS
	{
		deployAngle
		{
			axisGroup = None
			axisIncremental = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			axisInverted = None
			overrideIncremental0 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			overrideIncremental1 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			overrideIncremental2 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			overrideIncremental3 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
		}
		authorityLimiter
		{
			axisGroup = None
			axisIncremental = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			axisInverted = None
			overrideIncremental0 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			overrideIncremental1 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			overrideIncremental2 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			overrideIncremental3 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
		}
	}
	UPGRADESAPPLIED
	{
	}
}
}

and this is AA modified .craft's module in .craft file.

MODULE
{
	name = SyncModuleControlSurface
	isEnabled = True
	mirrorDeploy = False
	usesMirrorDeploy = True
	ignorePitch = False
	ignoreYaw = False
	ignoreRoll = False
	deploy = False
	deployInvert = False
	partDeployInvert = False
	deployAngle = 15 // <- here
	authorityLimiter = 100 // <- here
	stagingEnabled = True
	EVENTS
	{
	}
	ACTIONS
	{
		ActionToggle
		{
			actionGroup = None // <- here
			wasActiveBeforePartWasAdjusted = False
		}
		ActionExtend
		{
			actionGroup = None
			wasActiveBeforePartWasAdjusted = False
		}
		ActionRetract
		{
			actionGroup = None
			wasActiveBeforePartWasAdjusted = False
		}
	}
	AXISGROUPS
	{
		deployAngle
		{
			axisGroup = None
			axisIncremental = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			axisInverted = None
			overrideIncremental0 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			overrideIncremental1 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			overrideIncremental2 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			overrideIncremental3 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
		}
		authorityLimiter
		{
			axisGroup = None
			axisIncremental = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			axisInverted = None
			overrideIncremental0 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			overrideIncremental1 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			overrideIncremental2 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
			overrideIncremental3 = Pitch, Yaw, Roll, TranslateX, TranslateY, TranslateZ, WheelSteer, WheelThrottle, Custom01, Custom02, Custom03, Custom04
		}
	}
	UPGRADESAPPLIED
	{
	}
}
}

It makes a small problem that transfering .craft file from AA modified KSP -> to stock KSP.
Yes. it removes settings of wings. it is a main problem now.

I added .craft file in here.

Skylon.craft.txt
Skylon AA.craft.txt

MAS Bridge

Hi Boris, I'm looking to create an autopilot prop using https://github.com/MOARdV/AvionicsSystems/.

What I'd like to do is create a bridge where MAS can send commands to AA and display settings from AA on props. I've tried looking at your code, and I can't really make heads or tails of the different projects. Basically, I'm looking to duplicate the GUI inputs through MAS props inside the IVA:

  • Master On / Off (and tell MAS that it's on or off)
  • Cruise Flight Mode: MAS sets "Level," "Course", or "Waypoint" mode, reads which mode it's in
  • set waypoint, desired course, speed control, altitude hold, vertical speed control
  • Fly By Wire Mode on/off (and tell MAS that it's on or off)

Where would I find these functions in the AA code?

cant load saved crafts in SPH

I have found a bug - after installing this autopilot mod i cant load my crafts in SPH(load button in craft selecting menu just not workin) not all but almost all including stock crafts also. all went back to normal when i uninstalled this mod.ย ksp ver 1.10.1

please fix

Allow save to config to disable angle snap of rotation (default 3deg and not editable in configs)

this is for 0.001deg-level inclination control of SSTO to prepare for precise equitorial orbit around Kerbin (as KSC is not precisely on the equator, 2' south for runway). If it's in somewhere I didn't find in config, you may tell me and I'll appreciate it.
description: craft settings-roll ang vel controller, every time I have to manually set it to 0 before takeoff. reverting to launch, exit and restart KSP, etc. will cause this value to return to 3deg, making me have to set it to 0 every time before takeoff (shrugging.png here)

Logspam when USI-LS is installed

Hi! Since the Update to 1.0.5, there is a compatibility issue between USI-LS[https://github.com/BobPalmer/USI-LS/releases] and AtmosphereAutopilot. There is a logspam of:

MissingMethodException: Method not found: 'ResourceConverter.ProcessRecipe'.

If either USI-LS is or AtmosphereAutopilot is removed, the logspam goes away.
This happens both in the editor as well as in a flight scene, if a crewed part exists.

http://forum.kerbalspaceprogram.com/threads/116790-1-0-USI-Life-Support-0-1-0-2015-04-27
https://github.com/BobPalmer/USI-LS/releases

AoA-hold target set to strange values

When enabling the master switch at high altitude with AoA-hold mode selected, the AoA target is often set to angles that aren't near the current AoA (sometimes 100+ degrees) or even in the direction that the vessel is rotating toward.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.