How the coordinate conversion mechanism work in this work?
See original GitHub issueHi, 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:
- Created 2 years ago
- Comments:12 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
fileThe Merge scene in highway environment (just the initial result):
However, the
.osm
parser written by me cannot handle the.osm
file with different scenes. For example,The original Roundabout scene in
.osm
fileThe Roundabout scene in highway environment (just the initial result):
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!!!
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:
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:
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
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:
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)
where it should instead be something like this:
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! 😃