I guess your driver will produce updated maps as robot moves (from its
sensor data) and you want to store them somehow (or some final map after
some time of working). First question is: to use one of existing Player
map interfaces or not? (use plain file instead).
I'm not sure as I am not using it, however you may check if writelog
driver is capable to store map data (on-request nature of map interface
may cause problems here). Then you can provide map interface from your
driver and publish maps which could be requested by writelog driver (if
it is capable to request them). Unfortunately, I don't know if this can be
comfortable for later use (who will use such a map and how?).
Alternatively, you can save such a map directly to a file in one of bitmap
formats understood by mapfile driver (AFAIR it uses gdkpixbuf, if so, it
can be many formats, both text-human-readable (easy to generate) like xpm
or xbm and binary like bmp, pgm, png, gif, tiff). Disadvantage is that you
need to run two different Player instances: one at map building time and
different one when the map is ready.
For best results you can implement both:
1) saving maps to image file so new Player session with mapfile driver
could use that,
2) publish maps through map interface so they could be used at run time
whenever requested (as manual says: "In either case, the map is retrieved
by request only", due to that you may also need to provide opaque
interface in order to inicate that new map is waiting: every time updated
map is available, your driver can publish some message through opaque
interface so subscribers will be encouraged to request new map).
Other, more complicated solution is to store map data in PostgreSQL
database. Unfortunately, we are talking here about grid maps while
typically, vectormaps are stored in databases. You can implement
in your driver conversion of grid map into vector list using for example
recursive line fitting (which fortunately can be implemented using regular
loop with no stack use). Such a driver will have to subscribe vectormap
interface of postgis driver which is capable to store map layer at request
(such a request should contain vector list that builds the map). This is
pretty nice solution as other Player modules would be able to subscribe
the same postgis driver in order to read updated map data as requested.
Again, some mechanism of signalling about map update (as opaque interface
above) should be provided.
On Sat, 1 May 2010, aneves wrote:
> I'm creating a GridSLAM driver for Player/Stage. Can anyone tell how to save
> the resulting map? On a bitmap? On a txt file with the array? any ideas?
> What is the best approach? Does anyone have some map-saving examples?
> Thanks in advance,
> André Neves
> View this message in context: http://old.nabble.com/How-to-save-a-map.-tp28422723p28422723.html
> Sent from the playerstage-users mailing list archive at Nabble.com.
> Playerstage-users mailing list