diff --git a/CHANGELOG.md b/CHANGELOG.md index 1aa30e45f..e53b996b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Latest * Add build variant with AD RSS library integration with RSS sensor and result visualisation * Added new sensor: Inertial measurement unit (IMU) + * Added new sensor: Radar * Moved GNSS sensor from client to server side * Now all the camera-based sensors are provided with an additional parametrized lens distortion shader * API changes: @@ -9,6 +10,7 @@ - GNSS: `carla.GnssEvent` renamed to `carla.GnssMeasurement` * API extensions: - Added `carla.IMUMeasurement` + - Added `carla.RadarMeasurement` and `carla.RadarDetection` - GNSS data can now be obtained with noise - IMU data can now be obtained with noise * Updated manual_control.py with a lens disortion effect example diff --git a/Docs/bp_library.md b/Docs/bp_library.md index c3ce36c37..aacbcfae6 100755 --- a/Docs/bp_library.md +++ b/Docs/bp_library.md @@ -136,6 +136,14 @@ Check out our [blueprint tutorial](../python_api_tutorial/#blueprints). - `only_dynamics` (_Bool_)_ – Modifiable_ - `role_name` (_String_)_ – Modifiable_ - `sensor_tick` (_Float_)_ – Modifiable_ +- **sensor.other.radar** + - **Attributes:** + - `horizontal_fov` (_Float_)_ – Modifiable_ + - `points_per_second` (_Int_)_ – Modifiable_ + - `range` (_Float_)_ – Modifiable_ + - `role_name` (_String_)_ – Modifiable_ + - `sensor_tick` (_Float_)_ – Modifiable_ + - `vertical_fov` (_Float_)_ – Modifiable_ ### static - **static.prop.advertisement** diff --git a/Docs/python_api.md b/Docs/python_api.md index 9990caf41..b2ce37656 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -715,6 +715,24 @@ Save the OpenDRIVE of the current map to disk. --- +## carla.RadarDetection _class_ +Data contained by a [carla.RadarMeasurement](#carla.RadarMeasurement). Represents an object detection produced by the Radar sensor. + +

Instance Variables

+- **velocity** (_float_) +The velocity of the detected object towards the sensor in meters per second. +- **azimuth** (_float_) +Azimuth angle of the detection in radians. +- **altitude** (_float_) +Altitude angle of the detection in radians. +- **depth** (_float_) +Distance in meters from the sensor to the detection position. + +

Methods

+- **\__str__**(**self**) + +--- + ## carla.Rotation _class_ Class that represents a 3D rotation. All rotation angles are stored in degrees. @@ -1478,6 +1496,29 @@ Get obstacle distance. --- +## carla.RadarMeasurement([carla.SensorData](#carla.SensorData)) _class_ +Measurement produced by a Radar. Consists of an array of [carla.RadarDetection](#carla.RadarDetection). + +

Instance Variables

+- **raw_data** (_bytes_) +List of [carla.RadarDetection](#carla.RadarDetection). + +

Methods

+- **get_detection_count**(**self**) +Retrieve the number of [carla.RadarDetection](#carla.RadarDetection) that are generated. +- **\__len__**(**self**) +- **\__iter__**(**self**) +- **\__getitem__**(**self**, **pos**) + - **Parameters:** + - `pos` (_int_) +- **\__setitem__**(**self**, **pos**, **detection**) + - **Parameters:** + - `pos` (_int_) + - `detection` (_[carla.RadarDetection](#carla.RadarDetection)_) +- **\__str__**(**self**) + +--- + ## carla.Sensor([carla.Actor](#carla.Actor)) _class_ A sensor actor. diff --git a/LibCarla/source/carla/sensor/data/RadarMeasurement.h b/LibCarla/source/carla/sensor/data/RadarMeasurement.h index 88f8a2643..2d148db58 100644 --- a/LibCarla/source/carla/sensor/data/RadarMeasurement.h +++ b/LibCarla/source/carla/sensor/data/RadarMeasurement.h @@ -15,6 +15,8 @@ namespace carla { namespace sensor { namespace data { + /// Measurement produced by a Radar. Consists of an array of RadarDetection. + /// A RadarDetection contains 4 floats: velocity, azimuth, altitude and depth class RadarMeasurement : public Array { using Super = Array; protected: diff --git a/PythonAPI/carla/source/libcarla/SensorData.cpp b/PythonAPI/carla/source/libcarla/SensorData.cpp index b6d8ad521..b9f2a59ba 100644 --- a/PythonAPI/carla/source/libcarla/SensorData.cpp +++ b/PythonAPI/carla/source/libcarla/SensorData.cpp @@ -281,12 +281,15 @@ void export_sensor_data() { class_, boost::noncopyable, boost::shared_ptr>("RadarMeasurement", no_init) .add_property("raw_data", &GetRawDataAsBuffer) - .def("get_point_count", &csd::RadarMeasurement::GetDetectionAmount) + .def("get_detection_count", &csd::RadarMeasurement::GetDetectionAmount) .def("__len__", &csd::RadarMeasurement::size) .def("__iter__", iterator()) .def("__getitem__", +[](const csd::RadarMeasurement &self, size_t pos) -> css::RadarDetection { return self.at(pos); }) + .def("__setitem__", +[](csd::RadarMeasurement &self, size_t pos, const css::RadarDetection &detection) { + self.at(pos) = detection; + }) .def(self_ns::str(self_ns::self)) ; diff --git a/PythonAPI/docs/sensor_data.yml b/PythonAPI/docs/sensor_data.yml index 4d3aa94db..0a6922af7 100644 --- a/PythonAPI/docs/sensor_data.yml +++ b/PythonAPI/docs/sensor_data.yml @@ -282,4 +282,76 @@ - def_name: __str__ doc: > # -------------------------------------- + + - class_name: RadarMeasurement + parent: carla.SensorData + # - DESCRIPTION ------------------------ + doc: > + Measurement produced by a Radar. Consists of an array of carla.RadarDetection. + # - PROPERTIES ------------------------- + instance_variables: + - var_name: raw_data + type: bytes + doc: > + List of carla.RadarDetection. + # - METHODS ---------------------------- + methods: + - def_name: get_detection_count + doc: > + Retrieve the number of carla.RadarDetection that are generated. + # -------------------------------------- + - def_name: __len__ + doc: > + # -------------------------------------- + - def_name: __iter__ + doc: > + # -------------------------------------- + - def_name: __getitem__ + params: + - param_name: pos + type: int + doc: > + # -------------------------------------- + - def_name: __setitem__ + params: + - param_name: pos + type: int + - param_name: detection + type: carla.RadarDetection + doc: > + # -------------------------------------- + - def_name: __str__ + doc: > + # -------------------------------------- + + - class_name: RadarDetection + # - DESCRIPTION ------------------------ + doc: > + Data contained by a carla.RadarMeasurement. Represents an object detection produced by the Radar sensor. + # - PROPERTIES ------------------------- + instance_variables: + - var_name: velocity + type: float + doc: > + The velocity of the detected object towards the sensor in meters per second. + # -------------------------------------- + - var_name: azimuth + type: float + doc: > + Azimuth angle of the detection in radians + # -------------------------------------- + - var_name: altitude + type: float + doc: > + Altitude angle of the detection in radians + # -------------------------------------- + - var_name: depth + type: float + doc: > + Distance in meters from the sensor to the detection position. + # - METHODS ---------------------------- + methods: + - def_name: __str__ + doc: > + # -------------------------------------- ...