Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLAM simulation converts polar coordinates to map frame, not cartesian #9

Open
tomaz-suller opened this issue Mar 27, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@tomaz-suller
Copy link
Owner

During execution of main, the result from lidar is converted to the coordinate system of the map:

S = lidar(xi, env, 720, use_inf=False)
S_map = [np.array([world2map(si[0]), si[1]]) for si in S]

However, the output of lidar is in polar, rather than in cartesian, coordinates:

def lidar(xi, env, n_measures=360, use_inf=False):
sensor_px, sensor_py, psi = xi
size_x, size_y = env.T.shape
size_max = max(size_x, size_y)
acc = []
for theta in np.linspace(0, 2*pi, n_measures):
theta += psi
measure = np.array([np.Inf if use_inf else size_max, theta])
for rho in range(1, size_max+1):
check_px = math.ceil(sensor_px + rho*cos(theta))
check_py = math.ceil(sensor_py + rho*sin(theta))
if (0 < check_px <= size_x and
0 < check_py <= size_y and
not env[check_py, check_px]):
measure = np.array([rho-1, theta])
break
acc.append(measure)
return acc

Therefore, this operation is bound to produce invalid results when executed.

@tomaz-suller tomaz-suller added the bug Something isn't working label Mar 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant