lgsvl / simulator

A ROS/ROS2 Multi-robot Simulator for Autonomous Vehicles
Other
2.3k stars 780 forks source link

About elevationProfile and superelevation #917

Closed yumianhuli2 closed 4 years ago

yumianhuli2 commented 4 years ago

Hello LgsvlTeam! I have some questions in this post. 1 In the OpenDriveMapImporter script,CalculateLinePoints(..)、 CalculateArcPoints(..)、CalculateParamPoly3Points(..) have coordinates y that compute the elevation, but why does CalculateSpiralPoints(..) and CalculatePoly3Points(..)not compute the coordinate y of this elevation?

2 Superelevation - I have not found the code to calculate the tilt Angle of the cross section. Do you know the formula and method for calculating it?

3 pos = Quaternion.Euler(0f, -(float)(geometry.hdg 180f / Math.PI), 0f) pos; Why do point(pos) have to do with angles/direction?I think calculating the pose point has nothing to do with rotation.

Thanks!

luqiang21 commented 4 years ago

@yumianhuli2

  1. This is a known bug, CalculateSpiralPoints(..) and CalculatePoly3Points(..) also need to compute elevation. We have fixed it internally, you will see it in next release.
  2. You can refer opendrive definition document for the formula of calculating it.
  3. All points are computed assuming 0 angle. Finally we need to rotate them by the given heading.
yumianhuli2 commented 4 years ago

CalculateLinePoints()--This is probably not the right function, it doesn't use (hdg)angles to compute the coordinates,Especially the Z is always Zero.

luqiang21 commented 4 years ago

@yumianhuli2 As you can in this line, it is using hdg angle to compute the coordinates. z is 0 because it first computes without rotation along x direction, then rotates the coordinate to get correct result.

yumianhuli2 commented 4 years ago

@yumianhuli2 As you can in this line, it is using hdg angle to compute the coordinates. z is 0 because it first computes without rotation along x direction, then rotates the coordinate to get correct result.

Hi! luqiang! 1、pos = Quaternion.Euler(0f, -(float)(geometry.hdg 180f / Math.PI), 0f) pos You can only change the rotation but you can't change the coordinates???

2、For example,CalculateParamPoly3Points() ---The calculation result is going to be in UV coordinates, so where's the code for converting to XY coordinates?

Thanks!

luqiang21 commented 4 years ago

@yumianhuli2

  1. What do you mean by can only change the rotation but can't change the coordinates? There is no rotation for each pos, it is only a 3D coordinate with x, y, z.

  2. In CalculateParamPoly3Points(), following two lines are converting from UV space to XY space.

                pos = Quaternion.Euler(0f, -(float)(geometry.hdg * 180f / Math.PI), 0f) * pos;
                points.Add(origin + pos);
yumianhuli2 commented 4 years ago

@yumianhuli2

1. What do you mean by `can only change the rotation but can't change the coordinates`? There is no rotation for each `pos`, it is only a 3D coordinate with `x`, `y`, `z`.

2. In `CalculateParamPoly3Points()`, following two lines are converting from `UV` space to `XY` space.
                pos = Quaternion.Euler(0f, -(float)(geometry.hdg * 180f / Math.PI), 0f) * pos;
                points.Add(origin + pos);

OK!Hope for fixing elevation bug.Thanks

yumianhuli2 commented 4 years ago

@yumianhuli2

1. What do you mean by `can only change the rotation but can't change the coordinates`? There is no rotation for each `pos`, it is only a 3D coordinate with `x`, `y`, `z`.

2. In `CalculateParamPoly3Points()`, following two lines are converting from `UV` space to `XY` space.
                pos = Quaternion.Euler(0f, -(float)(geometry.hdg * 180f / Math.PI), 0f) * pos;
                points.Add(origin + pos);

路强你好!你的邮箱或者其他联系方式是什么?我引用了部分源码计算参考线对应的lane宽度发现和odrViewer中的坐标对不上,但形状是一致的。 是不是计算公式有点问题呢?我有一个xodr的文件和工程需要发给你看一下哈!

luqiang21 commented 4 years ago

@yumianhuli2 You already asked this https://github.com/lgsvl/simulator/issues/931 right? I am checking it.