Courseplay / courseplay

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

Question/Info about Convoys #6085

Closed cyberndj closed 3 years ago

cyberndj commented 3 years ago

Howdy,

I'm looking into some information how to set up a convoy with different vehicle types.

Current set up: -A 2k+ acre field with 7 Combines and 7 Pickup Wagons. -Course generation page is set with Headland:Around, Headland passes:1, Multiple Tools:7, Working width:13.7. -Each combine is set up with a max distance of 200m, Convoy active, 1 to each lane started from first waypoint in the following order: 3 Left, 2 Left, 1 Left, Center, 1 Right, 2 Right, 3 Right. -3 Auger Wagons set to all 7 combines unloading into trucks just off the field. Off we go, into the wild blue yander...laying down a fat swathe of golden straw for each harvester.

It becomes fun with the Pickup wagons. -Each tractor only has the pickup wagon with a working width of 2.4m. -The course is loaded and then an offload course is merged to a silo/sell point. -The wagons are set off in the following order, Center, 3 Left, 2 Left, 1 Left, 1 Right, 2 Right, 3 Right. -Max follow distance of 150m. Off we go, into the wild blue yander...

-> But wait, the wagons arn't following in the same lanes as the harvesters, their in their own 2.4m lanes vs the 13.7m harvester lanes.

-> To fix this, I go into each one of the pickup wagons and set the Tool offset horizontal values to align the wagon to the fat golden swathes.

So my question, is this the proper way to do the pickup wagons, or should the wagons be following the harvester lanes?

Thanks! -Cyberndj

GeorgeEarslight commented 3 years ago

Use the "Copy course" button from the harvesters on the straw pickups.

cyberndj commented 3 years ago

Hi George,

I didn't use the copy course function on the pickups, but I did save the course from the first combine I used to generate the course. Loaded it from the courses page on the remaining combines and pickups.

I did just do a quick test. I cleared out the course on a pickup. I copied the course from the menu on the CP Controll page from one of the combines. I checked the working width and it was set to the working width of the combine (13.5). I went to the Course settings page and set the lane to the farthest left lane. Checked the working width and it remained at 13.5. I started the course from the next nearest waypoint. I saw that the pickup didn't go to the farthest left harvester lane. Looked at the working width and it was set to 2.4m.

Tried to set the working width manually to the 13.5 and could only set it to 13 or 14. I think i remember seeing a different issue open for not being able to set tenths past 10...

GeorgeEarslight commented 3 years ago

Did the working width on the pickup (2.4m) have any effect on it following the course? Since the course is already generated I'm assuming the AI Driver shouldn't care about it.

cyberndj commented 3 years ago

Hi George, It looks like the pickup wagon does follow the course. It looks like it offsets to a lane of the the wagon, not the 13.5 width from the combines. I made a video where I went through each of the settings pages on both the combine and wagon. Let me know if you want to see more.

https://youtu.be/Q7uQeMTRQcw

GeorgeEarslight commented 3 years ago

@cyberndj Thanks for the video. I think that when the AI Driver starts, it forces the calculated working width instead of using the user setting, thus messing with the lane offsets. You had already pointed that way, but this is not something I remember from when I was playing around with convoys some time ago. I'll try to help out the guys by digging around the code, no need for more footage, thanks!

GeorgeEarslight commented 3 years ago

@Tensuko This creates issues when for some reason (like above) the user needs to have his work width unchanged. https://github.com/Courseplay/courseplay/blob/b4fd940684bd18408e36f2bd05f4f7322c6a06a4/toolManager.lua#L62 This is more of a management issue, Peter can decide how he prefers to deal with it.

Thorn177 commented 3 years ago

Some observations that may be related. I typically reduce the working width of my lanes to the lowest value before CP adds an extra lane to the field work and have been aware for some time that the multi tool calculations don’t straddle the center of the adjusted lane width. When I run an even number of tools, it is obvious that CP is using the true width of the tool to calculate the lane paths, as the two innermost tools run their inside edge along the course markers with no overlap. For this scenario, I’m harvesting a crop that produces a straw swathe, using two harvesters with a 13.5m header, and two loading wagons with a working width of 2.4m. On this field, the lane width was adjusted to 11.9m on harvesters. The course was setup as 2 tools, no headland, just a simple up and down. Because the true width is used, this leaves the straw swathe 6.75m from the course marker, not 5.95m. Copy the course to swathe loading wagon with a tool width of 2.4m, and they do the same, run their inside edge along the course marker, totally missing the straw swathe. It is impossible to get a good result using the original course. You have to pick left or right lane offset because of the original course. I have tried various tool offsets 6.8, 6.7, 5.5m(half the difference between the true widths of header and loading wagon) and a few slightly more outlandish ones. All lane changes will be asymmetrical. You can get one direction right, but it will miss in the other direction by 2.4m. Switching symmetrical on or off simply switches which direction gets missed. I get the best results by making a new course with a single tool, with a width of 23.8 (double 11.9m of the original lane width). Setting a lane offset does nothing, it simply follows the course, with no offset at all. A tool offset of 6.7 or 6.8 now works, but all the lane changes are asymmetrical. Apart from the lane offset not working with the single tool course, I don't view this as a bug, but just how CP works.

cyberndj commented 3 years ago

Hi @Thorn177

A tool offset of 6.7 or 6.8 now works, but all the lane changes are asymmetrical.

Good points about the lanes. I do the same with wagons/balers, setting the tool horizontal width appropriately with asymmetrical lane changes. This method seems like its the best way so far to get straw collection consistently lined up with the harvesters.

Here is how I understand how the lanes are created. Each lane width is calculated from the "Working width" in the course creation page. The number of lanes is created from the "Multiple tools" selection in the course creation. The lanes are aligned/centered to the combined center most width of all lanes. Each tool's working width is calculated and lane assignment is calculated from the center line. Each tool works based on the center of its own lane.

I suck at coding, but hopefully I can contribute with a rough draft Wiki page for Convoys and can incorporate some of this into it. https://github.com/cyberndj/courseplay/wiki/Convoys

GeorgeEarslight commented 3 years ago

FYI there's a very well made documentation page on the FS17 version. https://courseplay.github.io/courseplay/en/index.html Some modes are very similar to FS19, convoys being one: Go to FAQ - How to use the offset? — a.k.a. how do I let multiple vehicles drive a fieldwork course?

pvaiko commented 3 years ago

@GeorgeEarslight thanks for looking into this, can we summarize what the current behavior is and what the expected would be? I know the width calculation is a mess in CP.

@cyberndj we'd love to have more contributors to the documentation.

Tensuko commented 3 years ago

Simple: 2 Combines, each 10m. Generate course for both, so choose tools on field: 2 Course for 2x10m generated, means 20m width. Each Combine will have left/right, wich in the background is 5m offset. (10m workwidth/2 = offset to course) No Problem so far, works just fine...

But when you load the same course for e.g. baler, wich have lets say 3m work width, the left/right will be 1,5m (3m workwith/2 = offset to course) so you won't end up on the straw swath, wich ofc lies 5m left and 5m right of the course. Changing the workwidth in the HUD got no effect for the offset generated course, I think thats the main Problem here.

GeorgeEarslight commented 3 years ago

@pvaiko Tensuko summarized this very well. The human player cannot use tools with different working widths than what the multiple tool course was generated with (eg harvester-straw collector). The cause is the permalink code in toolManager.lua where the working width is recalculated when the AI driver starts working.

https://github.com/Courseplay/courseplay/blob/b4fd940684bd18408e36f2bd05f4f7322c6a06a4/toolManager.lua#L62

pvaiko commented 3 years ago

@GeorgeEarslight for calculating the offset course though we use courseplay:getWorkWidth(): https://github.com/Courseplay/courseplay/blob/94d959d8c7754f631e99a4d13b2fea650d85f1c7/FieldworkAIDriver.lua#L703 so wouldn't this fix just be using the manually set width here?

Let me look at this, as the comment says: https://github.com/Courseplay/courseplay/blob/94d959d8c7754f631e99a4d13b2fea650d85f1c7/FieldworkAIDriver.lua#L699

GeorgeEarslight commented 3 years ago

@pvaiko It makes sense, but I would need to debug. I can't tell by memory which of courseplay:resetTools or FieldworkAIDriver:setUpCourses is called last. I'll be at home in a couple of hours.

GeorgeEarslight commented 3 years ago

@pvaiko You were right. Replaced courseplay:getWorkWidth(self.vehicle)with self.fieldworkCourse.workWidth/self.vehicle.cp.multiTools and worked great. I wonder how many hours you've worked on CP.

I understand the reasoning behind tool reset, but I think it should only occur when attaching an implement. If the width changes via user input, CP shouldn't touch it.