ros_map_editor icon indicating copy to clipboard operation
ros_map_editor copied to clipboard

Break down when clcking the map

Open TrayfourYu opened this issue 3 years ago • 2 comments

Hi, I want to edit gmapping map and just cloned this project and run python MapEditor.py map.pgm. So, the UI came out, but it show the error below when I clicked the map. Traceback (most recent call last): File "MapEditor.py", line 197, in mapClick self.im.putpixel((x,y), val) File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1507, in putpixel return self.im.putpixel(xy, value) TypeError: integer argument expected, got float

TrayfourYu avatar Apr 21 '21 02:04 TrayfourYu

When I switch to python3 and run, it shows that

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

I'm not familiar with QT, and can't get a solution from the web. So, how would I fix it?

TrayfourYu avatar Apr 21 '21 02:04 TrayfourYu

@TrayfourYu TypeError: integer argument expected, got float can be fixed by adding int() to 3 lines of code in MapEditor.py.

L48 self.min_multiplier = int(math.ceil(view_width / self.map_width_cells)) L69 x = int(math.floor(x / self.pixels_per_cell)) L70 y = int(math.floor(y / self.pixels_per_cell))

The return value of math.ceil and math.floor was float in 2.7 while it's int in some later versions.

yinchuan avatar Sep 25 '23 06:09 yinchuan