Courseplay / courseplay

Courseplay for Farming Simulator 2019
http://courseplay.github.io/courseplay
GNU General Public License v3.0
952 stars 528 forks source link

Support of AutoDrive - Collection/Discussion/Status #3820

Closed Tensuko closed 4 years ago

Tensuko commented 5 years ago

As some ppl already noticed. CP got in contact with the AD Developer, @Stephan-S Feel free to add your thoughts and Ideas here, before make a new Issues. Also read the actual existing Issues for what we talked about so far.

3819

3792

scandal65 commented 5 years ago

Hi, ich benutze seit Jahren CP! - und war bis Gestern damit eigentlich vollens zufrieden!! ;) wie gesagt bis gestern! Denn nun habe ich gesehen ( Youtube) wie einfach sich Strecken mit AD erstellen lassen!!

Mein Traum : Könnten CP und AD nicht fusionieren ?!?!?!?

....arbeiten mit CP und die ganze abfahrerei mit AD-Strecken!

lg BJ

Stephan-S commented 5 years ago

Hey guys,

Just to get some brainstorming going, here are some approaches we could try/decide on.

For combined unload mode. I see a few alternatives as on how to combine the two mods. Use mode2 (reworked mode2 in the future) to efficiently unload combines and then the question is whether to a) 'pass' the tractor over to AutoDrive which then drives to the offloading destination and back to the field and again passes control over to CP or b) just use an interface to access the AutoDrive network and generate the course which is then solely driven by Courseplay.

For option b), the user would have to either b1) control both HUDs to generate the course. Since the Destinations would have to be selected in AD for both cases. or b2) if CP is supposed to do all the heavy lifting, it would be nice to control everything in one HUD. Which means CP would have to access and display possible start and target destinations from the AD network.

What are your thoughts on this? Do you see any other good use cases? I'm happy to discuss some interface options where CP just queries AD for a path to certain locations.

@scandal65 Ich hoffe der Mod überzeugt dich auch Ingame und nicht nur im Video. Lob ihn nicht zu früh :D

fudoido commented 5 years ago

My opinion, if you guys think of combining both mods as one, go for option B2. If you prefer to keep them separate, because some people might prefer to have autodrive or courseplay instead of both or a unique mod with combined resources, go for A, and this might be also easier to implement coding wise i think.

scandal65 commented 5 years ago

@Stephan-S

Hallo, ich hatte mir zu LS17-Zeiten meine "scandal-numbers" (mit Hilfe! ;) ) zusammen gebastelt! - mit denen habe ich auf der Map die Kreuzungen durchnummeriert und konnte so meine Routen aus Teilstrecken zusammensetzen! Das Problem hierbei waren aber die Kurven/Abbiegen! ( !! das finde ich bei AD genial !! ) Hinzu kommt natürlich bei AD das ich sagen fahre von "A" nach "F" ! - ohne 4 oder 5 Teilstrecken zusammen setzen zu müssen! Bei LS19 habe ich jetzt das Problem, hier kann ich nur Kreuzungen nummerieren die MIR GEHÖREN !

Ich würde zu 60/40 zu B2/B1 tendieren - nur müssten alle Fzg CP und AD kompatibel sein! Denn es bringt mir wenig wenn der CP-Drescher ADmässig abgetankt werden kann - ich aber für den Ladewagen mit Stroh eine extra CP-Route brauche! ;-)

lg BJ

PS entschuldigt das ich auf Deutsch schreibe, aber ich bin Ü50 und mein Englisch wollt ihr nicht wirklich! :-))

Tensuko commented 5 years ago

Still trying out, what and how AD handels and compare it to CP, as well as try to combine it with what is possible so far. For any kind of Route, like go from A to B, refill, etc AD looks nice. But where should be the point to combine them.

Option A, AD drives the vehicle to its work place, and CP takes over, when done, CP gives it back to AD and AD drives it back to where you want it.

But where to integrate the combination, in CP HUD ? Like give the Tracktor a whole Task ?

A lot of things to discuss...

pvaiko commented 5 years ago

Not sure I fully understand how AD works but one idea requiring probably the least amount of work on the CP side would be to include the AutoDrive destinations in the CP course storage menu, for example in an AutoDrive (virtual) folder where you could select destinations known to AD and then load them to CP as any saved course.

This would need an interface provided by AD with the list of the destinations, to generate and return a course to CP.

Stephan-S commented 5 years ago

The destinations could easily be exported with name, location in world coordinates and an id which corresponds to the node id in the AD network.

And for some explanation 'on how AD works': I assume you know that the pathfinding works on a recorded network which is internally represented in a graph structure, where every node knows it's in/outgoing paths. The fastest routes are calculated using a Dijkstra algorithm, with the euclidian distances as weight function.

If AD needs to know a path from point x to some destination, it can just look it up, as each node knows the fastest path (next edge) to every recorded destination. So I can relatively easily provide an interface to retrieve a path. eg. vehicle_spec_autodrive:GetFastestPath(startX, startZ, startYRot, destinationID)

As a return you would get a list of waypoints with x,y,z values (no rotation).

I guess the waypoint transformation into your format should take place on CP side.

you could select destinations known to AD and then load them to CP as any saved course

The question here is where the starting point should be in this case, right?

And maybe we should add an option parameter for things like maximum distance to the first node (from your provided starting point) or other future restrictions

Theoretically AD could also calculate routes to any location, not just the marked destinations, but that would require 'real-time' calculation instead of looking it up in the table. I would have to build something around that use case to make the calculation asynchron if that need exists.

RUGhost commented 5 years ago

Option A, AD drives the vehicle to its work place, and CP takes over, when done, CP gives it back to AD and AD drives it back to where you want it.

I like this idea of @Tensuko

pvaiko commented 5 years ago

@RUGhost that would be the easiest to implement in CP, to drive to the first waypoint of any CP course using an AD generated route, but based on what @Stephan-S writes that is not possible at the moment.

pvaiko commented 5 years ago

@Stephan-S why don't we pick a specific use case and think about how would that be implemented best? We have the one above (driving to a field and start working), or how to run a refill/unload course from the field to some destination and back?

cyberndj commented 5 years ago

I like the idea of Option A as suggested by @Tensuko and @RUGhost.

I think the unload course in CP would have to have two AD points set to do the unload course properly. First point would be the point at the field, and the second would be the unload point. The AD unload mode may also have to get triggered by CP so it will not stop if left in one of the other modes. Finally maybe AD can call the proper CP function to continue/resume the original CP course once it reaches the starting point.

Anonymous-any commented 5 years ago

Ok dev's it seem we must continue fusion discussion here? here is my test look not so bad !! I can observe 2 issue one of each side it seem. The one side from CP to open the pipe I must click continue now after it show it need to be unloaded to open the pipe for unload because if not it not open alone at the 1st unload pass. When this step is done then AD start to come and waiting under the pipe but the cover won't open alone too :) like this: 1 Edit: At the 2nd pass unload CP opened it alone BUT FOR THIS HAPPEN it seem we must click CP call driver before it came full for unload if not finally click continue now is needed again. I continue how it go... hope this help maybe already reported. Regard

RUGhost commented 5 years ago

I think upcoming new mode 2 of CP will be better to control a chaser than AD. We can use AD for transfer course.

Anonymous-any commented 5 years ago

Hi all I was at the pick up (tired) but it was a status all the same :p To my user thing and view point I will vote for B2 too but maybe leave both HUD's ? maybe with this you can keep benefit to create path and destinations separately while of the workers working ? I say that because I don't know if one HUD can do dual jobs too it's you the coders, all which we would need is CP can read AD destinations purposed in B2 because it already can reach the combine. So is will be possible the same way for other vehicles/tools (I want to mean by tools all other vehicles who they are not combines or tractors) ? maybe by this way both will manage as better way all tools and much easy to code because you just have done do it actually in few days ? For the story It am front of a fascination to see how AD create and fast calculate his virtual ways to reach in the fields :) Finally what we would need a CP editable in real time but with the speed storm of AD /O-O/ Good guys you are half-gods

Knowen commented 5 years ago

With release .225.dev the combine dont open the pipe when full (or something between 95% to 100%). This means no AD Driver will unload the combine. This worked like a charm with release .224.dev.

pvaiko commented 5 years ago

@Knowen can you double check this, there's really nothing in 225 which could be causing this. If you still see it, open a new issue and post log with debug channels 12 and 14.

scandal65 commented 5 years ago

Hallo nochmal,

....als Erstes... @Stephan-S Ich habe hier NICHTS zu früh GELOBT! - AD ist vom System her Super! Ich habe mir auf einer Map die ganzen Strecken eingefahren! - und kann jedes Fahrzeug überall hin schicken! Abtanken vom Drescher funktioniert auch ! ;)

....Zweitens... Wie soll das bei der Heu bzw. Gras Ernte funktionieren? Kann man dem Ladewagen einen Befehl geben, das er nach dem sammeln mit CP - mit AD zum Lager fährt und anschliessend mit CP wieder weiter sammelt? ...oder geht eure Planung bisher nur zum Abtanken von Dreschern!?

lg BJ

### google english ! - sorry!! ;)

Hello again,

....first... @ Stephan S I have NOT praised TOO soon! - AD is super from the system! I retracted on a map the whole distance! - and can send any vehicle anywhere! Uploading from the thresher works too! ;)

....Secondly... How should that work with the hay or grass harvest? Is it possible to give the loader a command that after collecting with CP - with AD it drives to the warehouse and then continues to collect with CP? ... or is your planning so far only for working with thresher?

lg BJ

Anonymous-any commented 5 years ago

With release .225.dev the combine dont open the pipe when full (or something between 95% to 100%). This means no AD Driver will unload the combine. This worked like a charm with release .224.dev.

I don't have this issue I'm on 225 maybe a setting somewhere ?

Knowen commented 5 years ago

@Knowen can you double check this, there's really nothing in 225 which could be causing this. If you still see it, open a new issue and post log with debug channels 12 and 14.

@pvaiko I'll check that. I updated several mods today. maybe one of that is causing the problem.

EDIT: The Mod PlayerSpeed seems to be a problem. First i thought it could be FollowMe, but it wasnt. Now everything works!

Tensuko commented 5 years ago

I used to run FS19 with -Cheats so I always on speed + Console Commands when I need them for testing. :)

Knowen commented 5 years ago

I used to run FS19 with -Cheats so I always on speed + Console Commands when I need them for testing. :)

There were only three mods who could have caused the problem: FollowMe, PlayerSpeed or HUDSmartShade. With FollowMe and HUDSmartShade the combine opens the pipe. With PlayerSpeed not. Dont know why, but this mod is causing the problem.

tjb8907 commented 5 years ago

I have a hacked together mod for FS17 that used AD and CP functions to generate CP courses from an AD route - I could select a destination in AD, and hit my generate hotkey, and it would create a course in CP. It was by no means professional (was just for my use, because it was in early stages), but it was pretty neat for transferring vehicles, or getting unload routes. I also had parking spots for each vehicle in AD, so I could send a vehicle from the field back to its parking spot.

Would be really cool to see this as a part of CP!

scandal65 commented 5 years ago

…..das wäre großartig, wenn man AD in CP integrieren könnte!

Dann könnte man jedes Fahrzeug mit AD-Routen auf Felder schicken – mit CP arbeiten (Ladewagen, Dünger, saeen.....) lassen – und anschließend mit AD wieder zum Hof schicken!

(M)ein Traum!

.....that would be great if you could integrate AD into CP!

Then you could send any vehicle with AD routes to fields - work with CP (loader, fertilizer, .....)- and then send back to the farm with AD!

(My) a dream!

Stephan-S commented 5 years ago

Hey, @tjb8907 that sounds very interesting. And very impressive, considering the coding quality of the FS17 version of AutoDrive, that you were able to do this :-D

@pvaiko I just updated the AutoDrive Interface and included a small example on how to use it, to start AutoDrive and receive a callback, when it has reached it's target. When you have the time, you could try calling this function from Coursplay code. Maybe there could be an option such as "Use AutoDrive" to decide what to do when the trailer is full in fieldwork mode or mode2 and then call the autodrive interface instead of driving an unload course in cp.

I tried doing it myself and managed to get the fieldworker who was collecting hay to switch to AD to unload and then switch back to cp when it reached the fieldpos again. But I am sure you can do a better job of integrating this properly into CP without breaking anything else. But I can send you the changed file to get you started more quickly. I annotated the changes with some comments (--AutoDrive ..)

FieldworkAIDriver.zip

This way, the settings and target set in the AutoDrive HUD are used when switching over to AutoDrive from Courseplay.

Best regards, Stephan

pvaiko commented 5 years ago

@Stephan-S sweet! I'll finish my current project and then continue with this. I guess you did this in your Courseplay fork, would you mind opening a pull request next time, I prefer doing everything in git instead of zipped sources.

Anonymous-any commented 5 years ago

Aiiii @tjb8907 FS17 this look good ! can you share your whole ? Regard

tjb8907 commented 5 years ago

Aiiii @tjb8907 FS17 this look good ! can you share your whole ? Regard

Anonymous-any commented 5 years ago

Aiiii @tjb8907 FS17 this look good ! can you share your whole ? Regard

* Its been a while since i used it, so I'd have to revisit my code, but I think may have altered the CP code to make it work....If I have some time i'll see if i can port it to FS19 and see how it works again,

@tjb8907 I wanted to talk about your FS17 version :)

pvaiko commented 5 years ago

@Stephan-S you may want to check 9dccb8e on the autodrive branch, I implemented it in CP as you intended I think.

pvaiko commented 5 years ago

@Stephan-S oh, the AutoDrive setting is on the general vehicle settings page of the CP HUD.

Stephan-S commented 5 years ago

Hey @pvaiko looks really good. Two issues though: 1: Since spec_autodrive is only available after the vehicle has once called Autodrive:onUpdate(), depending on which mod runs first (differs for each vehicle), the CP HuD often lists Autodrive as 'Not installed'. So a delayed or somehow regular check would be required here. 2: When I set the option to use AautoDrive and then start the CP driver, it resets back to 'Don't use' and I have to set it on while the CP driver is already active. I think this also happened after Autodrive returns from unloading.

Otherwise it seems to work as expected. As soon as CP passes to AutoDrive, the driver will drive to the closest/best suited waypoint and start it's route. As mentioned earlier, it might be a better solution to first drive to the first waypoint of the cp field course before passing the control to AutoDrive. But that depends also on how many waypoints are around the field and if Autodrive can always find a suitable waypoint to start the route. It is not set up to use 'pathfinding' in this scenario. But Courseplay already has that integrated in this mode, right?

pvaiko commented 5 years ago

Your #1 is already fixed on the master branch I believe.

As for #2, CP can use its own pathfinding to get off the field, but where exactly? If AD can give me the coordinates of the first wp I could work with that. I don't think using the first cp wp is a good idea for multiple reasons.

On June 16, 2019 11:55:03 AM CDT, Stephan Schlosser notifications@github.com wrote:

Hey @pvaiko looks really good. Two issues though: 1: Since spec_autodrive is only available after the vehicle has once called Autodrive:onUpdate(), depending on which mod runs first (differs for each vehicle), the CP HuD often lists Autodrive as 'Not installed'. So a delayed or somehow regular check would be required here. 2: When I set the option to use AautoDrive and then start the CP driver, it resets back to 'Don't use' and I have to set it on while the CP driver is already active. I think this also happened after Autodrive returns from unloading.

Otherwise it seems to work as expected. As soon as CP passes to AutoDrive, the driver will drive to the closest/best suited waypoint and start it's route. As mentioned earlier, it might be a better solution to first drive to the first waypoint of the cp field course before passing the control to AutoDrive. But that depends also on how many waypoints are around the field and if Autodrive can always find a suitable waypoint to start the route. It is not set up to use 'pathfinding' in this scenario. But Courseplay already has that integrated in this mode, right?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/Courseplay/courseplay/issues/3820#issuecomment-502468292

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

pvaiko commented 5 years ago

Sorry, the second part was not about #2, I will look into it

On June 16, 2019 11:55:03 AM CDT, Stephan Schlosser notifications@github.com wrote:

Hey @pvaiko looks really good. Two issues though: 1: Since spec_autodrive is only available after the vehicle has once called Autodrive:onUpdate(), depending on which mod runs first (differs for each vehicle), the CP HuD often lists Autodrive as 'Not installed'. So a delayed or somehow regular check would be required here. 2: When I set the option to use AautoDrive and then start the CP driver, it resets back to 'Don't use' and I have to set it on while the CP driver is already active. I think this also happened after Autodrive returns from unloading.

Otherwise it seems to work as expected. As soon as CP passes to AutoDrive, the driver will drive to the closest/best suited waypoint and start it's route. As mentioned earlier, it might be a better solution to first drive to the first waypoint of the cp field course before passing the control to AutoDrive. But that depends also on how many waypoints are around the field and if Autodrive can always find a suitable waypoint to start the route. It is not set up to use 'pathfinding' in this scenario. But Courseplay already has that integrated in this mode, right?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/Courseplay/courseplay/issues/3820#issuecomment-502468292

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

mauma123 commented 5 years ago

I was thinking would this be possible. Everybody know courseplay do the best fieldworks but it cant change the field without player interaction (or i dont know how it works) and the auto drive calculate best those ways to get somewhere. So i think if player could put fields what player want example cultivate to queue and the and when the field is ready and tractor is back in first waypoint courseplay allow auto drive to drive tractor to second field and then courseplay take controls back and this continue so far that all player chosen fields are ready. I dont know anything about coding but this doesnt sound very big job. Of course it would be nice if it works with chaff driving too.

tozedascoves commented 5 years ago

Hi! First of all thank you for your efforts in joining CP and AD.

Like @Stephan-S said, CP resets the option of using AD. We have to select it again from the menu after the CP driver begins its work.

I only tried one time but I can't figure out how the drivers goes from unloading to the field again. Whats the best option to select in AD?

Another thing is that like @Stephan-S said maybe CP could make the driver return to the first waypoint? Or else we'll have to map various routes for AD so that the driver can reach the network.

And again thank you so much :)

pvaiko commented 5 years ago

@tozedascoves honestly, I don't know how to make AD drive back to the field again.

My problem is that I have very limited time to test, as at this point, testing is what takes most of the time.

If one of the CP/AD users would be volunteering to help testing the CP/AD interface before I release it here that would be a tremendous help for us.

pvaiko commented 5 years ago

@tozedascoves

CP resets the option of using AD. We have to select it again from the menu after the CP driver begins its work.

I have trouble reproducing this, which version are you using? Can you post a log with debug channel 12, it should show when the autodrive mode is toggled.

Knowen commented 5 years ago

@pvaiko I can help you testing the new interface.

Sent with GitHawk

Stephan-S commented 5 years ago

@tozedascoves in which mode did you set AutoDrive? For this to work, it has to be in 'Pickup and deliver' mode. Then you can set the first target as 'Field X' and the second (unload) destination as 'Unload point Y'.

tozedascoves commented 5 years ago

@tozedascoves

CP resets the option of using AD. We have to select it again from the menu after the CP driver begins its work.

I have trouble reproducing this, which version are you using? Can you post a log with debug channel 12, it should show when the autodrive mode is toggled.

Ok so I download AD and CP again deleted all the config files I had and that problem didn't appear again.

But @Stephan-S I cannot for example refill my Seeder. I have CP working on a field and selected the use Autodrive on the CP menu. Then I set the AD to Pickup and Deliver where the pickup is the field CP is working on and the deliver is the place where my seeds are.

I cannot get the seeder to refill. It stops where it should stop to refill but it doesn't so automatically. If I press 'R' it begins to refill. Is this the way it's intended?

If you need any logs let me know. Thank you

Bobster82 commented 5 years ago

My problem is that I have very limited time to test, as at this point, testing is what takes most of the time.

If one of the CP/AD users would be volunteering to help testing the CP/AD interface before I release it here that would be a tremendous help for us.

@pvaiko ,I have a lot of time to help out, I work at home and not many hours, I can easy do a lot of testing if needed. You guys are doing a great job and if I can help out in any way, let me know.

Bobster82 commented 5 years ago

But @Stephan-S I cannot for example refill my Seeder. I have CP working on a field and selected the use Autodrive on the CP menu. Then I set the AD to Pickup and Deliver where the pickup is the field CP is working on and the deliver is the place where my seeds are.

I cannot get the seeder to refill. It stops where it should stop to refill but it doesn't so automatically. If I press 'R' it begins to refill. Is this the way it's intended?

If you need any logs let me know. Thank you

@Stephan-S @tozedascoves , I have the same. All works as intended, but it doesnt refill at the trigger. Some seeders u can press "R" to refill, some seeders u need to open the cap to refill and that wont work, as u cant open the hood if CP is active.

And what to do if ur seeder can fertilize too and needs refill? Can you (@Stephan-S ) add a code when the seeder (or fertilizer) drives by the seeds/fertilizer trigger It auto start filling? So when ur waypoint is beyond the seed trigger and the fertilize trigger, it 1st stops at seed trigger, 100% fill it and continue and stops again at the fert trigger, 100% and continue to the waypoint and sees its 100% then continue to the field?

Als when the tractor with seeder needs a refill and goes off the field, it drives straigt to the nearest wp, crossing right trough the field... then when at the waypoint it just overshoots and gets himself stuck (but it does some circles and finds the route again) maybe a finetuning?

Tensuko commented 5 years ago

@tozedascoves in which mode did you set AutoDrive? For this to work, it has to be in 'Pickup and deliver' mode. Then you can set the first target as 'Field X' and the second (unload) destination as 'Unload point Y'.

Does it matter wich fruit I select for unload/refill ?

Bobster82 commented 5 years ago

Does it matter wich fruit I select for unload/refill ?

@Tensuko , In seed refill route, it doesnt matter now, as no one works atm... (I just tested all types) for pick up at silo, it does matter what u want to load

pvaiko commented 5 years ago

In the meanwhile, if anyone has a good idea for the CP HUD: I'd like to add an option to use AutoDrive to generate the unload/refill course, so you'd select an AD destination to drive to for unload or refill on the CP HUD, AD would give CP the waypoints but CP would do the driving.

Bobster82 commented 5 years ago

cp and ad @pvaiko ,With the calc icon (or make another) u get a sort of drop down list, the + and - buttons u can select too

Tensuko commented 5 years ago

That line is used for use fertilizer yes or no if I remember correct, pls check that. I would rather put that one on the 2nd page where you hire the worker, like: select destination and hire. Maybe same for sure AD or not.

Bobster82 commented 5 years ago

@Tensuko , yes ur right... I thought when u switch to use or not use ad it would be usefull to select destination on the same page... there is still a line left, or is that one used too?

pvaiko commented 5 years ago

@Knowen @Bobster82 thanks for the offer, I'll let you know when I have something to test.

mauma123 commented 5 years ago

why idont see in my game that autodrive choice?