Recorder(记录器)

This feature allows to record and reenact a previous simulation. All the events happened are registered in the recorder file. There are some high-level queries to trace and study those events.
这个特性允许记录和重新执行以前的模拟。所有发生的事件都注册在记录文件中。有一些高级查询可以跟踪和研究这些事件。
• Recording
• Simulation playback
o Setting a time factor
• Recorded file
• Queries
o Collisions
o Blocked actors
• Sample Python scripts


Recording
All the data is written in a binary file on the server side only. However, the recorder is managed using the carla.Client.
所有数据仅在服务器端以二进制文件形式写入。但是,记录器是使用kara . client管理的。

Actors are updated on every frame according to the data contained in the recorded file. Actors in the current simulation that appear in the recording will be either moved or re-spawned to emulate it. Those that do not appear in the recording will continue their way as if nothing happened.

根据记录文件中包含的数据,在每一帧上对参与者进行更新。在当前模拟记录中出现的参与者将被移动或重新生成以模拟它。那些没有出现在记录中的参与者将继续他们的方式,就像什么也没有发生过一样。
Important
By the end of the playback, vehicles will be set to autopilot, but pedestrians will stop.
在回放结束时,车辆将被设置为自动驾驶,但行人将停止。
The recorder file includes information regarding many different elements.

记录器文件中包含很多不同元素的信息
• Actors — creation and destruction, bounding and trigger boxes.
• 演员:创建和毁灭(清除),边界(包围)和触发盒子
• Traffic lights — state changes and time settings.
• 交通灯的状态转换和时间设定
• Vehicles — position and orientation, linear and angular velocity, light state, and physics control.
• 车辆的位置和方向、线速度和角速度、车灯状态和物理位置
• Pedestrians — position and orientation, and linear and angular velocity.
• 行人的位置和方向、线速度和角速度,
• Lights — Light states from buildings, streets, and vehicles.
• 灯光:建筑物、街道和车辆灯光的状态

To start recording there is only need for a file name.
要开始记录,仅需要一个文件名
Using , / or : characters in the file name will define it as an absolute path. If no path is detailed, the file will be saved in CarlaUE4/Saved.
在文件名中使用\、/或:字符将其定义为绝对路径。如果没有详细的路径,文件将保存在CarlaUE4/ saved中。

client.start_recorder("/home/carla/recording01.log")
By default, the recorder is set to store only the necessary information to play the simulation back. In order to save all the information previously mentioned, the argument additional_data has to be configured when starting the recording.
默认情况下,记录器被设置为只存储回放模拟所需的信息。为了保存前面提到的所有信息,必须在开始记录时配置额外的参数additional_data。
client.start_recorder("/home/carla/recording01.log", True)
Note
Additional data includes: linear and angular velocity of vehicles and pedestrians, traffic light time settings, execution time, actors’ trigger and bounding boxes, and physics controls for vehicles.
附加数据包括:车辆和行人的线速度和角速度,交通灯时间设置,执行时间,演员的触发器和边界盒,以及车辆的物理控制。
To stop the recording, the call is also straightforward.
为了停止记录,对应的调用也是非常直接的。
client.stop_recorder()
Note
As an estimate, 1h recording with 50 traffic lights and 100 vehicles takes around 200MB in size.
据估计,50个红绿灯,100辆车记录1h,大约需要200MB大小的存储空间。


Simulation playback(仿真的回放)
A playback can be started at any point during a simulation. Besides the path to the log file, this method needs some parameters.
回放可以在模拟过程中的任何时刻启动。除了日志文件的路径外,该方法还需要一些参数。
client.replay_file(“recording01.log”, start, duration, camera)
Parameter Description Notes
start Recording time in seconds to start the simulation at. If positive, time will be considered from the beginning of the recording. If negative, it will be considered from the end.
duration Seconds to playback. 0 is all the recording. By the end of the playback, vehicles will be set to autopilot and pedestrians will stop.
camera ID of the actor that the camera will focus on. Set it to 0 to let the spectator move freely.

Setting a time factor
设定一个时间因子
The time factor will determine the playback speed. It can be changed any moment without stopping the playback.
播放的速度将由时间因子来决定,可以随时改变时间因子而不停止仿真的回放。
client.set_replayer_time_factor(2.0)
Parameter Default Fast motion Slow motion
time_factor 1.0 >1.0 <1.0

Important
If time_factor>2.0, the actors’ position interpolation is disabled and just updated. Pedestrians’ animations are not affected by the time factor.
如果time_factor>2.0,则禁用actor的位置插值,而只是更新。行人的动画不受时间因素的影响。
When the time factor is around 20x traffic flow is easily appreciated.
当时间因子在20x左右时,交通流易于识别。


Recorded file
The details of a recording can be retrieved using a simple API call. By default, it only retrieves those frames where an event was registered. Setting the parameter show_all would return all the information for every frame. The specifics on how the data is stored are detailed in the recorder’s reference.
可以使用一个简单的API调用检索记录的详细信息。默认情况下,它只提取/回放记录了事件的那些帧。设置参数show_all将返回每一帧的所有信息。关于数据如何存储的细节在记录器的引用( recorder’s reference)中有详细说明。

Show info for relevant frames

print(client.show_recorder_file_info(“recording01.log”))
• Opening information. Map, date and time when the simulation was recorded.(打开的信息:当仿真被记录时的地图,日期和时间)
• Frame information. Any event that could happen such as actors spawning or collisions. It contains the actors’ ID and some additional information.
• 帧的信息:任何可能发生的事件,如演员的产生或碰撞。它包含参与者的ID和一些附加信息。
• Closing information. Number of frames and total time recorded.
• 关闭的信息。帧数和总记录时间。
Version: 1
Map: Town05
Date: 02/21/19 10:46:20
Frame 1 at 0 seconds
Create 2190: spectator (0) at (-260, -200, 382.001)
Create 2191: traffic.traffic_light (3) at (4255, 10020, 0)
Create 2192: traffic.traffic_light (3) at (4025, 7860, 0)

Create 2258: traffic.speed_limit.90 (0) at (21651.7, -1347.59, 15)
Create 2259: traffic.speed_limit.90 (0) at (5357, 21457.1, 15)
Frame 2 at 0.0254253 seconds
Create 2276: vehicle.mini.cooperst (1) at (4347.63, -8409.51, 120)
number_of_wheels = 4
object_type =
color = 255,241,0
role_name = autopilot

Frame 2350 at 60.2805 seconds
Destroy 2276
Frame 2351 at 60.3057 seconds
Destroy 2277

Frames: 2354
Duration: 60.3753 seconds


Queries(查询)
Collisions
Vehicles must have a collision detector attached to record collisions. These can be queried, using arguments to filter the type of the actors involved in the collisions. For example, h identifies actors whose role_name = hero, usually assigned to vehicles managed by the user. There is a specific set of actor types available for the query.
车辆上必须要附加一个碰撞检测器以对碰撞情况进行记录。可以通过使用参数来过滤冲突中涉及的参与者的类型来查询这些内容。例如,h代表role_name = hero,这一角色。通常分配给由用户管理的车辆。查询中有一组特定的参与者类型。
• h = Hero
• v = Vehicle
• w = Walker
• t = Traffic light
• o = Other
• a = Any

Note
The manual_control.py script assigns role_name = hero for the ego vehicle.
manual_control.py脚本中将role_name = hero分配为自主车辆。
The collision query requires two flags to filter the collisions. The following example would show collisions between vehicles, and any other object.
(碰撞)冲突查询需要两个标志来过滤冲突。下面的示例将显示车辆和任何其他对象之间的碰撞。
print(client.show_recorder_collisions(“recording01.log”, “v”, “a”))
The output summarizes time of the collision, and type, ID and description of the actors involved.

Version: 1
Map: Town05
Date: 02/19/19 15:36:08

Time  Types     Id Actor 1                                      Id Actor 216   v v     122 vehicle.yamaha.yzf                     118 vehicle.dodge_charger.police27   v o     122 vehicle.yamaha.yzf                       0

Frames: 790
Duration: 46 seconds
Important
As it is the hero or ego vehicle who registers the collision, this will always be Actor 1.
因为记录碰撞的是英雄或自主车辆,所以这将永远是演员1。
The collision can be reenacted by using the recorder and setting it seconds before the event.
通过使用记录器并在事件发生前几秒设置它,可以重现碰撞发生的过程。
client.replay_file(“col2.log”, 13, 0, 122)
In this case, the playback showed this.
Blocked actors(被堵塞的演员)
Detects vehicles that where stucked during the recording. An actor is considered blocked if it does not move a minimum distance in a certain time. This definition is made by the user during the query.
检测车辆在哪里停留在记录期间。如果actor在一定时间内没有移动最小距离,则认为它被阻塞了。这个定义是由用户在查询期间做出的。(默认为30s,10厘米)
print(client.show_recorder_actors_blocked(“recording01.log”, min_time, min_distance))
Parameter Description Default
min_time Minimum seconds to move min_distance. 30secs.
min_distance Minimum centimeters to move to not be considered blocked. 10cm.

Note
Sometimes vehicles are stopped at traffic lights for longer than expected.
有时车辆停在红绿灯前的时间比预期的要长。
下面的例子认为车辆在60秒内移动不到1米时将被认定为阻塞。
The following example considers that vehicles are blocked when moving less than 1 meter during 60 seconds.
client.show_recorder_actors_blocked(“col3.log”, 60, 100)
The output is sorted by duration, which states how long it took to stop being “blocked” and move the min_distance.
输出按持续时间排序,它表示停止“阻塞”和移动min_distance所需的时间。
Version: 1
Map: Town05
Date: 02/19/19 15:45:01
Time Id Actor Duration
36 173 vehicle.nissan.patrol 336
75 214 vehicle.chevrolet.impala 295
302 143 vehicle.bmw.grandtourer 67
Frames: 6985
Duration: 374 seconds
The vehicle 173 was stopped for 336 seconds at time 36 seconds. Reenact the simulation a few seconds before the second 36 to check it out.
client.replay_file(“col3.log”, 34, 0, 173)


Sample python scripts(简单的Python脚本)
Some of the provided scripts in PythonAPI/examples facilitate the use of the recorder.
在PythonAPI/examples中提供的一些脚本有助于使用记录器。
• start_recording.py starts the recording. The duration of the recording can be set, and actors can be spawned at the beginning of it.
• start_record .py开始记录。可以设置记录的持续时间,并且可以在开始时生成参与者。

Parameter Description
-f Filename.
-n (optional) Vehicles to spawn. Default is 10.
-t (optional) Duration of the recording.

• start_replaying.py starts the playback of a recording. Starting time, duration, and actor to follow can be set.
• start_replaying.py开始记录的回放。可以设置启动时间、持续时间和要跟随的演员。

Parameter Description
-f Filename.
-s (optional) Starting time. Default is 10.
-d (optional) Duration. Default is all.
-c (optional) IDof the actor to follow.

• show_recorder_file_info.py shows all the information in the recording file. By default, it only shows frames where an event is recorded. However, all of them can be shown.
• show_recorder_file_info.py显示记录文件中的所有信息。默认情况下,它只显示记录事件的帧。然而,所有这些都可以显示出来。

Parameter Description
-f Filename.
-s (optional) Flag to show all details.

• show_recorder_collisions.py shows recorded collisions between two flags of actors of types A and B. -t = vv would show all collisions between vehicles.
• show_recorder_collision .py显示A类和b类演员的两个标志之间记录的碰撞 -t = vv 显示所有车辆之间的碰撞。

Parameter Description
-f Filename.
-t Flags of the actors involved.
h = hero
v = vehicle
w = walker
t = traffic light
o = other
a = any

• show_recorder_actors_blocked.py lists vehicles considered blocked. Actors are considered blocked when not moving a minimum distance in a certain time.
• show_recorder_actors_block .py列出被阻塞的车辆。当演员在一段时间内移动不到最小距离时,就会被认为是被挡住了。

Parameter Description
-f Filename.
-t (optional) Time to move -d before being considered blocked.
-d (optional) Distance to move to not be considered blocked.


Now it is time to experiment for a while. Use the recorder to playback a simulation, trace back events, make changes to see new outcomes.
现在是试验一段时间的时候了。使用记录器回放模拟、追溯事件、进行更改以查看新的结果。

参考链接:https://carla.readthedocs.io/en/0.9.9/adv_recorder/

5. Carla中Recorder(记录器)的使用相关推荐

  1. Java中的记录器 - Java日志示例

    Java中的记录器 - Java日志示例 今天我们将研究Java中的Logger.Java Logger提供了java编程的日志记录. 目录[ 隐藏 ] 1 Java中的记录器 1.1 Java Lo ...

  2. java 记录考勤记录_Java中的记录器– Java记录示例

    java 记录考勤记录 Today we will look into Logger in Java. Java Logger provides logging in java programming ...

  3. (五)carla中世界坐标系与相机坐标系、像素坐标系变换

    (五)carla中世界坐标系与相机坐标系.像素坐标系变换 由于实验需要将 carlacarlacarla 中世界坐标系下的坐标点画到相机采集的前视图上,故需要进行坐标系之间的转换. 转换中遇到的问题 ...

  4. (六) carla中导入AdditionalMaps

    (六) carla中导入AdditionalMaps 前言 carlacarlacarla 中可以通过 world = client.get_world() 来直接让客户端使用当前服务端默认的 wor ...

  5. CARLA中创建新传感器(Create a new sensor in CARLA)

    0 系统配置 Ubuntu 20.04 CARLA 0.9.12 ROS Noetic 1 创建流程与逻辑 写在最前 carla中AActor类含有大量实现函数 头文件位于

  6. [carla入门教程]-3 在carla中遥控汽车并采集传感器数据(一个简单Demo,附代码)

    本专栏教程将记录从安装carla到调用carla的pythonAPI进行车辆操控并采集数据的全流程,带领大家从安装carla开始,到最终能够熟练使用carla仿真环境进行传感器数据采集和车辆控制. 第 ...

  7. Carla中所有的ActorBlueprint及其对应的ActorAttribute(二)

    常常需要用到carla中的ActorBlueprint以及对应的ActorAttribute,所以这里作个备忘 使用如下代码进行输出 import carlaclient = carla.Client ...

  8. 在Carla中创建车辆及传感器

    1. 启动Carla服务器 在电脑中找到CarlaUE4.exe文件,双加运行. 出现如下画面,说明Carla运行成功 2. 创建Carla客户端 创建.py文件,引入必要的库文件和Carla库 im ...

  9. 在Carla中添加新的地图

    参考链接: https://carla.readthedocs.io/en/latest/tuto_A_add_map/ 在Carla中添加新的地图 使用者可以创建自己的地图并且在carla中使用地图 ...

  10. 在Carla中加入可以使用的自己的车

    Step1:导入车辆模型FBX格式,勾选Skeletal Mesh,导入所有 导入后physics,自动生成5个部分碰撞体车身.四个车轮,如图所示: 车辆不是等比例缩小,会造成圆形碰撞体不起作用.如下 ...

最新文章

  1. c# asp.net core取当月第一天和最后一天及删除最后一个字符的多种方法
  2. android 仿ios timepicker,android:TimePicker仿照IOS時間選擇器,可自定義選擇器
  3. Flink1.12.0使用过程中遇到的异常
  4. pythonfromlxml导入html_Python爬虫日记二:使用lxml解析HTML输出对应值
  5. Linux——vim编辑器详解
  6. 备份整合更需要一体机
  7. 在 Mac 上的 Pages 文稿中如何添加和替换文本?
  8. 07版qq默认经典表情下载
  9. (强烈推荐)无线网络密码破解方法
  10. C/C++软件工程师就业求职手册学习笔记---第五章
  11. day16正则表达式作业
  12. trainning-----1
  13. #今日论文推荐# 朱松纯团队最新研究:机器人可与人类“推心置腹”!还说下一步要造“AI大白”
  14. C. The Intriguing Obsession
  15. 抖音通过什么方式变现,抖音变现方式分别有什么
  16. 如何抓取安卓APP日志?
  17. Google Chrome 浏览器——隐藏功能及快捷键
  18. 【线性代数】正交向量与正交子空间
  19. 探索企业即时通讯软件的发展趋势
  20. 检查 Windows 版本与 Windows 更新

热门文章

  1. 【Gym 100015A】Another Rock-Paper-Scissors Problem
  2. 小白刷LeeCode(算法篇)
  3. mysql中explain是什么_MySQL中EXPLAIN的解释_MySQL
  4. 基于模型的系统工程及数字工程技术研讨会
  5. 那一只蝴蝶飞不过沧海
  6. (18)python字符串的使用
  7. javaScript系列 [06]-javaScript和this
  8. LOL开发者谈网游自动化测试:每天10万次
  9. 学生管理系统IPO图_关于继续开展2019年度辅导员工作考核学生评议的通知
  10. POJ-1436___Horizontally Visible Segments —— 线段树