Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:CARLA simulator Carla RssSensor Interface

From Leeroopedia
Knowledge Sources
Domains Safety, Sensors
Last Updated 2026-02-15 05:00 GMT

Overview

The RssSensor class is a client-side sensor that integrates the Intel RSS (Responsibility-Sensitive Safety) library with CARLA, computing safe responses based on surrounding traffic.

Description

carla::rss::RssSensor inherits from client::Sensor and provides the interface for RSS safety analysis. The sensor operates by:

  • Listening -- Listen(callback) starts the RSS processing pipeline, creating a RssCheck instance and registering for map updates and tick callbacks
  • RSS computation -- each tick, it processes the current world state to determine proper responses and acceleration restrictions
  • Stopping -- Stop() halts RSS processing and clears callbacks

Configuration methods:

  • SetLogLevel() / SetMapLogLevel() -- control spdlog verbosity for RSS computations
  • AppendRoutingTarget() / ResetRoutingTargets() -- define the planned route for RSS analysis
  • SetRoadBoundariesMode() -- enable/disable road boundary checks
  • DropRoute() -- clear the current routing

Accessor methods:

  • GetVisualizationMode() / SetVisualizationMode() -- control debug visualization

The sensor registers itself for on-tick callbacks via the episode proxy and uses a mutex to protect concurrent access during RSS computation and parameter updates.

Usage

Use this sensor to add RSS safety monitoring to a vehicle. Attach it to an ego vehicle, configure routing targets and parameters, then listen for RSS responses that indicate safe acceleration restrictions.

Code Reference

Source Location

  • Repository: CARLA
  • File: LibCarla/source/carla/rss/RssSensor.h

Signature

class RssSensor : public client::Sensor {
public:
  using Sensor::Sensor;
  ~RssSensor();

  void Listen(CallbackFunctionType callback) override;
  void Stop() override;
  bool IsListening() const override;

  void SetLogLevel(const uint8_t &log_level);
  void SetMapLogLevel(const uint8_t &map_log_level);
  const ::ad::rss::world::RssDynamics &GetEgoVehicleDynamics() const;
  void SetEgoVehicleDynamics(const ::ad::rss::world::RssDynamics &ego_dynamics);
  const ::ad::rss::world::RssDynamics &GetOtherVehicleDynamics() const;
  void SetOtherVehicleDynamics(const ::ad::rss::world::RssDynamics &other_dynamics);
  const ::ad::rss::world::RssDynamics &GetPedestrianDynamics() const;
  void SetPedestrianDynamics(const ::ad::rss::world::RssDynamics &pedestrian_dynamics);
  void SetRoadBoundariesMode(const ::carla::rss::RoadBoundariesMode &road_boundaries_mode);
  const ::carla::rss::RoadBoundariesMode &GetRoadBoundariesMode() const;
  void AppendRoutingTarget(const ::carla::geom::Transform &routing_target);
  const std::vector<::carla::geom::Transform> &GetRoutingTargets() const;
  void ResetRoutingTargets();
  void DropRoute();
};

Import

#include "carla/rss/RssSensor.h"

I/O Contract

Input Type Description
CallbackFunctionType | Callback invoked with RSS response data each tick
RssDynamics | Dynamic parameters for the ego vehicle
geom::Transform | Waypoint on the planned route
Output Type Description
Via callback | Proper response and acceleration restrictions

Usage Examples

auto rss_sensor = world.SpawnActor(rss_bp, transform, ego_vehicle);
auto *rss = static_cast<carla::rss::RssSensor*>(rss_sensor.get());

rss->AppendRoutingTarget(target_transform);
rss->Listen([](auto data) {
  // Process RSS response
});

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment