Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Courseplay Autodrive kurse rückwärts erkennung #7026

Closed
Tom20214 opened this issue Mar 22, 2021 · 14 comments
Closed

Courseplay Autodrive kurse rückwärts erkennung #7026

Tom20214 opened this issue Mar 22, 2021 · 14 comments
Assignees

Comments

@Tom20214
Copy link

Ist es möglich das Courseplay auch die Rückwärtskurse von Autodrive erkennt? momentan erkennt er die Rückwärtskurse als Vorwärtskurse und fährt z.b vorwärts in das Keilsilo rein

@pvaiko
Copy link
Contributor

pvaiko commented Mar 22, 2021

@Stephan-S we call GetPath() which returns a list of waypoints, how do we know if a waypoint is reverse? CP currently recognizes .rev or .reverse being true.

@Tensuko
Copy link
Contributor

Tensuko commented Mar 23, 2021

@Axel32019

@SeriouZ12
Copy link

Ich kann dir hier raten den Kurs einmal aus Autodrive zu erstellen, abzuspeichern und dann mit dem CP Editor die Wegpunkte zu ändern. Damit kann man z.B. auch einen Ballen Sammel Kurs erstellen und ihn irgendwo auf der Strecke abladen lassen.

@pvaiko
Copy link
Contributor

pvaiko commented Mar 26, 2021

@Tom20214 hast du AD Kurse mit rückwärtsfahren?

@Axel32019
Copy link
Contributor

Axel32019 commented Mar 27, 2021

Hello Peter @pvaiko, @Tensuko,
AD returns a list of waypoints only, there is no explicite information in this table if forward or reverse direction, but:

  • each waypoint contain an .incoming table (if not empty) for previous waypoints
  • each waypoint contain an .out table (if not empty) for next waypoints

To get the start and end of a reverse part of the waypoints table the following snippet might help:

function ADDrivePathModule:checkForReverseSection()
    local reverseStart = false
    local reverseEnd = false
    if self.wayPoints ~= nil and #self.wayPoints > self:getCurrentWayPointIndex() + 1 and self:getCurrentWayPointIndex() > 1 then
        local wp_ahead = self.wayPoints[self:getCurrentWayPointIndex() + 1]
        local wp_current = self.wayPoints[self:getCurrentWayPointIndex() - 0]
        local wp_ref = self.wayPoints[self:getCurrentWayPointIndex() - 1]
        local isReverseStart = wp_ahead.incoming ~= nil and (not table.contains(wp_ahead.incoming, wp_current.id))
        local isReverseEnd = wp_ahead.incoming ~= nil and wp_current.incoming ~= nil and table.contains(wp_ahead.incoming, wp_current.id) and not table.contains(wp_current.incoming, wp_ref.id)
        local angle = AutoDrive.angleBetween({x = wp_ahead.x - wp_current.x, z = wp_ahead.z - wp_current.z}, {x = wp_current.x - wp_ref.x, z = wp_current.z - wp_ref.z})
        angle = math.abs(angle)
        if angle > 100 and isReverseStart then
            reverseStart = true
        end
        if angle > 100 and isReverseEnd then
            reverseEnd = true
        end
    end
    return reverseStart, reverseEnd
end

@pvaiko
Copy link
Contributor

pvaiko commented Mar 27, 2021

@Axel32019 thanks, not sure I understand what exactly the meaning of the incoming and out parts is, are these tables (and not a single reference to the next/previous point) because the course is forking/merging?

I could just look at the angle (which we have in our course anyway) and that could probably work fine, as long as an AD course never starts in reverse.

@Axel32019
Copy link
Contributor

@pvaiko Hallo Peter, You got it - incoming and out are tables. They keep the point(s) to the previous/next point, but for reverse "coding" the incoming will not have the previous point, the previous will have this point in out. Special way to store the points without the need for additional information if it is reverse direction.
For the reverse end seee above.
The approach to look at the angle might be a good first step.

pvaiko added a commit that referenced this issue Mar 28, 2021
Trying to figure out where should the course be driven in reverse,
based on the angle difference between two subsequent waypoints,
similar to what AD does internally.

Quite a fragile process, not really happy with it.
@pvaiko
Copy link
Contributor

pvaiko commented Mar 28, 2021

@Tom20214 da du keine AD Kurse zum testen gepostet hast musst jetzt selber auf dem issue-7026 Branch testen :)

@Tom20214
Copy link
Author

Tom20214 commented Mar 28, 2021

@pvaiko https://youtu.be/QUCMvf2lr_I besser könnte es garnicht funktionieren, danke das du es eingebaut hast.

@Tom20214
Copy link
Author

Tom20214 commented Mar 28, 2021

@Tensuko
Copy link
Contributor

Tensuko commented Mar 30, 2021

Was soll uns das 2te Video sagen ?
Wenn der Kurs den wir von AD bekommen nicht richtig passt und wir den Trailer nicht anständig rückwärts schieben könnne, weil er vorher nicht gerade genug in die Richtung stand, ist das ein Problem vom erstellten AD Netzwerk :)

@Tom20214
Copy link
Author

@Tensuko Das soll zeigen das auch mit Anhänger funktioniert.

@Tensuko
Copy link
Contributor

Tensuko commented Mar 30, 2021

Ah okay :)

pvaiko added a commit that referenced this issue Apr 3, 2021
Trying to figure out where should the course be driven in reverse,
based on the angle difference between two subsequent waypoints,
similar to what AD does internally.

Quite a fragile process, not really happy with it.
pvaiko added a commit that referenced this issue Apr 3, 2021
Trying to figure out where should the course be driven in reverse,
based on the angle difference between two subsequent waypoints,
similar to what AD does internally.

Quite a fragile process, not really happy with it.
@Tom20214
Copy link
Author

Tom20214 commented Apr 3, 2021

@Tensuko Da es nun einwandfrei funktioniert mach ich die issue jetzt zu.

@Tom20214 Tom20214 closed this as completed Apr 3, 2021
pvaiko pushed a commit that referenced this issue Apr 18, 2021
*  Mode 6 re-enabled for Kuhn Discolander, fixes #7023

    The fix for #6912 screwed this up. Instead of enabling all foldables
    for mode 6 and disabling sprayers/sowing machines, just enable
    tension belts, that should cover auto bale loader trailers.

*   Working width setting by 0.1 increments fixes #5997

    Working width can be set by 0.1 increments over 10 m when holding
    down the left Alt key.

 * MapHotspot improvements

    - moved setting to global settings
    - simplified setting
    - improved start/stop CP multiplayer code

*  Fixes a click to switch bug.
    Where the player farm ID after entering a vehicle was not set correctly in SP.

*  Check for exact fill nodes before using them (#7060)
    Fixes #7006

*  Reverse for AD courses #7026 (#7061)

    Trying to figure out where should the course be driven in reverse,
    based on the angle difference between two subsequent waypoints,
    similar to what AD does internally.

    Quite a fragile process, not really happy with it.

*   Fix AD compatibility (#7066)

    - Added explicit interface functions to stop/start the CP driver
    - When stopping/starting just check if CP is driving, don't worry about getIsAIActive()
    as that can be anything, especially when other mods setting it.

*  Salford Plow:
    Removed 'noReverse' as it tourned out it can be pushed backwards in 90 and 180 degree turns very easy.

*   Making the cotton harvesters work (#7077)
    - Some of them won't lower the cutter, for those, just lower manually before starting the CP driver.

*  Mode 2 fix for trucks #7074 (#7078)
    - check truck's own fill level, not just trailer

* Action event rework

- created new ActionEventConfig.xml file.

* small pr improvements

* fixes MP bug, when autodrive starts a CP driver.

Co-authored-by: Tensuko <theta-darkphoenix@gmx.net>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants