Works with simplified MapVisualizer API

This commit is contained in:
simondlevy
2019-01-12 23:08:39 -05:00
parent c5ac00142e
commit 0aadd46aaf
5 changed files with 19 additions and 49 deletions

View File

@@ -47,7 +47,7 @@ if __name__ == '__main__':
slam = RMHC_SLAM(LaserModel(), MAP_SIZE_PIXELS, MAP_SIZE_METERS)
# Set up a SLAM display
display = MapVisualizer(MAP_SIZE_PIXELS, MAP_SIZE_METERS, 'SLAM')
viz = MapVisualizer(MAP_SIZE_PIXELS, MAP_SIZE_METERS, 'SLAM')
# Initialize an empty trajectory
trajectory = []
@@ -98,16 +98,10 @@ if __name__ == '__main__':
# Get current map bytes as grayscale
slam.getmap(mapbytes)
# Display map
display.displayMap(mapbytes)
# Display pose after converting from mm to meters
display.setPose(x/1000., y/1000., theta)
# Break on window close
if not display.refresh():
break
# Display map and robot pose, exiting gracefully if user closes it
if not viz.display(x/1000., y/1000., theta, mapbytes):
exit(0)
# Shut down the lidar connection
lidar.stop()
lidar.disconnect()