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 VehiclePhysicsControl

From Leeroopedia
Knowledge Sources
Domains Vehicle Physics, RPC Serialization
Last Updated 2026-02-15 05:00 GMT

Overview

VehiclePhysicsControl is an RPC-serializable struct that comprehensively defines all vehicle physics parameters including engine, transmission, chassis, suspension, and wheel configurations.

Description

Defined in the carla::rpc namespace (~245 lines), this struct provides full control over vehicle physical properties:

Engine: torque curve (Vector2D points), max_torque, max_rpm, idle_rpm, brake_effect, rev_up_moi, rev_down_rate.

Transmission: differential_type, front_rear_split, use_automatic_gears, gear_change_time, final_ratio, forward/reverse gear ratios, change_up/down_rpm, transmission_efficiency.

Chassis: mass, drag_coefficient, center_of_mass, chassis_width/height, downforce_coefficient, drag_area, inertia_tensor_scale, sleep_threshold, sleep_slope_limit.

Steering and Wheels: steering_curve (Vector2D points), vector of WheelPhysicsControl, and use_sweep_wheel_collision flag.

The struct supports UE4 conversion via FromFVehiclePhysicsControl static method and operator FVehiclePhysicsControl, handling the conversion of rich curve data and wheel arrays.

Usage

Use this type to query or modify the complete physics configuration of a vehicle at runtime via the CARLA client API.

Code Reference

Source Location

  • Repository: CARLA
  • File: LibCarla/source/carla/rpc/VehiclePhysicsControl.h

Signature

namespace carla {
namespace rpc {

  struct VehiclePhysicsControl {
    // Engine
    std::vector<geom::Vector2D> torque_curve;
    float max_torque = 300.0f;
    float max_rpm = 5000.0f;
    float idle_rpm = 1.0f;
    float brake_effect = 1.0f;
    float rev_up_moi = 1.0f;
    float rev_down_rate = 600.0f;

    // Transmission
    uint8_t differential_type = 0;
    float front_rear_split = 0.5f;
    bool use_automatic_gears = true;
    float gear_change_time = 0.5f;
    float final_ratio = 4.0f;
    std::vector<float> forward_gear_ratios;
    std::vector<float> reverse_gear_ratios;
    float change_up_rpm = 4500.0f;
    float change_down_rpm = 2000.0f;
    float transmission_efficiency = 0.9f;

    // Chassis
    float mass = 1000.0f;
    float drag_coefficient = 0.3f;
    geom::Location center_of_mass;
    // ... additional chassis params

    // Wheels
    std::vector<geom::Vector2D> steering_curve;
    std::vector<WheelPhysicsControl> wheels;
    bool use_sweep_wheel_collision = false;

    bool operator==(const VehiclePhysicsControl &rhs) const;
    bool operator!=(const VehiclePhysicsControl &rhs) const;

    MSGPACK_DEFINE_ARRAY(...);
  };

} // namespace rpc
} // namespace carla

Import

#include "carla/rpc/VehiclePhysicsControl.h"

I/O Contract

Category Key Fields Description
Engine torque_curve, max_torque, max_rpm, idle_rpm Engine torque characteristics
Transmission differential_type, gear_ratios, final_ratio Gearbox and drivetrain config
Chassis mass, drag_coefficient, center_of_mass Vehicle body physics
Wheels wheels (vector of WheelPhysicsControl) Per-wheel physics parameters
Steering steering_curve Speed-dependent steering response

Usage Examples

#include "carla/rpc/VehiclePhysicsControl.h"

auto physics = vehicle->GetPhysicsControl();

// Increase mass
physics.mass = 1500.0f;

// Modify torque curve
physics.torque_curve = {
    carla::geom::Vector2D(0.0f, 400.0f),
    carla::geom::Vector2D(5000.0f, 600.0f)
};

vehicle->ApplyPhysicsControl(physics);

Related Pages

Page Connections

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