Allow creating a carla.Map from an XODR string

This commit is contained in:
nsubiron 2019-03-25 21:03:27 +01:00
parent ec5a4bc72b
commit 5acf722799
3 changed files with 9 additions and 0 deletions

View File

@ -29,6 +29,12 @@ namespace client {
: _description(std::move(description)),
_map(MakeMap(_description.open_drive_file)) {}
Map::Map(std::string name, std::string xodr_content)
: Map(rpc::MapInfo{
std::move(name),
std::move(xodr_content),
std::vector<geom::Transform>{}}) {}
Map::~Map() = default;
SharedPtr<Waypoint> Map::GetWaypoint(

View File

@ -27,6 +27,8 @@ namespace client {
explicit Map(rpc::MapInfo description);
explicit Map(std::string name, std::string xodr_content);
~Map();
const std::string &GetName() const {

View File

@ -59,6 +59,7 @@ void export_map() {
namespace cg = carla::geom;
class_<cc::Map, boost::noncopyable, boost::shared_ptr<cc::Map>>("Map", no_init)
.def(init<std::string, std::string>((arg("name"), arg("xodr_content"))))
.add_property("name", CALL_RETURNING_COPY(cc::Map, GetName))
.def("get_spawn_points", CALL_RETURNING_LIST(cc::Map, GetRecommendedSpawnPoints))
.def("get_waypoint", &cc::Map::GetWaypoint, (arg("location"), arg("project_to_road")=true))