question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How the coordinate conversion mechanism work in this work?

See original GitHub issue

Hi, thank for your excellent work! I have a question about the coordinate conversion mechanism in this work. For example, what does the s0 mean in road/graphics.py. The corresponding code is as below: `@classmethod def display(cls, lane: AbstractLane, surface: WorldSurface) -> None: “”" Display a lane on a surface.

    :param lane: the lane to be displayed
    :param surface: the pygame surface
    """
    print(surface.get_height()) # surface.get_height() = screen.height
    print(surface.get_width()) # surface.get_width() = screen.width
    print(surface.origin)
    stripes_count = int(2 * (surface.get_height() + surface.get_width()) / (cls.STRIPE_SPACING * surface.scaling))
    s_origin, _ = lane.local_coordinates(surface.origin)
    s0 = (int(s_origin) // cls.STRIPE_SPACING - stripes_count // 2) * cls.STRIPE_SPACING
    print("s0 = {}".format(s0))
    for side in range(2):
        if lane.line_types[side] == LineType.STRIPED:
            cls.striped_line(lane, surface, stripes_count, s0, side)
        elif lane.line_types[side] == LineType.CONTINUOUS:
            cls.continuous_curve(lane, surface, stripes_count, s0, side)
        elif lane.line_types[side] == LineType.CONTINUOUS_LINE:
            cls.continuous_line(lane, surface, stripes_count, s0, side)`

Could you give a detail document to introduce this.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Joe12138commented, Dec 10, 2021

Sorry! I just saw your reply. Thank for your nice reply! I have fixed this bug. The reason is that the width of lanes in .osm path is not always equal. So I have to change the road-drawing mechanism based on your code. This the results after fixing this bug:

The original Merge scene in .osm file

CHN_Merge

The Merge scene in highway environment (just the initial result):

CHN_MERGE However, the .osm parser written by me cannot handle the .osm file with different scenes. For example,

The original Roundabout scene in .osm file

R_CHN_Roundabout_LN

The Roundabout scene in highway environment (just the initial result):

Screenshot from 2021-12-07 17-18-57

For me, I really want to embed this function into highway-env. I am glad that I can complete this function with you. If you have free time and would like to do this with me, please let me know.

Anyway, thanks for your nice and patience reply!!!

0reactions
eleurentcommented, Jan 5, 2022

Hi @Joe12138 Many thanks for the json export, I managed to load the scenes you attached! (I noticed that you also use the Interaction Dataset to get the vehicle positions, but since I don’t have this dataset and you need to fill a form to download it I simply commented out the vehicle loading part and put a dummy vehicle in the middle of the scene instead)

Here is what I got after loading the DR_USA_Roundabout_SR scene: original

I first noticed that a few lane segments seem to have the points in their borders defined in the wrong order, which gives these ‘diabolo’ shapes: original_circ

To better see what’s going on, I chose random colors for each Lane segment, and also drew red circles at each point of their border colors

By switching the order in which the right border of each lane is traversed, we can see that it fixes the three diabolo patches at the bottom, but not the one at the top:

color_switch_right - Copie

So I guess there is something wrong in the order in which the point list of the two lane borders are generated from the osm.

Note that overlapping both conventions (left + reversed(right) as expected, and left + right in addition for faulty patches) would not work since it would draw inside regions outside of the polygon for non-convex lanes.

Another issue is that some points should be shared between the borders of two Lanes, but instead belong to only one of them. See e.g. the circled point at the bottom, which only belongs to the yellow patch while it should also belong to the purple patch below so that the dashed region is filled.

Finally, only looking at the lane borders and hiding the patches, it seems quite clear that the curved part of the roundabout has been traversed in the wrong order: see my annotation below (could be the reversed order) borders_1

where it should instead be something like this: borders_2

So all these issues seem to stem from how you read lanes in an OSM file, and convert them to Lane objects, and not to the rendering code itself. I’m not sure what else I could do to help, but I advise you to go back to your conversion code with these kind of visualization and try to ensure that everything is handled in the correct order.

Good luck! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Geographic coordinate conversion - Wikipedia
In geodesy, geographic coordinate conversion is defined as translation among different coordinate formats or map projections all referenced to the same geodetic ...
Read more >
Get started with Coordinate Conversion—ArcGIS Pro
Using Coordinate Conversion, you can input coordinates using one coordinate system and output them to different coordinate systems in multiple notation formats.
Read more >
NGS Coordinate Conversion and Transformation Tool (NCAT)
NGS Coordinate Conversion and Transformation Tool (NCAT) · Enter lat-lon in decimal degrees · or degrees-minutes-seconds · or drag map marker to a ......
Read more >
How to convert coordinate system of a set of points using ArcGis
converting coordinates on ArcGisTo see more videos visit website : http://monde-geospatial.com/
Read more >
AutoCAD Civil 3D Coordinate Conversion - YouTube
In this video, I'm demonstrating how to convert AutoCAD drawing coordinate system into another coordinate system (Eg: WGS84 drawing convert ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found