Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG_SP] Combine unloader getting stuck off field #2828

Closed
rohne83 opened this issue Oct 3, 2023 · 32 comments · Fixed by #3037
Closed

[BUG_SP] Combine unloader getting stuck off field #2828

rohne83 opened this issue Oct 3, 2023 · 32 comments · Fixed by #3037
Assignees
Milestone

Comments

@rohne83
Copy link
Contributor

rohne83 commented Oct 3, 2023

Steps to reproduce
Use combine unloader on irregularly shaped field

Actual behavior
Depending on field shape, position of combines and unloaders, there's high chance the grain cart will drive at least parts of its way outside the field. That can be very frustrating as this mostly comes with a very high risk of getting blocked by trees, masts, fences, and even AI or AD traffic on adjacent roads. And be it just a too tight curve radius around a tree so that not the tractor but just the back of the trailer gets stuck.
Another issue coming with this is that grain carts not always approach the unloaders on the free path but sometimes circling around the unloaders off field first (and also when unloading into first trailer ended and grain cart drives to the second trailer to continue unloading) - in a quite sharp curve where at least the cart itself mostly collides with any part of the waiting unloaders.

Expected behavior
As long as possible, the grain cart should stay within field boundaries. I'd propose any waypoint on non-field texture should be rated with significantly increased cost for the pathfinder (but still less cost than waypoints within unharvested fruit ofc). So it would only drive off the field where it means a significant reduction in total way length, or where it is not possible at all to be avoided (i.e. unloader position too far away from field edge).
I bet this would also help to avoid the unloader getting stuck within field islands (i.e. Western Australia map has some problematic ones, also the water ponds on Landkreis Rostock within field 4 or between field 37+38 can be really thrilling).

Screenshots
fsScreen_2023_10_01_20_44_27
fsScreen_2023_10_01_20_44_33

Courseplay version
Version used: 7.3.1.2

Map
Landkreis Rostock here. But should apply to any map with irregularly shaped fields and not much space around those.

Vehicles/ implements involved
Which vehicle or implement? Any grain cart

Relevant script mods
N/A

Wouldn't declare that as a bug necessarily, but rather improvement/enhancement. Still haven't found out how to put the enhancement label instead of the bug label though.

@rohne83 rohne83 added the bug Something isn't working label Oct 3, 2023
@Tensuko Tensuko removed the bug Something isn't working label Oct 3, 2023
@pvaiko pvaiko self-assigned this Oct 3, 2023
@pvaiko
Copy link
Contributor

pvaiko commented Oct 3, 2023

A log would have been great, to see what actual off field penalty we used in these examples.

@rohne83
Copy link
Contributor Author

rohne83 commented Oct 3, 2023

Ok, will try to find time today to reproduce such situation with debug on

@rohne83
Copy link
Contributor Author

rohne83 commented Oct 3, 2023

Just replayed very similar situation on a smaller field. This time with log and debug activated for unloader. Luckily it didn't get stuck on a tree here, but still the way it took was quite dangerous, and the already harvested part of the field just nearby.
log.txt

Screenshots to depict it:
fsScreen_2023_10_03_15_00_33
fsScreen_2023_10_03_15_00_39
fsScreen_2023_10_03_15_01_19
fsScreen_2023_10_03_15_01_46

Hope this helps

@pvaiko
Copy link
Contributor

pvaiko commented Oct 3, 2023

Ok, for self unload we use a very low (0.1) off field penalty instead of the normal 7.5, as the comment in the code says: "use a low field penalty to encourage the pathfinder to bridge that gap between the field and the trailer".

Not sure what is the best way to improve this. We can maybe ignore the off-field penalty around the trailer?

@Tensuko
Copy link
Contributor

Tensuko commented Oct 3, 2023

We can maybe ignore the off-field penalty around the trailer?

If that is possible, its the only way I can think of fixing this.

@rohne83
Copy link
Contributor Author

rohne83 commented Oct 3, 2023

Sounds reasonable. Or would it also be possible to have a low (but still existing) penalty around trailer, and high penalty anywhere else? Just to make sure that a full ignorance of penalty won't lead to even more situations were grain cart circles around the unloader instead of just staying on the current side (most often the field side) of the unloader when driving to the second trailer/bin after unloading into first one finished and grain cart still has high fill level (only randomly reproducible, but hope you still understand what i mean). This can result in similar issue, with grain cart getting stuck at trees or more often even colliding with the unloader.

@Tensuko
Copy link
Contributor

Tensuko commented Oct 3, 2023

I prefer the reduced penalty arround the the trailer.
There is no circling arround the trailer, there is only a drive to the correct side for trailer side and pipe.
Depending on how the trailer stands towards the current grain cart position (or the field where the grain cart comes from is the closest, not sure anymore, was in FS19 when we made that).

A better graphic then I had before...
grafik

@rohne83
Copy link
Contributor Author

rohne83 commented Oct 3, 2023

I mean not when approaching the trailer coming from the combines, but when overloading to a multi-bin/trailer unloader, after finished overloading into first bin/trailer. If grain cart still has fruit loaded it will overload into the second trailer. For this most often it will drive as depicted on the left side, which is the way it should always do this. But sometimes (as said happens only randomly, but without any off-field penalty around trailer I fear this could happen more often) it is doing as depicted on the right side: it circles around the unloader, often colliding with tractor or trailer of the waiting unloader.
ulw_circling
Well, if it just went a few meters backwards (or forwards if it first overloaded into the other trailer) this whole maneuver would be unnecessary, but that's a different story.

@Courseplay Courseplay deleted a comment from BippyMiester Oct 3, 2023
@Tensuko
Copy link
Contributor

Tensuko commented Oct 3, 2023

We have a position correction, would need to check for that multi bin trailer, maybe the distance is too short for yours.

@coatsy35
Copy link

coatsy35 commented Oct 3, 2023

This would be a useful addition. I too see this issue a lot, often coming back to find trailers stuck behind trees as the tractor tries to drive down the hedgeline. Unfortunately I'm travelling a lot at the moment and can't play much to record it all for more examples.

@ph1go
Copy link

ph1go commented Dec 21, 2023

Is this the same issue? It only ever happens when the combine is on the first headland but if there's a body of water between the unloader and the combine, the unloader will attempt to drive straight through it. In this instance I've tried putting trees around the water to influence the pathfinder but he always finds a way through. It's manageable if I think about where to start the unloaders off etc but I've got a log for you if it's helpful (it's all right at the end).

Here's a video (which corresponds to this log file) and here's an image (with no log) of it happening another time:

Farming Simulator 22_2023 12 12-11 55 mp4_snapshot_00 29_ 2023 12 21_16 12 07

@rohne83
Copy link
Contributor Author

rohne83 commented Dec 22, 2023

Maybe not exactly the same, but definitely very similar and probably the same root cause (too low off-field penalty). Those ponds are even more dangerous when within the field as then even harvesters can be sunk there during pathfinder turns. Cannot count anymore how many harvesters I've lost in the pond within field 4 of Landkreis Rostock before I bought that island and spent several millions to remove this nasty pond :D In the meantime until this issue is resolved, maybe a self placed fence (with correct collision bits) could help to at least prevent the sinking in the pond if the farmland nearby is buyable.

@ph1go
Copy link

ph1go commented Dec 22, 2023

I thought about a fence but in this instance I put a few more trees in between the trees I'd put in before, making it impossible to drive between them, and he found his way without getting wet.

Farming Simulator 22 22_12_2023 23_18_54

I've created a field too close to the edge of the buyable land in another place for fences or trees so I'll either have to just be vigilant on the first headland or sacrifice a slither of field around the water so I can put obstacles in.

Is it that it's not possible to detect water? It seems like the pathfinder thinks these bodies of water are just big dips that it's ok to drive straight through.

@pvaiko
Copy link
Contributor

pvaiko commented Dec 23, 2023

I'm sure there is a way to detect water, it just did not seem to be a significant problem so far, so we did not worry about it. We usually try to stay on the field which takes care of avoiding water.

@FrozenStorm1029
Copy link

Not this exactly but i have found the the combine unloader ( when unloading onto the field ) can not pathfind when its called back to the combine due to the pile being too large (CP version is 7.4.0.1)

@pvaiko pvaiko linked a pull request Dec 29, 2023 that will close this issue
2 tasks
@Tensuko Tensuko added this to the 7.4.0.2 milestone Jan 1, 2024
pvaiko added a commit that referenced this issue Jan 1, 2024
Ignore off-field penalty around the target trailer and
use normal penalty elsewhere to keep the self-unload
path on the field.

#2828
Tensuko added a commit that referenced this issue Jan 3, 2024
- Code improvements
- Improving how root vegetable harvesters are recognized by @tn4799
- Fix silo driver park position.
- Fix for #3012
- Fix for #3034
- Fix for #2828
- Fix for #3038
- Added food mixer wagon, fertilizer/lime/manure sprayer and Göweil LT Master as valid target for shovel mode.
  - 3-point attached tools and the Göweil will be targeted from behind to fill up.
@ph1go
Copy link

ph1go commented Jan 4, 2024

With 7.4.0.2, I'm still having the same issue with combine unloaders driving through water...

fsScreen_2024_01_04_17_42_59

log - Copy (9).txt

@pvaiko
Copy link
Contributor

pvaiko commented Jan 4, 2024

We have not added water detection. Otherwise it seems to be applying off-field penalty correctly.

@coatsy35
Copy link

coatsy35 commented Jan 6, 2024

Perhaps in the next version of FS Giants might make trees and poles detectable so fields don't have to be bought and dirt painted around trees and poles to allow CP to create headlands around them as well. As when doing contracts it's annoying if the field doesn't have a painted area around each tree/pole, pretty much stop CP from working on some maps when there are lots of baling contracts in parkland type fields with loads of trees and poles. One can dream anyway 🤣

@rohne83
Copy link
Contributor Author

rohne83 commented Mar 10, 2024

We have not added water detection. Otherwise it seems to be applying off-field penalty correctly.

For me it doesn't look so. The unloader could have stayed on headlands easily, but insteat it chooses to go off-field and through the pond. I also still see situations where the unloader path goes off-field without reason.
fsScreen_2024_03_03_11_19_03

@pvaiko
Copy link
Contributor

pvaiko commented Mar 10, 2024

goes off-field without reason

There is always a reason. Without the log it is difficult to tell, but for instance, if the pathfinding fails repeatedly, we reduce the off-field penalty.

Also, keep in mind, that the off-field penalty is what it says: a penalty. It does not block driving off field, just makes it more expensive for the algorithm. So even with penalty, if driving off field is significantly (depending on the penalty value) shorter, it will drive off field.

@coatsy35
Copy link

coatsy35 commented Mar 21, 2024

@pvaiko starting happening to me on Saxthorpe last night. Managed to capture it. Surely it should have stayed inside the field in the effort? it only had to go around the corner, instead it got grounded on the hill under the hedge, trying to get to the harvester around the corner.

As a side note, when planning a route to target, can it not use the route lines of the forager to aid travel? as it can obviously access the forager lines when it's running the route as you see when it takes over unloading. That would make it travel straighter instead of the very wonky routes it currently plots back to the harvester plus would make it go around the corner? and plot longer routes around fruit easier without giving up in large fields if a headland course had been plotted.

log.txt

fsScreen_2024_03_20_21_25_06
fsScreen_2024_03_20_21_25_08

@pvaiko
Copy link
Contributor

pvaiko commented Mar 21, 2024

There are like 10 pathfinder runs in that log, I can't tell which one those is related to the screenshots (which, for some reason I can't open).

The reason we are not using the harvester's course is that it is a lot easier to just tell the pathfinder where we want to go, there is no logic to be implemented.

@pvaiko
Copy link
Contributor

pvaiko commented Mar 21, 2024

What I see is that we reduce the off-field penalty significantly (1.5 instead of 7.5) when the harvester is on the first headland to make it easier for the pathfinder.

@Tensuko
Copy link
Contributor

Tensuko commented Mar 21, 2024

What I see is that we reduce the off-field penalty significantly (1.5 instead of 7.5) when the harvester is on the first headland to make it easier for the pathfinder.

Then we will keep it like that. We sure had our reason to do this.

@coatsy35
Copy link

There are like 10 pathfinder runs in that log, I can't tell which one those is related to the screenshots (which, for some reason I can't open).

The reason we are not using the harvester's course is that it is a lot easier to just tell the pathfinder where we want to go, there is no logic to be implemented.

I've reattached them, not sure why the were not working. Sorry had two tractors of the same model unloading. Just seamed off that it tried to cut the corner like that.

@coatsy35
Copy link

What I see is that we reduce the off-field penalty significantly (1.5 instead of 7.5) when the harvester is on the first headland to make it easier for the pathfinder.

Then we will keep it like that. We sure had our reason to do this.

Would it not make sense to keep it higher as the unloader should be coming behind the harvester for headland (1)? so should never need to go off the field?

@Tensuko
Copy link
Contributor

Tensuko commented Mar 21, 2024

There are 2 types of users.
One: Want to have perfect driving unloader that stick 100% to the field no matter how the field shape looke like.
Two: Don't want to have the pathfinder calculationg for a very long time the perfect path to the target.

So we take the best way for both worlds - and no - there won't be a setting to change that (I don't want to have settings for everything so new player won't know what to do).

As long as the unloader can reach its target, its fine.

@coatsy35
Copy link

coatsy35 commented Mar 21, 2024

There are 2 types of users. One: Want to have perfect driving unloader that stick 100% to the field no matter how the field shape looke like. Two: Don't want to have the pathfinder calculationg for a very long time the perfect path to the target.

So we take the best way for both worlds - and no - there won't be a setting to change that (I don't want to have settings for everything so new player won't know what to do).

As long as the unloader can reach its target, its fine.

Yes I understand that. But it’s stupid if it gets stuck crossing out of a field. It should never go outside the field boundary in my opinion. Lots of maps have water etc… in the way. Stay in the field should mean stay in the field. Should be an advanced setting. If new people get confused with settings then they shouldn’t use advanced.

I understand your dilemma though, keeping it simple enough for the masses.

@Tensuko
Copy link
Contributor

Tensuko commented Mar 22, 2024

A setting will not be added.
What we can do is reduce the off field penalty reduction on each try, but nothing more!
It will easy end up in no path found and thats also not what we want.

Stay in the field should mean stay in the field.

It is TRY to stay on the field!

@pvaiko
Copy link
Contributor

pvaiko commented Mar 22, 2024

Yes I understand that. But it’s stupid if it gets stuck crossing out of a field. It should never go outside the field boundary in my opinion. Lots of maps have water etc… in the way. Stay in the field should mean stay in the field. Should be an advanced setting. If new people get confused with settings then they shouldn’t use advanced.

It is all in here in this function, reducing the off-field penalty for the first two headlands, to improve the success rate of the pathfinder in these cases, to give a little more space to the pathfinder. If you want you can play with those factors to see if that helps. Maybe one fifth for the first headland is too aggressive.

function AIDriveStrategyUnloadCombine:getOffFieldPenalty(combineToUnload)

@rohne83
Copy link
Contributor Author

rohne83 commented Mar 22, 2024

There already is a setting for turning on field, with similar effect. Maybe this could also be used to influence the off-field penalty for unloader's pathfinder? Quite low if deactivated for quicker pathfinding, quite high when activated to force the pathfinder to an inside-field path which might definitely be needed when you have many obstacles or even water ponds near the field edge.

@Tensuko
Copy link
Contributor

Tensuko commented Mar 22, 2024

Not a good Idea to use a setting that is for something complety different.
To clear this up a bit: "turn on field" is if the turn can be driven in reverse or not. Back then it was just named like that to make sure what it does. It is not pathfinder related at all, so won't use that. There won't be a setting to adjust the off field penalty!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants