Course generation and starting direction #1793
Comments
I'm not one of the developers but started working on this exact problem a few weeks ago. By now I think I have a solid solution and at this time the biggest task ahead of me is to integrate it with Courseplay. You can see an example of the generated course for Field 9 at Coldborough Farm at http://vajko.name/field9.png. What my extension does:
So far I was working with field data dumped to the log file and with Courseplay saved courses and use LOVE to visualize my results. I'm pretty much ready to start the integration with Courseplay and was just going to ask the developers if they are interested in this and are willing to give me minimum support. (I develop software for a living and pretty confident that can handle a lot myself, but if someone experienced with FS17 and Courseplay can give me a few pointers that can immensely speed things up as I don't have to reverse engineer everything) As for the integration, my thought was to use the vehicle's position and heading to define the starting point and direction of the headland path (that is how my current implementation works, if you look at the screenshot the purple circle with the line represents the vehicle). Again, I'm more than happy to share this work and spend time on the integration if the developers would like to do so. (Deutsch ist auch kein Problem) Peter Here is another example, Field 8 in Coldborough Farm. The red line is the path from the last headland path to the center of the field: |
Does your solution skip any fruit on the turns? This is my pet peeve with headlands and CP, but I can live with. However, if you have a solution, I think they ought to take a look at it. |
That's exactly what I was looking for and more. |
It will skip fruit on the headland just as the existing CP course, I know, it is annoying, but I was focusing on the parallel tracks in the center of the field. Let's see if I can get this one integrated first. |
This could be very nice to have - especially in mod maps, where there is less though on angling the fields in parallel to N/S/W/E |
Awesome! How can I help you test it? |
Thanks, it'd be extremely helpful if you could do that. |
Yes, sounds very good. |
@pvajko it looks grate what you did on it. Would you also be able to optimize the headland generation ? |
I'm more than happy to work on adding it to CP, whenever you tell me you are ready for it. In the meanwhile I wrap up the current solution so saved courses can be loaded and regenerated. That way we can start testing it in multiple maps if there are volunteers... Would love to give a try to improve the headland generation too. What exactly would you want to optimize? I know one issue is the corners where we don't cover 100% of the field. |
@Satissis & @pvajko I will volunteer when you're ready to test it - especially if you're willing to try and get it to stop skipping fruit on the headlands. Just let me know what I need to do. |
Yeah the corners a the biggest problem, and then the transition from 1 headlane to the next one. Hope this gives you some ideas. |
For offline course generation I have now a lua script which lists the saved courses found in a folder, can make a copy of a selected one (also updating the courseManager.xml file) and open the course generator window where you can adjust some parameters and then save it: The tool needs a lua interpreter and the LÖVE graphical framework (https://love2d.org/) Question to those interested in trying, would you prefer to
|
@pvajko that looks great thanks for diggin into this.😀 |
@pvajko I think a zip would be best for me. |
@pvajko which ever one is fine by me, but maybe zip would be best. |
i'd like to be included in testing |
@yitzh4k @lcc1211 @gec100 @debejerry @gammelgaard52 @Satissis I uploaded a Windows version which should have everything you need to run it: http://vajko.name/coursegen.zip I have no access to Mac computers, but I'm happy to work with someone who has to create a Mac version. I really appreciate if you try it and let me know your thoughts, the bugs you find and ideas for improvement. Hope it won't be frustratingly buggy... Here is the README file in the zip: Fieldwork Course Generator This tool is a preview of an extended course generator and It is a standalone tool, that is, currently you won't be Note that you can only load fieldwork courses with a headland You can then load this customized course in the game just What this preview does:
Upcoming features:
InstallationTo install, just unzip to any folder. The package is for Windows and contains everything needed This is the Windows version, I don't have access to Mac To install, just unzip to any folder. Usage
for the Coldborough Farm map. Make sure there is no \ at the very
Thanks for giving it a try. If you have any problems, report it on Peter |
now only if CP would reload the save folder somehow so i do not have to exit the game every time :) |
@gec100: first of all, thanks for checking it out. |
@gec100 I think it will reload the folder when you save a filter or another course.
|
Nop it does not. that's in a separate list which it shows. (Or it's an unintended bug that could be intended :P) |
I tried to install per your directions, but Norton thinks none of the files are safe and has quarantined all of them. |
Sorry to hear that.
This file is part of LÖVE (love2d.org), the graphics framework I added
to the package for convenience. Obviously, I can't guarantee it's safe
although I don't think it would do any harm.
Either you tell Norton it is Ok or I can provide a script only package
which assumes lua and love are in the path which means you have to
install them yourselves.
|
Looks indeed very interesting... I'll go and test it now :D |
Thanks. Make sure you test the latest release at https://github.com/pvajko/course-generator/releases/tag/v0.2 |
Just changed it to postponed until after Release. |
A quick update on this: I forked to work on the integration (https://github.com/pvajko/courseplay) and the first tests went very smooth, I changed the CP course generation to use https://github.com/pvajko/course-generator when there is a headland and was able to generate and save courses from within the game. Not sure how to set up the HUD for the new generator. The easiest would be is to add a new option to the Starting corner: vehicle location. If that's selected, the direction would be disabled and CP would use the new generator. In every other case it'd use the old one, at least until we are sure the new is stable enough. |
Simplest would be the best. My only problem with vehicle position would be having to drive the field for this to work. Maybe instead use part of the old the old system has the limits for the new one. So for example if a user selects SW your course generation is limited to 180 to 270. and selects the longest line between those degrees and to keep using the old systems have 3 options. North or East for this example(Old System) Longest Line(New) How hard of a hit is this on CPU performance? How are headlands coming along? |
Not sure what you meant by that, I guess I wasn't able to explain clearly what I was thinking. So, the new algorithm has two distinct features:
In the current implementation the user has no control over the angle (but has a million parameters to tweak). The algorithm is working with a 1 degree resolution and I see no performance issues with it, lua seems to be great at this type of computation. It would be easy to limit the algorithm to any angle or range of angles or a coarser resolution. As for the start of the headland, for irregular fields one should be able to define the start location anywhere (for example near the gate to the field). One way (the easiest from the coding perspective) is use the vehicle: drive to the field, you don't have to be on the field, only near the location where you want to start the headland and generate it there, you'll immediately see the markers if you have it turned on and have feedback on the start location. The other alternative would be to use a map, for example the CP course view map and click the start location there. I think the algorithm is pretty flexible, so everything you recommend seems doable, I'd also prefer to add one or two parameters for tweaking, for example the overlap for the headland. |
My only problem with starting the headland in any location is where is the initial up down course going to be. If it is not reasonably close to the end or beginning of the headland course CP can't handle that in its current setup. Adding the mouse to the map and having a interface would be a good idea tho I am not to sure of how hard this would be(@Satissis area of expertise) and you would still have the initial problem. Also Satissis might have plans for making 90 degree turns some time in the far future. I don't know if we want to setup the system to handle this at one point in time. With what I was talking about using the old system is to define which corner you would like to start in and have CP stay with in that comer but adjust so you don't have the initial problem. |
My course generator connects the end of the headland with the start of the up-down course with waypoints. If you scroll up in this page, that red highlighted part is this connecting section. The only problem at the moment is that there is no way to turn on/off the combine or implement for this section, see also pvaiko/course-generator#3 on this topic. But other than, it works fine, vehicles travel happily over to the beginning of the up-down tracks. The way it works now is that the course continues in the direction of the headland (cw, ccw) on the innermost headland until it reaches the first point where it can start the up-down tracks. In a field with a convex solution there are four such points and where they exactly are depends on the selected angle.
My problem with this is that some fields just don't really have a corner and it is hard to predict where exactly for example SW corner will be on an irregularly shaped field, see some examples above. I'd prefer to somehow keep the ability to pick any location to start, but of course, I'm happy to implement whatever you guys find useful. |
So you generate way points from the end of the headlands maneuvers to the beginning of the up down? Over top the headlands course. Because my big concern is if the up down start requires a U-Turn get going in the right direction. CP can't handle this situation unless you make a turn maneuver there. In regards to the
I don't think this would be possible with out some serious reprogramming of core code. That's why the current system doesn't have that gap. That's why I'm of the opinion that the user should select the general area and CP adjusts the start location with in limits of that general area to remove that gap. But if you can handle driving back to start of up down then using vehicle position or map gui would be the best if we want to give the user that option.(GUI would have to wait for Satissis opinion) |
Yes sir. That's exactly what I do. The only drawback at the moment is that there is an area which will be worked twice, for a combine it's ok, for sowing/fertilizing, etc. you are wasting some money. I think that even if there is no turn on/off possibility, I can come up with something to eliminate this inefficiency, for example by not staying on the headland but move inwards as if there were another headland until we reach the start of the up/down tracks. |
Yea from a coding perspective and user experience that would be easiest and best to have a partial headland on un-worked field back to the start of the up down. And adjust the updown so you don't have overlap. Assuming this isn't hard. This will also avoid a potential conflict of overlapped way points(AKA you save in the middle of this part and launch the game again you wont have a conflict.) |
That's a good point with the overlapped waypoints. I'll see what I can do. |
I made a first usable version with the new generator integrated at https://github.com/pvajko/courseplay, see the last commit:
BTW, that partial headland generation is not trivial, it is a chicken and egg problem, need to think about it more. |
If this is stable and your are happy with go ahead a make a pull request. I will get @Satissis to look over it and see if he approves. Thanks |
Thanks, I'd wait a bit and see if some of the guys test it, I created a new release over there at https://github.com/pvajko/course-generator/releases/tag/v1.0-with-courseplay. I have two questions though:
|
Fixed some integration/packaging issues with the release: https://github.com/pvajko/course-generator/releases/tag/v1.0-with-courseplay. |
Rainy afternoon today so made some tests, found a bug when working on fields with really sharp corners (like 20 degrees), that's fixed now. However, one thing is clear: before I make pull request I need to implement graceful handling of errors and pop up a message that the course could not generated with the current settings. |
A marker for the continuation of #2124. |
Just found this too, i was gonna report it but you beat me too it :) I have been testing all day and what you have done is very good. |
I think i answered my own question, where i just generated a course again with the harvester width from a approximate location similar to the deleted course and it seems to be OK |
Sorry for the delayed response. I would have to ask @Satissis about that. He is the one that handles file organization for CP. Has for documentation usually we will just comment it in the code. If it is to verbose to be put into the code. I will ask the rest of the CP team what they think about that. |
New course generator now merged to master. |
The latest information I could find from the devs regarding the implementation of directions beyond the N-S-E-W so that the paths could be aligned to irregularly aligned fields dates back to January 2, and I am wondering if there is any news regarding its feasibility.
The text was updated successfully, but these errors were encountered: