Courseplay / courseplay

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

Feature Request: Turning radius option missing for Mode 2 #5350

Closed Sarioah closed 4 years ago

Sarioah commented 4 years ago

As in the title. Turning radius option is missing when using Mode2, and is necessary to specify when using some of the larger auger wagons or long PTO - driven grain trailers.

Incidentally, CP sometimes ignores the specified radius when using some of the larger seeders during fieldwork, if I was to open an issue about that what debugs what I need to record?

TinyCrocodile commented 4 years ago

I had the same issue with vanilla valtra N and T in combination with modhub Fliegel tmk 266 bull trailer. The pathfinder is generating a too small turn. This resulted in the tractor missing the turn and crash into comine or getting lost and driving uncontrolled to the end of the map. Did not have time to gather the infos required for this issue but i will report here asap. The automatic calculation is based on some Infos of the model is that correct? This is then entered in courseplay:generateTurnCircle(vehicle, center2, intersect2, stopDir, turnInfo.turnRadius, turnInfo.direction, true); As turn radius correct?

pvaiko commented 4 years ago

@Goof245 debug channel 6 shows the vehicle data calculations including the turning radius.

CP uses the functions provided by the Giants AIVehicleUtil class to get the turning radius. For implements, these functions may need the turningRadiusLimitation defined in the aivehicle part for the implement's XML so in case of sowing machines, that's what I would check first.

For attached implements which are not aiimplements Giants uses some vehicle geometry data to calculate the turning radius, as far as I can tell.

@TinyCrocodile courseplay:generateTurnCircle() is only used for generated turn courses. For the pathfinder, it is one if the inputs for the functions in HybridAStar.lua

Sarioah commented 4 years ago

OK thanks, initial look seems like it's detecting those aiVehicle parts if they're there, but for some modded stuff it's just missing. For tools where it's missing I guess I can just add it to the .xml and hope the auto calculation works... I'll have to try that with the problematic chaser bin tomorrow.

For some tools where that data is definitely there (like the 25m seedhawk), it just seems CP ignores it (on both auto and manual turn radius settings) and tries to turn as hard as the course specifies. Small tractors slip or manage to pull it around, but big tractors often have enough power to lift the inside wheels and just crash the whole combination together..........but i digress.

pvaiko commented 4 years ago

it just seems CP ignores it (on both auto and manual turn radius settings)

How do you know it ignores it?

Sarioah commented 4 years ago

seedhawk.txt 20200511111414_1 50m manual radius is illustrated roughly by the 48m Rubicon sprayer. 1050 tractor is clearly turning tighter than that; the steering is at full lock and the drawbar is binding against its right hand limit. Tractor was on mode 4 at the time.

Incidentally, I ran that course on mode 5 just to see what it would do, and it looks to be taking a much less aggressive turn at the end, when it finishes the course and has to find its own way back over to the first waypoint to start again. Drawbar is not on its travel limit during this turn. 20200511112343_1

pvaiko commented 4 years ago

The auto turning radius is used when generating turn maneuvers, during pathfinding and when generating a course with round corners.

Not sure how that course on the first screenshot was created. On the second one, the path to return to the first waypoint is generated by the pathfinder so it should take the turning radius into account.

Sarioah commented 4 years ago

Course generated by just driving in a loop while recording to make an example sharp corner. CP in prior versions would respect this radius and drive wide trying to follow that course. If this was changed deliberately we really need an option to turn it back on where needed...

Here's a course generated with a 50m manual radius. Tractor is in a turn maneuver, oestensibly giving no thought about his 50m turning radius limit. 20200511115439_1

Sarioah commented 4 years ago

log.txt Replicated the above screenshot, but with the base game/DLC and a log.

Maybe more debugs than is necessary, but not sure which ones we need here so ¯\_(ツ)_/¯

pvaiko commented 4 years ago

Course generated by just driving in a loop while recording to make an example sharp corner. CP in prior versions would respect this radius and drive wide trying to follow that course. If this was changed deliberately we really need an option to turn it back on where needed...

Which was the last version it worked the way you describe? Can't think of anything ever in CP would limit the turning radius in the situation on your first screenshot.

Regarding you last screenshot, you lost me there. You are showing a turn maneuver and CP may be ignoring the manual turn radius but I'd be lot more interested in what the auto turn radius is and how it works with that. Also, unless you select the round corners, it does not matter what turn radius is selected. Was this course generated with the round corners?

Sarioah commented 4 years ago

CP5? maybe? It was a long time ago.

CP may be ignoring the manual turn radius but I'd be lot more interested in what the auto turn radius is and how it works with that

It's right there in the log; 18m. Causes the drawbar to jacknife and the tractor forcefully drags the front of the tool around.

Also, unless you select the round corners, it does not matter what turn radius is selected. Was this course generated with the round corners?

Smooth corners were set. Curious though why CP's behaviour is to respect the radius only during a select few maneuvers? If I've decided to set a radius manually, it's because I know from experience with that particular tool or combination of tools that the auto setting is going to cause problems. The manual setting then must be respected. Anything to the tune of "ok for this maneuver tractor should be turning at the user set radius", "now we'll ignore the radius for this turn because somehow the tool geometry has changed and it's OK now to turn tighter???" seems like nonsense?

Sarioah commented 4 years ago

Incidentally, adding the missing aiVehicle part to this tool's XML resulted in CP creating paths it can actually follow during mode 2, which is great. Thanks for making me aware of this field :) 20200511130015_1 CP version here is 6.02.00011 as per the autoupdate powershell script.

TinyCrocodile commented 4 years ago

Great! This will be the same for my machines.

TinyCrocodile commented 4 years ago

Assuming one is harvesting with a 6m header on a forage harvester and working on the headlands. Pathfinding and turn on field are activated. The Mode 2 driver is following behind the combine as it is suposed to do, on headlands. Now he gets full and the turning radius of the equipment is set to 10m. What will the pathfinder do? Ignore the fruit or ignore the field boundaries?

pvaiko commented 4 years ago

@TinyCrocodile the current pathfinder never ignores the turn radius, that was the whole point of implementing it, so it'll always generate a drivable path. This is why it is slower now.

It will only ignore fruit when the (confusingly named) 'pathfinding' option in the HUD is deactivated, I think that needs to be renamed to 'avoid fruit' or something.

Field boundaries are more or less ignored, the pathfinder prefers a path on the field but that's all, as long as a path is obstacle free, it is still ok.

wallsingham commented 4 years ago

I want to use the long trailer to pick up bales. However, it does not turn properly. I already have this entry in the XML of the trailer:

<ai>
        <allowTurnBackward value="false"/>
        <turningRadiusLimitation radius="7"/>
</ai>

Here is the Log und some Screenshots.

Turn-Fehler-LOG.txt

grafik

grafik

grafik

TinyCrocodile commented 4 years ago

@wallsingham i think he tries to drive backwards to begin the work at the begining of the row. drive backwards is not supported with multiple trailers.
How ever he did generate a turn radius wich looks like it is 32m and respecting the manual turn setting. In mode 2 is no manual tur radius setting so he will allways use the auto turn radius for now. If you plan to use this trailer in mode 2 i recomend to change the `

    <turningRadiusLimitation radius="7"/>

` to a larger value.

My trailer was missing the ai part. I added it and will test soon. @pvaiko is CP also using the <allowTurnBackward value="false"/> somwhere?

pvaiko commented 4 years ago

@TinyCrocodile only for turn course generation and to check if a simple AI Turn (3 point) turn is possible. All this in modes 4 and 6 only.

wallsingham commented 4 years ago

@TinyCrocodile: This setting helps so that the vehicle does not have to drive back. The last point of the turning maneuver (118) is now after the penultimate one (117)

grafik