0
$\begingroup$

Currently I can successfully generate the map output file but I have no idea how to display it in practice. Basically, it should be a 2D SLAM map.

The project I'm using is available at the following link on Github. This project basically uses Google Cartographer 2D SLAM without ROS.

Compiling the project I get an output file called "map_output" but it seems to be completely raw: it's not even binary. How can I convert or read it in a viewable format?

Inside the main file, specifically inside the main function, it can be seen how data consisting of inertial measurements (IMU) is taken as input and processed to provide an output map.

Update: map_output file as requested is available here. (IMU data file is available here.) I'm pretty sure both can be read and/or represented in the same way.

$\endgroup$
4
  • $\begingroup$ Can you share that map_output file, or a small version of it, or cut and paste some of the contents into your question, or link to an example in the same format? $\endgroup$ Commented Nov 17, 2022 at 16:03
  • 1
    $\begingroup$ @LucasW Absolutely! I've updated my question with the link to the file. The "format" (it doesn't actually have one) is the same as the IMU data. $\endgroup$
    – gcantoni
    Commented Nov 17, 2022 at 16:08
  • $\begingroup$ Ok it looks like a big dumb array of bytes where 0xff maybe means free-space or blank/unmapped? With maybe a 32 byte header at the start, possibly containing the width and height, though I don't see it write out a header in the code $\endgroup$ Commented Nov 17, 2022 at 18:19
  • $\begingroup$ I recommend loading it in jupyter-notebook if you are at all familiar with that or at least python, load it into a 2d numpy array and imshow it (maybe using width and height you got from a different source if it isn't in the file) $\endgroup$ Commented Nov 17, 2022 at 18:22

2 Answers 2

2
$\begingroup$

From hexdump I see a lot the two rows of 16 bytes each that don't match the next rows which are mostly 0xff:

hexdump -C map_output  | more
00000000  46 00 00 00 dc 00 00 00  00 00 00 d4 cc cc fc bf  |F...............|
00000010  00 00 40 6b 66 66 23 c0  00 00 00 a0 99 99 a9 3f  |..@kff#........?|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
...
00000350  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000370  ff ff ff ff ff ff ff 36  2e 31 ff ff ff ff ff ff  |.......6.1......|
00000380  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff 30 ff  |..............0.|
00000390  30 ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |0...............|
000003a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

The file size is 15432 bytes, so 15400 bytes without that header, width * height = 154300 - so find factors using https://stackoverflow.com/a/70924583/603653

It looks like you can open it in the gimp by checking Show All Files then select Raw Image Data :enter image description here

You then have to input the width and height manually, image type indexed, and set the offset to 32:

enter image description hereenter image description here

If that looks completely wrong then maybe some other import settings will work, but to me it looks a little like a 2D laser scan from a fixed location.

$\endgroup$
2
$\begingroup$

The map file from that executable is written out here in the code It looks to be populated from the CartoModule::paint_map function here in the code.

This appears to be an undocumented custom implementation from the project that you're linking to so you'll have to read the code there to find out why/how to interpret it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.