Skip to content

mapbytes makes no sense although lidar scan is very reasonable #72

@Avi-avidan

Description

@Avi-avidan

hi,
I am getting a nice scan from my Slamtec RPLIDAR A1 (see image)
Screen Shot 2020-04-10 at 14 15 03

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 -
image

any advice? what am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions