前言:由CJ大哥以官方文档,对Carla Scenario Runner的探索,通过ros-bridge搭起的;如果不走ros-bridge可以尝试leaderboard那边。但其实如果真的做商业的算法测试,建议使用商业仿真的平台,以小钱钱能够搞定的事,就别 人继续探索了,Carla我觉得还是适合个人学习使用,采采数据 用用ground truth做初步验证,没有实车的时候 开开车啥的。

Scenario Runner是Carla仿真器里自带的一些场景测试,主要用来测试自身的算法,可以进行单元测试,也可以进行整体的测试等,以下为参考官方的文档,CJ大哥探索后写的中文版

1. 安装

1.1 下载:注意需要下载对应carla版本的Scenario Runner (SR)

Releases · carla-simulator/scenario_runner

1.2 安装依赖: 建议使用conda环境

cd xxx/scenario_runner-0.9.11#Python 2.x
sudo apt remove python-networkx #if installed, remove old version of networkx
pip2 install --user -r requirements.txt
#Python 3.x
sudo apt remove python3-networkx #if installed, remove old version of networkx
pip3 install --user -r requirements.txt

1.3 添加环境变量

export CARLA_ROOT=/path/to/your/carla/installation
export PYTHONPATH=$PYTHONPATH:${CARLA_ROOT}/PythonAPI/carla/dist/carla-<VERSION>.egg:${CARLA_ROOT}/PythonAPI/carla/agents:${CARLA_ROOT}/PythonAPI/carla
export SCENARIO_RUNNER_PATH=<path_to_scenario_runner>

2. 运行 SR example

./CarlaUE4.sh
python scenario_runner.py --scenario FollowLeadingVehicle_1 --reloadWorld
python manual_control.py

这只是相当于生成了world环境,车辆控制还需要运行自己的程序调用carla pythonAPI 进行控制

python scenario_runner.py --list
可以看到所有的场景

也可以通过Group:运行一类场景。命令如下;

python scenario_runner.py --scenario group:FollowLeadingVehicle

下面是所有场景类型

  • List of scenarios

    FollowLeadingVehicle
    The scenario realizes a common driving behavior, in which the user-controlled ego vehicle follows a leading car driving down a given road in Town01. At some point the leading car slows down and finally stops. The ego vehicle has to react accordingly to avoid a collision. The scenario ends either via a timeout, or if the ego vehicle stopped close enough to the leading vehicle

    FollowLeadingVehicleWithObstacle
    This scenario is very similar to ‘FollowLeadingVehicle’. The only difference is, that in front of the leading vehicle is a (hidden) obstacle that blocks the way.

    VehicleTurningRight
    In this scenario the ego vehicle takes a right turn from an intersection where a cyclist suddenly drives into the way of the ego vehicle,which has to stop accordingly. After some time, the cyclist clears the road, such that ego vehicle can continue driving.

    VehicleTurningLeft
    This scenario is similar to ‘VehicleTurningRight’. The difference is that the ego vehicle takes a left turn from an intersection.

    OppositeVehicleRunningRedLight
    In this scenario an illegal behavior at an intersection is tested. An other vehicle waits at an intersection, but illegally runs a red traffic light. The approaching ego vehicle has to handle this situation correctly, i.e. despite of a green traffic light, it has to stop and wait until the intersection is clear again. Afterwards, it should continue driving.

    StationaryObjectCrossing
    In this scenario a cyclist is stationary waiting in the middle of the road and blocking the way for the ego vehicle. Hence, the ego vehicle has to stop in front of the cyclist.

    DynamicObjectCrossing
    This is similar to ‘StationaryObjectCrossing’, but with the difference that the cyclist is dynamic. It suddenly drives into the way of the ego vehicle, which has to stop accordingly. After some time, the cyclist will clear the road, such that the ego vehicle can continue driving.

    NoSignalJunctionCrossing
    This scenario tests negotiation between two vehicles crossing cross each other through a junction without signal. The ego vehicle is passing through a junction without traffic lights And encounters another vehicle passing across the junction. The ego vehicle has to avoid collision and navigate across the junction to succeed.

    ControlLoss
    In this scenario control loss of a vehicle is tested due to bad road conditions, etc and it checks whether the vehicle is regained its control and corrected its course.

    ManeuverOppositeDirection
    In this scenario vehicle is passing another vehicle in a rural area, in daylight, under clear weather conditions, at a non-junction and encroaches into another vehicle traveling in the opposite direction.

    OtherLeadingVehicle
    The scenario realizes a common driving behavior, in which the user-controlled ego vehicle follows a leading car driving down a given road. At some point the leading car has to decelerate. The ego vehicle has to react accordingly by changing lane to avoid a collision and follow the leading car in other lane. The scenario ends via timeout, or if the ego vehicle drives certain distance.

    SignalizedJunctionRightTurn
    In this scenario right turn of hero actor without collision at signalized intersection is tested. Hero Vehicle is turning right in an urban area, at a signalized intersection and turns into the same direction of another vehicle crossing straight initially from a lateral direction.

    SignalizedJunctionLeftTurn
    In this scenario hero vehicle is turning left in an urban area, at a signalized intersection and cuts across the path of another vehicle coming straight crossing from an opposite direction.

此外,在运行时可以对运行情况进行录制,并在Carla中回放

python scenario_runner.py --scenario <scenario_name> --record <path/to/save/the/recorder/file>
在python脚本中通过
client.replay_file("recording01.log", start, duration, camera)
进行回放

3. 场景设置

SR 有两种模式,一种是继承基类自己写脚本,还没试过,详见官方doc

Create a new scenario - CARLA ScenarioRunner

另一种是直接加载OpenSCENARIO的xosc文件

OpenSCENARIO support - CARLA ScenarioRunner

4. 使用carla ros_bridge启动 SR

建议使用master版本的ros-bridge,旧版本都有很多bug

carla-simulator/ros-bridge

运行demo (跟车场景)

roslaunch carla_ad_demo carla_ad_demo_with_scenario.launch

点击左下角的 Excute 就会开始场景

不想用carla的demo agent的话可以参考上面的launch文件,将agent改成自己的程序

5. 已知问题

  1. ros_bridge里通过process在新进程里启动SR,导致新进程貌似不会自动activate conda的环境,我是自己在系统python里也装了依赖才能正常启动,更好的解决方法有待探索

    update: 好像发现了原因, 但是还需看看怎么添加conda的环境变量

  2. unicode错误,已在master分支解决,旧版本需要自己改一下

  3. xosc文件里 ScenarioObject的name需要和carla设置的一致, 比如你是ego_vehicle 就需要改成ego_vehicle

  4. ros_bridge目前貌似只支持了OpenSCENARIO的文件格式,python方式有待日后更新

    Support python scenario in carla_ros_scenario_runner by jeonghoahn42 · Pull Request #396 · carla-simulator/ros-bridge

【仿真】Carla的Scenario Runner [5] (ros-bridge版)相关推荐

  1. 获取CARLA插件SCENARIO RUNNER

    获取CARLA插件SCENARIO RUNNER 前言 一.下载SCENARIO RUNNER 二.环境配置 1.打开电脑的环境变量 2.运行Scenario Runner 总结 前言 例如:在上一篇 ...

  2. Ununtu 18.04 安装Carla 0.9.13 以及Carla ros bridge 超级避坑指南(更新于2022.10.20)

    Carla0.9.13 以及Carla ros bridge 超级避坑指南 Carla0.9.13 以及Carla ros bridge 超级避坑指南 站在巨人肩膀前进 显卡驱动问题 首先就是虚幻4的 ...

  3. Carla:ROS bridge installation for ROS 1

    官方教程:Install ROS Bridge for ROS 1 - CARLA Simulator A. 使用 Debian 存储库 1. Set up the Debian repository ...

  4. [carla入门教程]-5 使用ROS与carla通信

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

  5. Aubo i5真机 ros - melodic 版驱动下载 [ 驱动下载 ]

    Aubo i5真机melodic 驱动下载 melodic源码下载,官网未更新 ros - melodic 版驱动,此驱动是优化后的,经过测试可正常运行; 链接:https://pan.baidu.c ...

  6. ros标准版Action通讯

    ros标准版Action通讯 Action通讯模型 Action通讯模型组成¶ ROS中,节点与节点间通讯,提供了新的方式,就是Action通讯. Action通讯分为Client端和Server端, ...

  7. ros简版Action通讯SimpleAction

    ros简版Action通讯SimpleAction 一.python 1.非ui界面版 1.1client.py #!/usr/bin/env python # coding:utf-8 import ...

  8. 计算机可视化视景仿真,计算与仿真、三维设计、图像处理、视景仿真、4k视频剪辑工作站介绍2015版.pptx...

    计算与仿真.三维设计.图像处理.视景仿真.4k视频剪辑工作站介绍2015版 图形工作站的历史.现状与品牌差异分类过去(2008年前)现在品牌IBMSUNSGIHP/DELL/联想UltraLAB硬件各 ...

  9. 在Ubuntu 18.04 LTS安装ROS Melodic版机器人操作系统(2019年10月更新MoveIt! 1.0 ROS 2.0 Dashing)

    ROS Melodic版本在2018年5月23日推出正式版,这是ROS第三款长期支持版本,前2版LTS分别为:indigo(14.04):kinetic(16.04).此版本有windows版已经推出 ...

最新文章

  1. 云的普及难易,云计算普及的难易
  2. Mysql访问新数据时先查表
  3. Golang 汇编入门知识总结
  4. 使用opencv和python进行智能图像处理_使用OpenCV在Python中进行图像处理
  5. Gradle依赖的统一管理
  6. End Game----OO最后一次博客作业
  7. switchyomega规则列表备份_一键备份微博并导出生成PDF,顺便用Python分析微博账号数据...
  8. 广州物流展相关的个人总结
  9. 【FinE】资本市场理论(1) CAPM模型
  10. 户外运动装备新品--云息智能定位胸牌
  11. 自然语言处理(NLP)入门(二)
  12. 邮箱登录入口,163邮箱个人登录入口,163邮箱注册登录
  13. GPIO端口初始化设置,STM32F103点亮LED流水灯过程
  14. ESXi无法直通显卡
  15. springboot生成接口文档
  16. 《Python机器学习算法》的写作历程
  17. 国产光刻机再突破后,能实现7nm芯片量产?专家:别再盲目自大
  18. 彻底理解并解决服务器出现大量TIME_WAIT - 第四篇
  19. 区块链论语:公链可能是永无止息的战争
  20. 'login.html?error' is not a valid redirect URL

热门文章

  1. Vue之引用第三方JS插件,CKPlayer使用
  2. ora_reco_070361 hs message to agent event 等待事件
  3. 去除stackoverflow页面上关不掉的cookie弹窗
  4. matlab、python打字变红,格式错误问题
  5. 每日安全简讯20160719
  6. 在字符串中查找指定字符
  7. Array数组方法-mdn
  8. 6.C语言 二维数组
  9. vuex 源码分析_vue源码解析之vuex原理
  10. AtCoder Regular Contest 084