Implementation:CARLA simulator Carla InformationSet
| Knowledge Sources | |
|---|---|
| Domains | Road Network, Simulation |
| Last Updated | 2026-02-15 05:00 GMT |
Overview
The InformationSet class provides typed access to heterogeneous road information records (e.g., lane width, elevation, geometry) stored in a distance-ordered collection.
Description
carla::road::InformationSet is a MovableNonCopyable wrapper around a RoadElementSet<unique_ptr<element::RoadInfo>>. It provides three template methods for retrieving typed road information:
- GetInfos<T>() -- returns all records of type T from the entire set, iterating with a
RoadInfoIteratorthat filters by dynamic type - GetInfo<T>(s) -- returns the single most relevant record of type T at distance s, using a reverse subset query to find the record with the largest distance less than or equal to s
- GetInfos<T>(min_s, max_s) -- returns all records of type T within a distance range, handling both forward (min < max) and reverse (min > max) ordering
The underlying RoadInfoIterator performs dynamic type filtering using dynamic_cast, allowing the set to store mixed RoadInfo subclasses (width, elevation, geometry, lane offset, speed, etc.) in a single sorted container.
Usage
This class is used internally by Road and Lane to store and retrieve their associated road information records. It is a core part of the road data model's type-safe heterogeneous information storage.
Code Reference
Source Location
- Repository: CARLA
- File:
LibCarla/source/carla/road/InformationSet.h
Signature
class InformationSet : private MovableNonCopyable {
public:
InformationSet() = default;
InformationSet(std::vector<std::unique_ptr<element::RoadInfo>> &&vec);
template <typename T>
std::vector<const T *> GetInfos() const;
template <typename T>
const T *GetInfo(const double s) const;
template <typename T>
std::vector<const T *> GetInfos(const double min_s, const double max_s) const;
};
Import
#include "carla/road/InformationSet.h"
I/O Contract
| Input | Type | Description |
|---|---|---|
double | Distance along road for point query
| ||
double | Distance range for range query
| ||
Template type | Subclass of element::RoadInfo to filter by
|
| Output | Type | Description |
|---|---|---|
const T * | Pointer to the matching record, or nullptr
| ||
std::vector<const T *> | All matching records of type T
|
Usage Examples
// Get lane width at a specific s on a lane
const auto *width_info = info_set.GetInfo<element::RoadInfoLaneWidth>(25.0);
if (width_info) {
double width = width_info->GetPolynomial().Evaluate(25.0);
}
// Get all elevation records
auto elevations = info_set.GetInfos<element::RoadInfoElevation>();