BreezySLAM
BreezySLAM copied to clipboard
mapbytes makes no sense although lidar scan is very reasonable
hi,
I am getting a nice scan from my Slamtec RPLIDAR A1 (see image)
LIDAR_DEVICE = '/dev/ttyUSB0'
dists[:10] = [-0.0, -0.0, -0.0, -640.6713808877225, -616.3971794359838, -605.3760240984459, -588.6830172771465, -573.8061655912974, -584.4876481055396, -581.9273308674532]
angles[:10] = [-0.0, -0.0, -0.0, -109.72776180811681, -97.11084997755711, -89.79905036668178, -79.29883460350986, -69.50168580266731, -64.17311907687618, -59.87972603044943]
I am initializing objects as follows - LaserModel = RPLidar slam = RMHC_SLAM(LaserModel(), MAP_SIZE_PIXELS, MAP_SIZE_METERS, max_search_iter=5) viz = MapVisualizer(MAP_SIZE_PIXELS, MAP_SIZE_METERS, 'SLAM') mapbytes = bytearray(MAP_SIZE_PIXELS * MAP_SIZE_PIXELS)
running this simple loop to update my map -
for i in range(5):
time.sleep(0.1)
scan_dict = simple_express_scan(ret_points=NUM_POINTS)
dists ,angles = get_raw_data(scan_dict, ang_off=4)
time.sleep(0.1)
slam.update(dists, scan_angles_degrees=angles)
time.sleep(0.1)
x, y, theta = slam.getpos()
print(x, y, theta)
slam.getmap(mapbytes)
print(x, y, theta) always outputs: 5000.0 5000.0 0.0 even when I move my robot around (with the lidar on top)
this is the image I get -
any advice? what am I doing wrong?
this is the map I get after slam.update() with 10,000 points (200 at a time) -
any advice would be greatly appreciated. thanks in advance.
this is the 10000 points when I show it with matplotlib -
any advice will be appreciated. thanks.
Have you tried the sketch I already wrote for RPLidar A1?
here are the prints after running python3 rpslam.py Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused
(rpslam.py:20166): Gdk-CRITICAL **: 21:57:03.273: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed Too many measurments in the input buffer: 711/500. Clearing buffer... Too many measurments in the input buffer: 780/500. Clearing buffer... Too many measurments in the input buffer: 778/500. Clearing buffer... Too many measurments in the input buffer: 809/500. Clearing buffer... Too many measurments in the input buffer: 784/500. Clearing buffer... Too many measurments in the input buffer: 775/500. Clearing buffer... Too many measurments in the input buffer: 771/500. Clearing buffer... Too many measurments in the input buffer: 813/500. Clearing buffer... Too many measurments in the input buffer: 781/500. Clearing buffer... Too many measurments in the input buffer: 770/500. Clearing buffer... Too many measurments in the input buffer: 784/500. Clearing buffer... Too many measurments in the input buffer: 781/500. Clearing buffer... Too many measurments in the input buffer: 770/500. Clearing buffer... Too many measurments in the input buffer: 819/500. Clearing buffer... Too many measurments in the input buffer: 784/500. Clearing buffer... Too many measurments in the input buffer: 780/500. Clearing buffer... Too many measurments in the input buffer: 782/500. Clearing buffer... Too many measurments in the input buffer: 786/500. Clearing buffer... Too many measurments in the input buffer: 783/500. Clearing buffer... Too many measurments in the input buffer: 808/500. Clearing buffer... Too many measurments in the input buffer: 784/500. Clearing buffer...
I am ssh'ing from the terminal into the robot so display is unavailable. any advice?
I got a scan plotted running the sketch in jupyter notebook. after replacing viz.display with matplotlib.pyplot -
import matplotlib.pyplot as plt map_show = copy.deepcopy(mapbytes) map_show = np.reshape(mapbytes, (500,500)) f = plt.figure(figsize=(10,10)) plt.imshow(map_show, cmap='gray') plt.show()
thanks :)
Nice work, sorry for the trouble!
no trouble. thanks again for this great repo and your timely support :)
Hi, I am using rplidar a1 and have an issue: Too many bytes in the input buffer: 4010/3000. Cleaning buffer rplidar
Do you have any idea to solve this?
Hi, I am using rplidar a1 and have an issue: Too many bytes in the input buffer: 4010/3000. Cleaning buffer rplidar
Do you have any idea to solve this?
have you resolve this questions?