Added function to retrieve landmarks in the same group.
This commit is contained in:
parent
4b31d0fb40
commit
bdd0aaaac9
|
@ -1025,6 +1025,11 @@ Returns the landmarks of a specific type. Landmarks retrieved using this method
|
|||
- **Parameters:**
|
||||
- `type` (_string_) – The type of the landmarks.
|
||||
- **Return:** _list([carla.Landmark](#carla.Landmark))_
|
||||
- <a name="carla.Map.get_landmark_group"></a>**<font color="#7fb800">get_landmark_group</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**landmark**</font>)
|
||||
Returns the landmarks in the same group as the specified landmark (including itself). Returns an empty list if the landmark does not belong to any group.
|
||||
- **Parameters:**
|
||||
- `landmark` (_[carla.Landmark](#carla.Landmark)_) – A landmark that belongs to the group.
|
||||
- **Return:** _list([carla.Landmark](#carla.Landmark))_
|
||||
- <a name="carla.Map.get_spawn_points"></a>**<font color="#7fb800">get_spawn_points</font>**(<font color="#00a6ed">**self**</font>)
|
||||
Returns a list of recommendations made by the creators of the map to be used as spawning points for the vehicles. The list includes [carla.Transform](#carla.Transform) objects with certain location and orientation. Said locations are slightly on-air in order to avoid Z-collisions, so vehicles fall for a bit before starting their way.
|
||||
- **Return:** _list([carla.Transform](#carla.Transform))_
|
||||
|
|
|
@ -166,5 +166,20 @@ namespace client {
|
|||
return result;
|
||||
}
|
||||
|
||||
std::vector<SharedPtr<Landmark>>
|
||||
Map::GetLandmarkGroup(const Landmark &landmark) const {
|
||||
std::vector<SharedPtr<Landmark>> result;
|
||||
auto &controllers = landmark._signal->GetSignal()->GetControllers();
|
||||
for (auto& controller_id : controllers) {
|
||||
const auto &controller = _map.GetControllers().at(controller_id);
|
||||
for(auto& signal_id : controller->GetSignals()) {
|
||||
auto& signal = _map.GetSignals().at(signal_id);
|
||||
auto new_landmarks = GetLandmarksFromId(signal->GetSignalId());
|
||||
result.insert(result.end(), new_landmarks.begin(), new_landmarks.end());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace client
|
||||
} // namespace carla
|
||||
|
|
|
@ -91,6 +91,9 @@ namespace client {
|
|||
/// Returns all the landmarks in the map of a specific type
|
||||
std::vector<SharedPtr<Landmark>> GetAllLandmarksOfType(std::string type) const;
|
||||
|
||||
/// Returns all the landmarks in the same group including this one
|
||||
std::vector<SharedPtr<Landmark>> GetLandmarkGroup(const Landmark &landmark) const;
|
||||
|
||||
private:
|
||||
|
||||
const rpc::MapInfo _description;
|
||||
|
|
|
@ -169,6 +169,7 @@ void export_map() {
|
|||
.def("get_all_landmarks", CALL_RETURNING_LIST(cc::Map, GetAllLandmarks))
|
||||
.def("get_all_landmarks_from_id", CALL_RETURNING_LIST_1(cc::Map, GetLandmarksFromId, std::string), (args("opendrive_id")))
|
||||
.def("get_all_landmarks_of_type", CALL_RETURNING_LIST_1(cc::Map, GetAllLandmarksOfType, std::string), (args("type")))
|
||||
.def("get_landmark_group", CALL_RETURNING_LIST_1(cc::Map, GetLandmarkGroup, cc::Landmark), args("landmark"))
|
||||
.def(self_ns::str(self_ns::self))
|
||||
;
|
||||
|
||||
|
|
|
@ -208,6 +208,16 @@
|
|||
The type of the landmarks.
|
||||
return: list(carla.Landmark)
|
||||
# --------------------------------------
|
||||
- def_name: get_landmark_group
|
||||
doc: >
|
||||
Returns the landmarks in the same group as the specified landmark (including itself). Returns an empty list if the landmark does not belong to any group.
|
||||
params:
|
||||
- param_name: landmark
|
||||
type: carla.Landmark
|
||||
doc: >
|
||||
A landmark that belongs to the group.
|
||||
return: list(carla.Landmark)
|
||||
# --------------------------------------
|
||||
- def_name: get_spawn_points
|
||||
return: list(carla.Transform)
|
||||
doc: >
|
||||
|
|
Loading…
Reference in New Issue