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 RssRestrictor

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

Overview

The RssRestrictor class applies RSS (Responsibility-Sensitive Safety) acceleration restrictions to vehicle control commands, enforcing safe longitudinal and lateral limits.

Description

carla::rss::RssRestrictor provides a single key method RestrictVehicleControl() that takes a vehicle control command and modifies it according to RSS proper response acceleration restrictions:

Longitudinal restriction:

  • Retrieves the range from ad::rss::world::AccelerationRestriction for the longitudinal component
  • If the restriction maximum is 0 or negative (braking required), sets throttle to 0 and brake to the ego vehicle's brake value
  • If the restriction minimum is 0 and maximum is positive (acceleration allowed), keeps the original throttle and clears braking

Lateral restriction:

  • For left lateral restrictions: if the maximum is 0 or negative and the vehicle is currently steering left, the steer is clamped to 0
  • For right lateral restrictions: if the minimum is 0 or positive and the vehicle is currently steering right, the steer is clamped to 0
  • An optional RssEgoDynamicsOnRoute parameter provides additional ego heading change rate information for more precise lateral control

The restrictor uses spdlog for debug logging of the restriction values and resulting control commands.

Usage

Use this class to enforce RSS safety constraints on vehicle actuation commands. It is called by the RSS sensor pipeline after computing the proper response to restrict the driver's intended controls.

Code Reference

Source Location

  • Repository: CARLA
  • Files: LibCarla/source/carla/rss/RssRestrictor.h, LibCarla/source/carla/rss/RssRestrictor.cpp

Signature

class RssRestrictor {
public:
  RssRestrictor();
  ~RssRestrictor();

  carla::rpc::VehicleControl RestrictVehicleControl(
      const carla::rpc::VehicleControl &vehicle_control,
      const ::ad::rss::world::AccelerationRestriction &restriction,
      const carla::rss::RssEgoDynamicsOnRoute &ego_dynamics_on_route,
      const carla::rpc::VehiclePhysicsControl &vehicle_physics);
};

Import

#include "carla/rss/RssRestrictor.h"

I/O Contract

Input Type Description
rpc::VehicleControl | Original driver control (throttle, brake, steer)
AccelerationRestriction | RSS longitudinal and lateral acceleration limits
RssEgoDynamicsOnRoute | Ego heading change rate for lateral checks
VehiclePhysicsControl | Vehicle physical properties (brake values)
Output Type Description
rpc::VehicleControl | RSS-restricted vehicle control command

Usage Examples

RssRestrictor restrictor;
auto safe_control = restrictor.RestrictVehicleControl(
    driver_control,
    rss_restriction,
    ego_dynamics,
    vehicle_physics
);
vehicle->ApplyControl(safe_control);

Related Pages

Page Connections

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