Skip to content

Commit

Permalink
Fix issue with plotting map points - need to translate then rotate
Browse files Browse the repository at this point in the history
  • Loading branch information
Samleo8 committed May 2, 2022
1 parent 3a2ed4f commit de83230
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ def convertFeaturesLocalToGlobal(
# Then we need to convert to meters
featurePointsGlobal *= RANGE_RESOLUTION_CART_M # px * (m/px) = m

# Center origin at pose center

# Rotate and translate to make into global coordinate system
R = getRotationMatrix(th)
t = np.array([x, y]).reshape(2, 1)
featurePointsGlobal = (R @ featurePointsGlobal.T + t).T
featurePointsGlobal = (R @ (featurePointsGlobal.T + t)).T

return featurePointsGlobal

Expand Down Expand Up @@ -198,8 +200,8 @@ def plot(self, fig: plt.figure, show: bool = False):
for kf in self.keyframes:
points_local = kf.featurePointsLocal
points_global = kf.convertFeaturesLocalToGlobal(points_local)

plt.plot(points_global, marker='+', color='red',label='Map Points')
plt.scatter(points_global[:, 0], points_global[:, 1], marker='+', color='red',label='Map Points')

if show:
plt.show()
Expand Down
Binary file added img/roam_mapping/tiny_traj.mp4
Binary file not shown.
Binary file added img/roam_mapping/tiny_traj/0001.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/roam_mapping/tiny_traj/0002.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/roam_mapping/tiny_traj/0003.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/roam_mapping/tiny_traj/0004.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/roam_mapping/tiny_traj/0005.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/roam_mapping/tiny_traj/0006.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/roam_mapping/tiny_traj/0007.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/roam_mapping/tiny_traj/0008.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/roam_mapping/tiny_traj/0009.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/roam_mapping/tiny_traj/0010.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit de83230

Please sign in to comment.