carla仿真平台API

仿真平台API

Ego车辆

车辆物理数据

  • 车辆尺寸
  • 车辆自身坐标系

车辆控制

  • 油门
  • 转向
  • 刹车
  • 手刹
  • 倒车

车辆状态参数

  • 速度
  • 加速度
  • 偏转
  • 位置坐标

车辆动力学控制

  • 扭矩
  • max rpm
  • 车辆瞬时惯性
  • 最大油门阻尼
  • 空油门阻尼
  • ……

传感器

传感器监听

listen(self, callback)
该函数可以在每次传感器获取到数据后,将其传输到callback中。

传感器数据

所有传感器数据有以下属性:

  • frame(int)产生数据时的帧数
  • timestamp(float)产生数据时的仿真器时间
  • transform(carla.transform)产生数据时传感器的位置信息(包含坐标信息和rotation信息

Depth camera

该传感器提供了视野中每个像素点的距离的深度地图。
图像通过记录每个像素点在三个频道(R、G、B)的色域,实际的距离(单位米)可以通过一下解码获得:

normalized = (R + G * 256 + B * 256 * 256) / (256 * 256 * 256 - 1)
in_meters = 1000 * normalized
基础的摄像头属性
Blueprint attribute Type Default Description
image_size_x int 800 Image width in pixels.
image_size_y int 600 Image height in pixels.
fov float 90.0 Horizontal field of view in degrees.
sensor_tick float 0.0 Simulation seconds between sensor captures (ticks).


像头镜头属性
Blueprint attribute Type Default Description
lens_circle_falloff float 5.0 Range: [0.0, 10.0]
lens_circle_multiplier float 0.0 Range: [0.0, 10.0]
lens_k float -1.0 Range: [-inf, inf]
lens_kcube float 0.0 Range: [-inf, inf]
lens_x_size float 0.08 Range: [0.0, 1.0]
lens_y_size float 0.08 Range: [0.0, 1.0]


输出属性
Sensor data attribute Type Description
frame int Frame number when the measurement took place.
timestamp double Simulation time of the measurement in seconds since the beginning of the episode.
transform carla.Transform Location and rotation in world coordinates of the sensor at the time of the measurement.
width int Image width in pixels.
height int Image height in pixels.
fov float Horizontal field of view in degrees.
raw_data bytes Array of BGRA 32-bit pixels.

GNSS传感器

GNSS 属性
Blueprint attribute Type Default Description
noise_alt_bias float 0.0 Mean parameter in the noise model for altitude.
noise_alt_stddev float 0.0 Standard deviation parameter in the noise model for altitude.
noise_lat_bias float 0.0 Mean parameter in the noise model for latitude.
noise_lat_stddev float 0.0 Standard deviation parameter in the noise model for latitude.
noise_lon_bias float 0.0 Mean parameter in the noise model for longitude.
noise_lon_stddev float 0.0 Standard deviation parameter in the noise model for longitude.
noise_seed int 0 Initializer for a pseudorandom number generator.
sensor_tick float 0.0 Simulation seconds between sensor captures (ticks).


输出属性
Sensor data attribute Type Description
frame int Frame number when the measurement took place.
timestamp double Simulation time of the measurement in seconds since the beginning of the episode.
transform carla.Transform Location and rotation in world coordinates of the sensor at the time of the measurement.
latitude double Latitude of the actor.
longitude double Longitude of the actor.
altitude double Altitude of the actor.

IMU传感器

IMU attributes

Blueprint attribute Type Default Description
noise_accel_stddev_x float 0.0 Standard deviation parameter in the noise model for acceleration (X axis).
noise_accel_stddev_y float 0.0 Standard deviation parameter in the noise model for acceleration (Y axis).
noise_accel_stddev_z float 0.0 Standard deviation parameter in the noise model for acceleration (Z axis).
noise_gyro_bias_x float 0.0 Mean parameter in the noise model for the gyroscope (X axis).
noise_gyro_bias_y float 0.0 Mean parameter in the noise model for the gyroscope (Y axis).
noise_gyro_bias_z float 0.0 Mean parameter in the noise model for the gyroscope (Z axis).
noise_gyro_stddev_x float 0.0 Standard deviation parameter in the noise model for the gyroscope (X axis).
noise_gyro_stddev_y float 0.0 Standard deviation parameter in the noise model for the gyroscope (Y axis).
noise_gyro_stddev_z float 0.0 Standard deviation parameter in the noise model for the gyroscope (Z axis).
noise_seed int 0 Initializer for a pseudorandom number generator.
sensor_tick float 0.0 Simulation seconds between sensor captures (ticks).


Output attributes

Sensor data attribute Type Description
frame int Frame number when the measurement took place.
timestamp double Simulation time of the measurement in seconds since the beginning of the episode.
transform carla.Transform Transform in world.
accelerometer carla.Vector3D Measures linear acceleration in m/s^2.
gyroscope carla.Vector3D Measures angular velocity in rad/sec.
compass float Orientation in radians. North is (0.0, -1.0, 0.0) in UE.

激光雷达

激光雷达属性
Blueprint attribute Type Default Description
channels int 32 Number of lasers.
range float 10.0 Maximum distance to measure/raycast in meters (centimeters for CARLA 0.9.6 or previous).
points_per_second int 56000 Points generated by all lasers per second.
rotation_frequency float 10.0 Lidar rotation frequency.
upper_fov float 10.0 Angle in degrees of the highest laser.
lower_fov float -30.0 Angle in degrees of the lowest laser.
sensor_tick float 0.0 Simulation seconds between sensor captures (ticks).


输出属性
Sensor data attribute Type Description
frame int Frame number when the measurement took place.
timestamp double Simulation time of the measurement in seconds since the beginning of the episode.
transform carla.Transform Location and rotation in world coordinates of the sensor at the time of the measurement.
horizontal_angle float Angle (radians) in the XY plane of the lidar this frame.
channels int Number of channels (lasers) of the lidar.
get_point_count(channel) int Number of points per channel captured this frame.
raw_data bytes Array of 32-bits floats (XYZ of each point).

障碍物检测传感器

在没有感知算法的情况下获取ego车辆前方的障碍物。

Blueprint attribute Type Default Description
distance float 5 Distance to trace.
hit_radius float 0.5 Radius of the trace.
only_dynamics bool false If true, the trace will only consider dynamic objects.
debug_linetrace bool false If true, the trace will be visible.
sensor_tick float 0.0 Simulation seconds between sensor captures (ticks).
输出属性
Sensor data attribute Type Description
frame int Frame number when the measurement took place.
timestamp double Simulation time of the measurement in seconds since the beginning of the episode.
transform carla.Transform Location and rotation in world coordinates of the sensor at the time of the measurement.
actor carla.Actor Actor that detected the obstacle (parent actor).
other_actor carla.Actor Actor detected as an obstacle.
distance float Distance from actor to other_actor.

毫米波雷达传感器

Blueprint attribute Type Default Description
horizontal_fov float 30 Horizontal field of view in degrees.
points_per_second int 1500 Points generated by all lasers per second.
range float 100 Maximum distance to measure/raycast in meters.
sensor_tick float 0.0 Simulation seconds between sensor captures (ticks).
vertical_fov float 30 Vertical field of view in degrees.

Output attributes

Sensor data attribute Type Description
raw_data list(carla.RadarDetection) The list of points detected
RadarDetection attributes Type Description
altitude float Altitude angle in radians.
azimuth float Azimuth angle in radians.
depth float Distance in meters.
velocity float Velocity towards the sensor.

RGB摄像头

基本摄像头属性
Blueprint attribute Type Default Description
fov float 90.0 Horizontal field of view in degrees.
fstop float 1.4 Opening of the camera lens. Aperture is 1 / fstop with typical lens going down to f / 1.2 (larger opening). Larger numbers will reduce the Depth of Field effect.
image_size_x int 800 Image width in pixels.
image_size_y int 600 Image height in pixels.
iso float 1200.0 The camera sensor sensitivity.
gamma float 2.2 Target gamma value of the camera.
sensor_tick float 0.0 Simulation seconds between sensor captures (ticks).
shutter_speed float 60.0 The camera shutter speed in seconds (1.0 / s).


摄像头镜头属性
Blueprint attribute Type Default Description
lens_circle_falloff float 5.0 Range: [0.0, 10.0]
lens_circle_multiplier float 0.0 Range: [0.0, 10.0]
lens_k float -1.0 Range: [-inf, inf]
lens_kcube float 0.0 Range: [-inf, inf]
lens_x_size float 0.08 Range: [0.0, 1.0]
lens_y_size float 0.08 Range: [0.0, 1.0]


高级摄像头属性
Blueprint attribute Type Default Description
min_fstop float 1.2 Maximum aperture.
blade_count int 5 Number of blades that make up the diaphragm mechanism.
exposure_mode str "manual" Can be "manual" or "histogram". More in [UE4 docs][AutomaticExposure.gamesetting].
exposure_compensation float 3.0 Logarithmic adjustment for the exposure. 0: no adjustment, -1:2x darker, -2:4 darker, 1:2x brighter, 2:4x brighter.
exposure_min_bright float 0.1 In exposure_mode: "histogram". Minimum brightness for auto exposure. The lowest the eye can adapt within. Must be greater than 0 and less than or equal to exposure_max_bright.
exposure_max_bright float 2.0 In exposure_mode: "histogram". Maximum brightness for auto exposure. The highestthe eye can adapt within. Must be greater than 0 and greater than or equal to exposure_min_bright.
exposure_speed_up float 3.0 In exposure_mode: "histogram". Speed at which the adaptation occurs from dark to bright environment.
exposure_speed_down float 1.0 In exposure_mode: "histogram". Speed at which the adaptation occurs from bright to dark environment.
calibration_constant float 16.0 Calibration constant for 18% albedo.
focal_distance float 1000.0 Distance at which the depth of field effect should be sharp. Measured in cm (UE units).
blur_amount float 1.0 Strength/intensity of motion blur.
blur_radius float 0.0 Radius in pixels at 1080p resolution to emulate atmospheric scattering according to distance from camera.
motion_blur_intensity float 0.45 Strength of motion blur [0,1].
motion_blur_max_distortion float 0.35 Max distortion caused by motion blur. Percentage of screen width.
motion_blur_min_object_screen_size float 0.1 Percentage of screen width objects must have for motion blur, lower value means less draw calls.
slope float 0.88 Steepness of the S-curve for the tonemapper. Larger values make the slope steeper (darker) [0.0, 1.0].
toe float 0.55 Adjusts dark color in the tonemapper [0.0, 1.0]
shoulder float 0.26 Adjusts bright color in the tonemapper [0.0, 1.0]
black_clip float 0.0 This should NOT be adjusted. Sets where the crossover happens and black tones start to cut off their value [0.0, 1.0].
white_clip float 0.04 Set where the crossover happens and white tones start to cut off their value. Subtle change in most cases [0.0, 1.0].
temp float 6500.0 White balance in relation to the temperature of the light in the scene. White light: when this matches light temperature. Warm light: When higher than the light in the scene, it is a yellowish color. Cool light: When lower than the light. Blueish color.
tint float 0.0 White balance temperature tint. Adjusts cyan and magenta color ranges. This should be used along with the white balance Temp property to get accurate colors. Under some light temperatures, the colors may appear to be more yellow or blue. This can be used to balance the resulting color to look more natural.
chromatic_aberration_intensity float 0.0 Scaling factor to control color shifting, more noticeable on the screen borders.
chromatic_aberration_offset float 0.0 Normalized distance to the center of the image where the effect takes place.
enable_postprocess_effects bool True Post-process effects activation.
输出属性
Sensor data attribute Type Description
frame int Frame number when the measurement took place.
timestamp double Simulation time of the measurement in seconds since the beginning of the episode.
transform carla.Transform Location and rotation in world coordinates of the sensor at the time of the measurement.
width int Image width in pixels.
height int Image height in pixels.
fov float Horizontal field of view in degrees.
raw_data bytes Array of BGRA 32-bit pixels.

语义分割摄像头

Value Tag Converted color
0 Unlabeled ( 0, 0, 0)
1 Building ( 70, 70, 70)
2 Fence (190, 153, 153)
3 Other (250, 170, 160)
4 Pedestrian (220, 20, 60)
5 Pole (153, 153, 153)
6 Road line (157, 234, 50)
7 Road (128, 64, 128)
8 Sidewalk (244, 35, 232)
9 Vegetation (107, 142, 35)
10 Car ( 0, 0, 142)
11 Wall (102, 102, 156)
12 Traffic sign (220, 220, 0)
基本摄像头属性
Blueprint attribute Type Default Description
fov float 90.0 Horizontal field of view in degrees.
image_size_x int 800 Image width in pixels.
image_size_y int 600 Image height in pixels.
sensor_tick float 0.0 Simulation seconds between sensor captures (ticks).


摄像头镜头属性
Blueprint attribute Type Default Description
lens_circle_falloff float 5.0 Range: [0.0, 10.0]
lens_circle_multiplier float 0.0 Range: [0.0, 10.0]
lens_k float -1.0 Range: [-inf, inf]
lens_kcube float 0.0 Range: [-inf, inf]
lens_x_size float 0.08 Range: [0.0, 1.0]
lens_y_size float 0.08 Range: [0.0, 1.0]


输出属性
Sensor data attribute Type Description
fov float Horizontal field of view in degrees.
frame int Frame number when the measurement took place.
height int Image height in pixels.
raw_data bytes Array of BGRA 32-bit pixels.
timestamp double Simulation time of the measurement in seconds since the beginning of the episode.
transform carla.Transform Location and rotation in world coordinates of the sensor at the time of the measurement.
width int Image width in pixels.

运动轨迹控制

沿着航点行进,需要自己根据车辆的控制属性来进行算法的编写。

道路参数

  • road ID carla.Waypoint.road_id
  • section ID carla.Waypoint.section_id
  • lane ID carla.Waypoint.lane_id
  • s carla.Waypoint.s
  • is junction(bool)
  • lane width carla.Waypoint.lane_width
  • lane type carla.Waypoint.lane_type
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 216,997评论 6 502
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,603评论 3 392
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 163,359评论 0 353
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,309评论 1 292
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,346评论 6 390
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,258评论 1 300
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,122评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,970评论 0 275
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,403评论 1 313
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,596评论 3 334
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,769评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,464评论 5 344
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,075评论 3 327
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,705评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,848评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,831评论 2 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,678评论 2 354