skai2 / EDAutopilot

Elite Dangerous computer vision based auto-navigation including long range routing
MIT License
151 stars 67 forks source link

No module named src.directinput #40

Closed AgentMoLnia closed 4 years ago

AgentMoLnia commented 4 years ago

Hello. After comand "python autopilot.py" in command prompt - Import Error: No module named src.directinput.

What to do?

image

AgentMoLnia commented 4 years ago

image

image

TomW1605 commented 4 years ago

what version of python are you using?

AgentMoLnia commented 4 years ago

At first I installed the latest version of 3.8.3, but when "pip (or pip3) install -r requirements.txt" was an error about the wrong version (opencv-python = = 4.1.0.25)! Then I installed version 2.7 and the command "pip install -r requirements.txt" updated everything and downloaded it from the Internet according requirements.txt file.

AgentMoLnia commented 4 years ago

Which version is best used?

image

TomW1605 commented 4 years ago

try 3.6 and see if that works. if you get more errors from pip please post screenshots

AgentMoLnia commented 4 years ago

I installed 3.7.7, updated by requirements, reassigned the control keys in Elite, now the autopilot is running, the icon in the taskbar is present. But autopilot only increases the speed to 100% and everything :(

image

I adjusted game resolution: 1920х1080 Borderless Ship UI color: Orange (default colour) Ship UI brightness: Maximum

image

What else should I check and configure?

AgentMoLnia commented 4 years ago

Yes, there are some difficulties with assigning keys when using this script :)

I have a question: in the control settings there are three places where the "home" key is used. Does this affect the operation of the autopilot?

image

TomW1605 commented 4 years ago

i would advise changing those bindings to other keys. if that does not work please upload your logs.

AgentMoLnia commented 4 years ago

TomW1605, please share a "Custom.3.0.binds" file that does not conflict with the script.

AgentMoLnia commented 4 years ago

Autopilot stops on a step - DEBUG:root:align= find navpoint (speed 100%, no tilt, only forward, long time).

autopilot.log

TomW1605 commented 4 years ago

i think the issue might be that you have "CycleNextPanel" set to End. try binding this to a different key. unfortunately my current bind set uses a gamepad as well but i will try and make one that works this evening (currently 7:30 am and i need to go to work so won't be for a while)

AgentMoLnia commented 4 years ago

I changed keys all day, but so far everything is unsuccessful.

autopilot.log

AgentMoLnia commented 4 years ago

One from last error:

image

AgentMoLnia commented 4 years ago

In autopilot version from SpeedrunnerG55 (https://github.com/SpeedrunnerG55/EDAutopilot) i have next error:

image

And I don't know what to do and who to ask advice: (

How can I ask a question to SpeedrunnerG55 also ? Many thanks!

TomW1605 commented 4 years ago

i think @SpeedrunnerG55 made changes to his repo that might break windows compatibility. you could try my fork (https://github.com/TomW1605/EDAutopilot) but there are a few changes. mostly that it uses page up and down instead of home and end because i didn't want to change my key binds. not sure what the first error is but the error with @SpeedrunnerG55's repo looks like it is from his changed keyboard library.

AgentMoLnia commented 4 years ago

Thanks! But autopilot does not start after "home" :(

autopilot.log

TomW1605 commented 4 years ago

if you are using my repo i changed the binds to page up for start and page down for stop.

i also notice that you don't have a system targeted. the autopilot will turn itself off if there is no target

also if you edit an existing message that has already been read there is no notification so might be missed. i would advise not editing a message that is older than about 10-20 mins if it adds significant content

AgentMoLnia commented 4 years ago

Ok, i will try page up for start and page down for stop. I always choose the system to jump :)

TomW1605 commented 4 years ago

in your last log it shows no target selected

DEBUG:root:ship={'time': 103, 'status': 'in_space', 'type': 'cutter', 'location': 'Tewanta', 'star_class': None, 'target': None, 'fuel_capacity': 64.0, 'fuel_level': 64.0, 'fuel_percent': 100, 'is_scooping': False}

but that is a side note as there would be a start and stop event in the logs and there is none so that is not the issue here

SpeedrunnerG55 commented 4 years ago

not sure what the first error is but the error with @SpeedrunnerG55's repo looks like it is from his changed keyboard library.

I did not include definitions for function keys for possible keyboard inputs py input defines the function keys as f#.. and not F#. fix for that included in my latest push.

tho the way I handle screen input is also different because on my system I could not rely on using ratios of the screen because I have dual monitors and it used the combined screen space as one monitor. I'm not sure if that is a Linux issue or a dual monitor issue.

TomW1605 commented 4 years ago

i think that is something that still wont work in windows. from what i can tell pynput can not handle direct input. i am working on a version of pyautogui that can use direct input but that is taking a while.

as for the screen issue i think that is a dual monitor on linux issue. i have dual monitors on windows and don't have an issue. although it might work to use a windows management library to get the extent of the ED window and then use ratios from there. this would be the most reliable.

also @SpeedrunnerG55 we should really have a chat about possibility working together. we both seem to be going in similar directions with our forks and would probably benefit from working together.

SpeedrunnerG55 commented 4 years ago

also @SpeedrunnerG55 we should really have a chat about possibility working together. we both seem to be going in similar directions with our forks and would probably benefit from working together.

how should we communicate? I'm afraid we are getting off-topic here.

AgentMoLnia commented 4 years ago

I wish you a successful collaboration!

AgentMoLnia commented 4 years ago

TomW1605's autopilot version:

error step - DEBUG:root:align=find navpoint -

image

autopilot.log

Page_UP - ship gain speed 100% and fly straight, Page_DN - ship stops.

AgentMoLnia commented 4 years ago

The same error in SpeedrunnerG55's autopilot version:

image

TomW1605 commented 4 years ago

ok it looks like it is not finding the template. i wonder if it is an issue with your username? could you try moving the folder to another drive? even a usb drive would do to test. also can you send a screenshot of the template folder?

AgentMoLnia commented 4 years ago

Yes. I moved the autopilot folder to C:\EDAutopilot and the ship began to move! Thanks! I will test further :)

autopilot.log

image

AgentMoLnia commented 4 years ago

SpeedrunnerG55's autopilot version now has next error:

image

TomW1605 commented 4 years ago

so what version worked? was it meant to do just one jump or did you stop it?

AgentMoLnia commented 4 years ago

Cutter is better for autopilot template function (i know inglish not very well):

image

TomW1605 commented 4 years ago

why is the compass white? do you have custom colours set up?

also if you are using my fork does it still have the previews showing?

AgentMoLnia commented 4 years ago

TomW1605, does autopilot have the function of guiding the ship to the station after the last jump along the route? Is it difficult to add it?

AgentMoLnia commented 4 years ago

most likely screenshot made during his blinking before the hyper-jump

TomW1605 commented 4 years ago

not at the moment. there is currently no easy way to detect that there is a station targeted. i did start working on it but decided to make other improvements first as they were more pressing

AgentMoLnia commented 4 years ago

understandably, thank you, and in what direction do you work with an autopilot?

TomW1605 commented 4 years ago

im currently working on redoing the input methods and minimising the number of required libraries. this is mainly for cross platform compatibility. i am planning to add a proper gui for settings including custom keybinds for start/stop

SpeedrunnerG55 commented 4 years ago

SpeedrunnerG55's autopilot version now has next error:

I made a very silly mistake with handling the f keys in the dictionary. should be fixed now, however, once it does work it's most likely not going to work properly because the way I have it set up to work with my screens resolution and window setup.

fixed applied in the last push

AgentMoLnia commented 4 years ago

SpeedrunnerG55, what is your screens resolution and window setup? Can i try to change image resolutions in this folder? :

image

SpeedrunnerG55 commented 4 years ago

SpeedrunnerG55, what is your screens resolution and window setup? Can i try to change image resolutions in this folder? :

last time I remember I was useing 1600x900 screen resolution

AgentMoLnia commented 4 years ago

In window mode or boardlees ?

SpeedrunnerG55 commented 4 years ago

borderless

TomW1605 commented 4 years ago

@AgentMoLnia have you gotten any version working? if so you should probably close the issue and open a new one for any new issues that come up.

also @SpeedrunnerG55 you might want to turn on issues on your fork so they can be kept separate from this repo.

SpeedrunnerG55 commented 4 years ago

also @SpeedrunnerG55 you might want to turn on issues on your fork so they can be kept separate from this repo.

Fixed, sry about that

AgentMoLnia commented 4 years ago

@AgentMoLnia have you gotten any version working?

Your version is working now!

Can I ask other questions about autopilot and where better to do it?

TomW1605 commented 4 years ago

great glad you got it working.

as for additional question. generally just make another issue if the question is distinctly different form the initial topic of the current issue.

AgentMoLnia commented 4 years ago

And the last question in this branch )) @TomW1605 and @SpeedrunnerG55, what features (capabilities) do your autopilot versions have? And how can I enable these commands (features) ?

TomW1605 commented 4 years ago

in my case there are no additional features. the only changes i have made are adding support for 4k monitors and some changes to improve the computer vision. i do have quite a few changes planned but they will take a while and will basically involve a complete rewrite. this mainly revolves around a proper GUI for settings like scan mode and keybinds but will also include a lot of under the hood changes.

EDIT: i am also trying to remove as many dependencies as possible. currently there is significant overlap in features between libraries. eg there are at least 2 libraries used that have the ability to take screenshots, i am trying to cut out one of them.

skai2 commented 4 years ago

This isn't quite the purpose of a git issue thread, but I've been watching this conversation form and can't help but share my own angle.

@SpeedrunnerG55 and @TomW1605, like @AgentMoLnia, I was wondering what sort of directions you had gone into in your respective forks, so I had a look and it seems to me there are very valuable enhancements to the program. Improvements, such as those stated in @TomW1605 future plans for instance, as well as those seen in @SpeedrunnerG55 repo, are not only great but essential to advance from an alpha stage and bring this program closer to a real Elite Autopilot (why on earth do we still not have one in 3306?)

When I decided to make this project public on GitHub I was hoping to garner support from other devs who also had a desire for an Autopilot written in an entirely external manner from the game, or even those who were curious to learn about computer vision and automation. Over time though, despite there being a clear interest in the project, very few actually showed up to directly work on the code, and eventually, due to my own time constraints, work, etc, I ended up halting development as well.

There have been other attempts at this autopilot (either not published, of a primitive/heavily scripted nature, or involving hacking the games memory) but as far as I am aware none quite like this one. If you are interested, I would like to invite you both to become contributors here, so we can pool our resources, and resume progress in this project, faster and better than either of us alone could. Perhaps even set up a discord and reasonably regular talks, if you are so inclined. Eager to know what you think.

AgentMoLnia commented 4 years ago

I would love to help with advice and ideas)! I've been playing this game for a long time and I know it very well. But I am not a programmer, especially professional. I do not know the Python, although I own general concepts about programming ( . I played the Elite back in 1992. Then I tried programming in the programming language - Assembler, in Z80 (zx-spectrum) :)

skai2 commented 4 years ago

@AgentMoLnia Absolutely, you and any others with experience in Elite, programmers or not, would be welcome to join. We could setup such channels as suggestions, testing, etc. The more people helping and providing feedback the better.