lgsvl / apollo-simulator-map

HD maps for the San Francisco scene in the automotive simulator.
Other
7 stars 10 forks source link

How to generate base_map.txt from opendrive map? #1

Open daohu527 opened 5 years ago

daohu527 commented 5 years ago

Good job for able to use the map in Apollo directly! But I want to know how to convert opendrive map to apollo base_map.txt? Can I modify the map myself?Thanks!

zeyu-zha commented 4 years ago

Hello Apollo Team,

i have a question here, could you provide not only the base_map.bin but also the base_map.txt and base_map.xml here ? Or could you tell me how to generate the base_map.xml from the available base_map.bin with the usage of baidu map engine?

luqiang21 commented 4 years ago

@daohu527 Sorry for late reply. We don't have tools to convert from opendrive to apollo base_map.txt. But currently, our simulator can import opendrive, then you can export to apollo format. But remember not all details will be kept by this transition.

@zeyu-zha Here is the way to convert base_map.bin back to base_map.txt. We are not aware of how to generate base_map.xml. You may ask apollo developers.

zeyu-zha commented 4 years ago

@luqiang21 Thanks for your advise! I have another question. Since it is possible to write base_map.txt for the base_map.bin, could you give me some suggestions or guides for directly extracting the map information, e.g. lanewidth, lane number and center line of the lane, from the base_map.bin file with the usage of apollo Map functions?

daohu527 commented 4 years ago

I think is possible, you can use "apollo\modules\map\hdmap\hdmap_common.h" and "apollo\modules\map\hdmap\hdmap_impl.h" Have a try.

luqiang21 commented 4 years ago

@zeyu-zha You can parse the file and read the map file in txt. The lanes have center line information, boundary line information. You might need to compute laneWidth since it is not a constant. The map only has sampled boundary line points.

Using Apollo map functions, I am not very clear, you can try @daohu527's suggestion.

AlexandrZabolotny commented 3 years ago

@daohu527 Sorry for late reply. We don't have tools to convert from opendrive to apollo base_map.txt. But currently, our > simulator can import opendrive, then you can export to apollo format. But remember not all details will be kept by this transition.

@zeyu-zha Here is the way to convert base_map.bin back to base_map.txt. We are not aware of how to generate base_map.xml. You may ask apollo developers.

To convert base_map.bin back to base_map.txt, inside apollo docker, protoc --decode=apollo.hdmap.Map modules/map/proto/map.proto --proto_path=. < your_path_to_base_map.bin > > base_map.txt inside /apollo

Hi @luqiang21 Can I import HDmap from base_map.txt?? I see that I can import HDmap only from base_map.bin

daohu527 commented 3 years ago

import to which side apollo or lgsvl, if lgsvl it can easy to change txt to bin with command

AlexandrZabolotny commented 3 years ago

import to which side apollo or lgsvl, if lgsvl it can easy to change txt to bin with command

For lgsvl. can you jump with which command?

daohu527 commented 3 years ago
protoc --encode apollo.hdmap.Map modules/map/proto/map.proto < modules/map/data/base_map.txt > base_map.bin
luqiang21 commented 3 years ago

@daohu527 Sorry for late reply. We don't have tools to convert from opendrive to apollo base_map.txt. But currently, our > simulator can import opendrive, then you can export to apollo format. But remember not all details will be kept by this transition. @zeyu-zha Here is the way to convert base_map.bin back to base_map.txt. We are not aware of how to generate base_map.xml. You may ask apollo developers.

To convert base_map.bin back to base_map.txt, inside apollo docker, protoc --decode=apollo.hdmap.Map modules/map/proto/map.proto --proto_path=. < your_path_to_base_map.bin > > base_map.txt inside /apollo

Hi @luqiang21 Can I import HDmap from base_map.txt?? I see that I can import HDmap only from base_map.bin

Yeah, you are right, we only support bin file. As @daohu527 said, you can convert inside apollo docker, then import in our simulator.

AlexandrZabolotny commented 3 years ago

Thanks for your reply! I followed your recommendations. But, when I load the map into the simulator, then I get the following error

Screenshot from 2020-12-03 10-45-45

daohu527 commented 3 years ago

I guess you map don't have a header like below.

header {
  version: "03/10/17_22.46.20"
  date: "20161124"
  projection {
    proj: "+proj=tmerc +lat_0={37.413082} +lon_0={-122.013332} +k={0.9999999996} +ellps=WGS84 +no_defs"
  }
}
AlexandrZabolotny commented 3 years ago

I guess you map don't have a header like below.

header {
  version: "03/10/17_22.46.20"
  date: "20161124"
  projection {
    proj: "+proj=tmerc +lat_0={37.413082} +lon_0={-122.013332} +k={0.9999999996} +ellps=WGS84 +no_defs"
  }
}

Sorry for my persistence.
But this partially solved the problem. Now another error has occurred

Screenshot from 2020-12-09 17-06-45

luqiang21 commented 3 years ago

@AlexandrZabolotny Please have a full header like this and try again

header {
  version: "1.500000"
  date: "2018-03-23T13:27:54"
  projection {
    proj: "+proj=utm +zone=10 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
  }
  district: "0"
  rev_major: "1"
  rev_minor: "0"
  left: -122.01603666045537
  top: 37.416905633399246
  right: -122.01603666045537
  bottom: 37.416905633399246
  vendor: "LGSVL"
}

Make sure zone is correct for your map, left/right, top/bottom can be the center's longitude, latitude of your map.

AlexandrZabolotny commented 3 years ago

@luqiang21 thanks. All ok now