pyoscx / scenariogeneration

Python library to generate linked OpenDRIVE and OpenSCENARIO files
Mozilla Public License 2.0
267 stars 83 forks source link

Spiral KappaStart/ KappaEnd #235

Open wendy0527 opened 4 months ago

wendy0527 commented 4 months ago

how to solve the start and end curvatures by fitting many points(xi,yi) ? Can you explain,the following code got multiple spirals using two points. ` def road(self, **kwargs): start_x = 0 # x coordinate at the beginning of the curvature start_y = 0 # y coordinate at the beginning of the curvature start_h = 0 # heading at the beginning of the curvature

    end_x = 150  # x coordinate at the end of the curvature
    end_y = 20  # y coordinate at the end of the curvature
    end_h = 0  # heading at the end of the curvature

    clothoids = pcloth.SolveG2(
        start_x,
        start_y,
        start_h,
        xodr.STD_START_CLOTH,
        end_x,
        end_y,
        end_h,
        xodr.STD_START_CLOTH,
    )
    # create spirals from each responce
    roadgeoms = [
        xodr.Spiral(x.KappaStart, x.KappaEnd, length=x.length) for x in clothoids
    ]

`

MandolinMicke commented 4 months ago

The method implemented is scenariogeneration only fits three clothods between two points (with headings) based on the pyclothoids package.

If you want to know exactly how it works, or other methods in that package I would suggest to visit https://github.com/phillipd94/pyclothoids