SumZer0-git / EDAPGui

An Autopilot for Elite Dangerous
MIT License
57 stars 24 forks source link

See ChangeLog for latest updates
Join discord if need support or wish to provide inputs on new features: https://discord.gg/HCgkfSc

ED Autopilot - Gui

This Elite Dangerous (ED) Autopilot supports the following main features:

FSD Route assist

For the FSD Route Assist, you select your destination in the GalaxyMap and then enable this assistant and it will perform all the jumps to get you to your destination, AFK. Furthermore while executing route assistance it will perform detailed system scanning (honk) when jumping into a system and optionally perform FSS scanning to determine if Earth, Water, or Ammonia type world is present.

Supercruise assist

The supercruise (SC) assistant (and not using ED's SC Assist which takes up a slot, for a piece of software?) will keep you on target and when "TO DISENGAGE" is presented and will autodrop out of SC and perform autodocking with the targeted Station.

Waypoint assist

With Waypoint Assist you define the route in a file and this assist will jump to those waypoints. If a Station is defined to dock at, the assistant will transition to SC Assist and dock with the station. A early version of a trading capability is also included.
Additional information can be found here.

Robigo Mines assist

The Robigo Assist performs the Robigo Mines passenger mission loop which includes mission selection, mission completetion, and the full loop to Sirius Atmospherics.
Additional information can be found here.

AFK Combat escape assist

Additional Features

If Voice enabled, the autopilot will inform you of its actions

This autopilot uses Computer Vision (grabs screens and performs template matching) and issues keystrokes. It does not perform any runtime modifications of Elite Dangerous, it is an external-ED construct (similar to us commanders)

  ./docs
  * Calibration.md for details on how to calibrate EDAPGui for your system if required 
  * Waypoint.md for details on how to generate a waypoint file 
  * RollPitchYaw.md for details on how to tune the Pitch, Roll, Yaw values
  * Robgio.md for details on the Robigo Mines loop

Note: this autopilot is based on https://github.com/skai2/EDAutopilot , some of the routines were used and turned into classes and tweaks were done on sequences and how image matching was performed. Kudo's to skai2mail@gmail.com

Also Note: This repository is provided for educational purposes as a in depth programming example of interacting with file based data, computer vision processing, user feedback via voice, win32 integration using python, threading interaction, and python classes.

Constraints:

How to run:

Once ED_AP has started there are few steps to complete the first time ED AP is run. These will help avoid common issues.

  1. Perform screen calibration, detailed here. This will configure ED_AP for your screen resolution. Many issues can be avoided with correct calibration.
  2. Check and if necessary, change keybinding options, detailed below. Pay special attention that the Ins, Home, End and Pg Up are not used by ED as these are used by EDAP.
  3. Note: the autopilot.log file will capture any required keybindings that are not set.
  4. Select the correct ship file matching the ship you are flying, this will configure the pitch, roll and yaw rates to match. Depending on the ship, you may need to tune the values for best response a detailed here.
  5. Perform an in-system test:
    • In ED, use Left Panel to select a local target.
    • In the autopilot enable SC Assist or hit the 'Ins' key.
    • When a assist starts it will set focus to the Elite Dangerous window.
    • Ship will undock if docked, jump to SC, maneuver to the target and upon arriving at the target, will attempt to dock if it is a station.
    • Any flight issues, check ship tuning.
      1. Perform an out-of-system test:
    • In ED, use Galaxy Map select a target system.
    • In the autopilot enable FSD Assist or hit the 'Home' key.
    • When a assist starts it will set focus to the Elite Dangerous window.
    • Ship will undock if docked, jump to SC, maneuver to the target, perform an FSD jump. Upon arrival in the system, it will manuever aroung the star, fuel scoop as necessary and either stop if no in system target is selected, or attempt to fly to the target and attempt to dock if it is a station.
    • Any flight issues, check ship tuning.

Required Keybindings

The following keybindings are required by AP, so make sure a key is assigned to each by going into the Elite Dangerous options and assigning a key. After changing keybindings run AP again for the chagnes to be read. An error will appear if any of the keybindings are missing in Elite Dangerous.

Binding Name Location under OPTIONS > CONTROLS
UI_Up UI PANEL UP GENERAL CONTROLS > INTERFACE MODE
UI_Down UI PANEL DOWN GENERAL CONTROLS > INTERFACE MODE
UI_Left UI PANEL LEFT GENERAL CONTROLS > INTERFACE MODE
UI_Right UI PANEL RIGHT GENERAL CONTROLS > INTERFACE MODE
UI_Select UI PANEL SELECT GENERAL CONTROLS > INTERFACE MODE
UI_Back UI Back GENERAL CONTROLS > INTERFACE MODE
CycleNextPanel NEXT PANEL TAB GENERAL CONTROLS > INTERFACE MODE
MouseReset RESET MOUSE SHIP CONTROLS > MOUSE CONTROLS
YawLeftButton YAW LEFT SHIP CONTROLS > FLIGHT ROTATION
YawRightButton YAW RIGHT SHIP CONTROLS > FLIGHT ROTATION
RollLeftButton ROLL LEFT SHIP CONTROLS > FLIGHT ROTATION
RollRightButton ROLL RIGHT SHIP CONTROLS > FLIGHT ROTATION
PitchUpButton PITCH UP SHIP CONTROLS > FLIGHT ROTATION
PitchDownButton PITCH DOWN SHIP CONTROLS > FLIGHT ROTATION
SetSpeedZero SET SPEED TO 0% SHIP CONTROLS > FLIGHT THROTTLE
SetSpeed50 SET SPEED TO 50% SHIP CONTROLS > FLIGHT THROTTLE
SetSpeed100 SET SPEED TO 100% SHIP CONTROLS > FLIGHT THROTTLE
UseBoostJuice ENGINE BOOST SHIP CONTROLS > FLIGHT MISCELLANEOUS
HyperSuperCombination TOGGLE FRAME SHIFT DRIVE SHIP CONTROLS > FLIGHT MISCELLANEOUS
Supercruise SUPERCRUISE SHIP CONTROLS > FLIGHT MISCELLANEOUS
SelectTarget SELECT TARGET AHEAD SHIP CONTROLS > TARGETING
PrimaryFire PRIMARY FIRE SHIP CONTROLS > WEAPONS
SecondaryFire SECONDARY FIRE SHIP CONTROLS > WEAPONS
DeployHardpointToggle DEPLOY HARDPOINTS SHIP CONTROLS > WEAPONS
DeployHeatSink DEPLOY HEATSINK SHIP CONTROLS > COOLING
IncreaseEnginesPower DIVERT POWER TO ENGINES SHIP CONTROLS > MISCELLANEOUS
IncreaseWeaponsPower DIVERT POWER TO WEAPONS SHIP CONTROLS > MISCELLANEOUS
IncreaseSystemsPower DIVERT POWER TO SYSTEMS SHIP CONTROLS > MISCELLANEOUS
UIFocus UI FOCUS SHIP CONTROLS > MODE SWITCHES
GalaxyMapOpen OPEN GALAXY MAP SHIP CONTROLS > MODE SWITCHES
SystemMapOpen OPEN SYSTEM MAP SHIP CONTROLS > MODE SWITCHES
ExplorationFSSEnter ENTER FSS MODE SHIP CONTROLS > MODE SWITCHES
HeadLookReset RESET HEADLOOK SHIP CONTROLS > HEADLOOK MODE
ExplorationFSSQuit LEAVE FSS SHIP CONTROLS > FULL SPECTRUM SYSTEM SCANNER

Autopilot Options:

Hot Keys (configurable)

Hot keys are now configurable in the config-AP.json file, so you can remap them. Be sure not to use any keys you have mapped in ED. You can find the key names here: https://pythonhosted.org/pynput/keyboard.html

Config File: config-AP.json

Note: the below is from the code, the real .json file will have the True/False values as lower case, as in true/false

       self.config = {  
            "DSSButton": "Primary",        # if anything other than "Primary", it will use the Secondary Fire button for DSS
            "JumpTries": 3,                # 
            "NavAlignTries": 3,            #
            "RefuelThreshold": 65,         # if fuel level get below this level, it will attempt refuel
            "FuelThreasholdAbortAP": 10,   # level at which AP will terminate, because we are not scooping well
            "WaitForAutoDockTimer": 120,   # After docking granted, wait this amount of time for us to get docked with autodocking
            "SunBrightThreshold": 125,     # The low level for brightness detection, range 0-255, want to mask out darker items
            "FuelScoopTimeOut": 35,        # number of second to wait for full tank, might mean we are not scooping well or got a small scooper
            "DockingRetries": 30,          # number of time to attempt docking
            "HotKey_StartFSD": "home",     # if going to use other keys, need to look at the python keyboard package
            "HotKey_StartSC": "ins",       # to determine other keynames, make sure these keys are not used in ED bindings
            "HotKey_StartRobigo": "pgup",  # 
            "HotKey_StopAllAssists": "end",
            "Robigo_Single_Loop": False,   # True means only 1 loop will execute and then terminate upon docking, will not perform mission processing
            "EnableRandomness": False,     # add some additional random sleep times to avoid AP detection (0-3sec at specific locations)
            "OverlayTextEnable": False,    # Experimental at this stage
            "OverlayTextYOffset": 400,     # offset down the screen to start place overlay text
            "OverlayTextXOffset": 50,      # offset left the screen to start place overlay text
            "OverlayTextFont": "Eurostyle", 
            "OverlayTextFontSize": 14, 
            "OverlayGraphicEnable": False, # not implemented yet
            "DiscordWebhook": False,       # discord not implemented yet
            "DiscordWebhookURL": "",
            "DiscordUserID": "",
            "VoiceEnable": False,
            "VoiceID": 1,                  # my Windows only have 3 defined (0-2)
            "ElwScannerEnable": False,
            "LogDEBUG": False,             # enable for debug messages
            "LogINFO": True
        }

Setup:

Requires python 3 and git

  1. Clone this repository
    > git clone https://github.com/sumzer0-git/EDAPGui
  2. Install requirements
    > cd EDAPGui
    > pip install -r requirements.txt
  3. Run script
    > python EDAPGui.py
    OR you may have to run
    > python3 EDAPGui.py
    if you have both python 2 and 3 installed.

If you encounter any issues during pip install, try running:

python -m pip install -r requirements.txt instead of > pip install -r requirements.txt

The following error may occur:

AttributeError: '_thread._local' object has no attribute 'srcdc'

The error is usually as a result of mss incompatibility. Try pip install mss==8.0.3 or pip install mss==8.0.3.

Known Limitations

Elite Dangerous, Role Play and Autopilot

WARNING:

Use at your own risk. Have performed over 2000 FSD jumps with this autopilot and have aborted the FSD Assist about 6 times due to jumping into a system that had 2 suns next to each other and pretty much the ship overheated and dropped out of supercruise. The ship did not get destroyed but had to use a heat sink to get out of the situation

Email Contact

sumzer0@yahoo.com

Screen Shots

Alt text Alt text Alt text