apollo icon indicating copy to clipboard operation
apollo copied to clipboard

How to generate base_map.txt from base_map.xml

Open kk2491 opened this issue 8 years ago • 15 comments

Hi Guys,

Is there a way to generate base_map.txt file from base_map.xml file?

Thank you, KK

kk2491 avatar Jul 17 '18 09:07 kk2491

There is a tool for doing this provided in apollo which is: modules/map/tools/proto_map_generator, you need to build it first, then run the programm with parameters which specify the base_map directory.

hzdsdhr avatar Jul 20 '18 03:07 hzdsdhr

@hzdsdhr Thanks for the response. I will check and update you if any queries.

kk2491 avatar Jul 20 '18 05:07 kk2491

@hzdsdhr by building you mean running apollo.sh build? I assume there should be an executable to which I should pass the file location, but I don't know how to get it. I tried compiling it with gcc but it didn't work.

SanduIrina avatar Jul 24 '18 12:07 SanduIrina

@SanduIrina if you excute bash apollo.sh build ,if would automatically build that code,and you cd into the bazel-bin folder,you could fine the binary file.then you run it with parameter: map_dir and out_dir,it would success generate a base_map.txt and a base_map.bin to the out_put folder.

gengqx avatar Jul 26 '18 08:07 gengqx

@gengqx .. I hope you are referring to the below link https://github.com/ApolloAuto/apollo/tree/master/modules/map/data where generation of bin files for map is explained.

I am yet to try the method mentioned by @hzdsdhr to convert txt to xml. Will update here once I give a try.

Thank you.

kk2491 avatar Jul 27 '18 10:07 kk2491

@kk2491 were you able to convert txt to xml?

natashadsouza avatar Sep 06 '18 00:09 natashadsouza

@natashadsouza Yes, I was able to convert the base_map.xml to base_map.txt file using proto_map_generator tool.

/apollo$ bazel-bin/modules/map/tools/proto_map_generator --map_dir=/apollo/modules/map/data/map_input_folder --output_dir=/apollo/modules/map/data/map_output_folder

Just curious to know is there a tool to do the reverse conversion ? i.e from base_map.txt to base_map.xml

Thank you, KK

kk2491 avatar Sep 06 '18 06:09 kk2491

Hi, I tried to to run proto_map_generator on the sample map file in modules/maps/data/sunnyvale_loop, but I am getting the following error.

E0220 16:08:43.812430 10062 opendrive_adapter.cc:52] [] fail to parse opendrive road, Error parse road sample associations F0220 16:08:43.986624 10062 proto_map_generator.cc:39] Check failed: apollo::hdmap::adapter::OpendriveAdapter::LoadData(map_filename, &pb_map) fail to load data from : /apollo/modules/maps/data/sunnyvale_loop/base_map.xml

Can anyone provide me with some insight? Thanks!

tlin051 avatar Feb 21 '19 01:02 tlin051

@tlin051 I just tried, and it looks like it is not able to read the xml file. Probably those files are hidden as it gets from the docker. I have tried copying the xml file to different directory and but it was not successful.

kk2491 avatar Feb 21 '19 03:02 kk2491

@kk2491 thanks for trying it out. Did you get similar errors as I did?

You mentioned you were successful in converting the base_map.xml to base_map.txt in your previous comment. Was this referring to your own custom map or any of the example maps provided by Apollo?

tlin051 avatar Feb 21 '19 17:02 tlin051

@tlin051 Yes, I got the similar errors.

I was referring to the custom map.

kk2491 avatar Feb 21 '19 18:02 kk2491

@natashadsouza Yes, I was able to convert the base_map.xml to base_map.txt file using proto_map_generator tool.

/apollo$ bazel-bin/modules/map/tools/proto_map_generator --map_dir=/apollo/modules/map/data/map_input_folder --output_dir=/apollo/modules/map/data/map_output_folder

Just curious to know is there a tool to do the reverse conversion ? i.e from base_map.txt to base_map.xml

Thank you, KK

Any update on this ?

kk2491 avatar Mar 20 '19 07:03 kk2491

@kk2491 we do not provide a tool for conversion from .text to .xml

natashadsouza avatar Mar 20 '19 20:03 natashadsouza

Thanks for the confirmation. We can close the issue.

kk2491 avatar Mar 21 '19 02:03 kk2491

hi all

How to generate base_map.bin from base_map.txt??

AlexandrZabolotny avatar Dec 02 '20 09:12 AlexandrZabolotny