Created
March 31, 2020 13:38
-
-
Save ksheersaagr/826346ac5d99f185fce09acf9550391a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_poses_landmarks(mu, N): | |
# create a list of poses | |
poses = [] | |
for i in range(N): | |
poses.append((mu[2*i].item(), mu[2*i+1].item())) | |
# create a list of landmarks | |
landmarks = [] | |
for i in range(num_landmarks): | |
landmarks.append((mu[2*(N+i)].item(), mu[2*(N+i)+1].item())) | |
# return completed lists | |
return poses, landmarks | |
def print_all(poses, landmarks): | |
print('\n') | |
print('Estimated Poses:') | |
for i in range(len(poses)): | |
print('['+', '.join('%.3f'%p for p in poses[i])+']') | |
print('\n') | |
print('Estimated Landmarks:') | |
for i in range(len(landmarks)): | |
print('['+', '.join('%.3f'%l for l in landmarks[i])+']') | |
# call your implementation of slam, passing in the necessary parameters | |
mu = slam(data, N, num_landmarks, world_size, motion_noise, measurement_noise) | |
# print out the resulting landmarks and poses | |
if(mu is not None): | |
# get the lists of poses and landmarks | |
# and print them out | |
poses, landmarks = get_poses_landmarks(mu, N) | |
print_all(poses, landmarks) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment