http://carla.org/
https://github.com/carla-simulator/carla/releases
https://github.com/carla-simulator/scenario_runner/releases/tag/v0.9.12
https://carla.readthedocs.io/en/latest/
https://www.carla.org.cn/#/
https://carla.readthedocs.io/projects/ros-bridge/en/stable/
https://carla-scenariorunner.readthedocs.io/en/latest/
下载后,无需编译,直接运行就可以启动carla;
带画面的启动:
./CarlaUE4.sh
不带画面的启动:
./CarlaUE4.sh -RenderOffScreen
在~/.bashrc文件中添加如下(填写实际的carla路径):
# carla
export CARLA_ROOT=/media/gkk/Data/03_Proj/30_CARLA/CARLA_0.9.12
export PYTHONPATH=$PYTHONPATH:$CARLA_ROOT/PythonAPI/carla/dist/carla-0.9.12-py2.7-linux-x86_64.egg:$CARLA_ROOT/PythonAPI/carla
export SCENARIO_RUNNER_ROOT=/media/gkk/Data/03_Proj/30_CARLA/scenario_runner-0.9.12
export SCENARIO_RUNNER_PATH=/media/gkk/Data/03_Proj/30_CARLA/scenario_runner-0.9.12
export PYTHONPATH=$PYTHONPATH:$SCENARIO_RUNNER_ROOT:$SCENARIO_RUNNER_PATH
建立标准的ros-pkg目录,例如:carla_ros/src/ros-bridge;
使用catkin或者catkin_make工具编译;
将source …/carla_ros/devel/set_up.bash命令添加到文件~/.bashrc中;
提供了CARLA仿真环境与ros的信息转接功能;
主要ros接口如下:
Publications
* /carla/actor_list [carla_msgs/CarlaActorList]
* /carla/ego_vehicle/collision [carla_msgs/CarlaCollisionEvent] # 本车碰撞信息
* /carla/ego_vehicle/depth_front/camera_info [sensor_msgs/CameraInfo]
* /carla/ego_vehicle/depth_front/image [sensor_msgs/Image]
* /carla/ego_vehicle/dvs_front/camera_info [sensor_msgs/CameraInfo]
* /carla/ego_vehicle/dvs_front/events [sensor_msgs/PointCloud2]
* /carla/ego_vehicle/dvs_front/image [sensor_msgs/Image]
* /carla/ego_vehicle/gnss [sensor_msgs/NavSatFix] # GPS信息
* /carla/ego_vehicle/imu [sensor_msgs/Imu] # IMU信息
* /carla/ego_vehicle/lane_invasion [carla_msgs/CarlaLaneInvasionEvent]
* /carla/ego_vehicle/lidar [sensor_msgs/PointCloud2] # 激光雷达点云数据
* /carla/ego_vehicle/objects [derived_object_msgs/ObjectArray]
* /carla/ego_vehicle/odometry [nav_msgs/Odometry] # 里程话题包含,定位信息,速度信息;
* /carla/ego_vehicle/radar_front [sensor_msgs/PointCloud2]
* /carla/ego_vehicle/rgb_front/camera_info [sensor_msgs/CameraInfo]
* /carla/ego_vehicle/rgb_front/image [sensor_msgs/Image]
* /carla/ego_vehicle/rgb_view/camera_info [sensor_msgs/CameraInfo]
* /carla/ego_vehicle/rgb_view/image [sensor_msgs/Image] # 第三视角图像信息
* /carla/ego_vehicle/semantic_lidar [sensor_msgs/PointCloud2]
* /carla/ego_vehicle/semantic_segmentation_front/camera_info [sensor_msgs/CameraInfo]
* /carla/ego_vehicle/semantic_segmentation_front/image [sensor_msgs/Image]
* /carla/ego_vehicle/speedometer [std_msgs/Float32]
* /carla/ego_vehicle/vehicle_info [carla_msgs/CarlaEgoVehicleInfo]
* /carla/ego_vehicle/vehicle_status [carla_msgs/CarlaEgoVehicleStatus]
* /carla/map [std_msgs/String]
* /carla/markers [visualization_msgs/MarkerArray] # 场景物体的marker(默认只有本车和其它可运动车辆)
* /carla/markers/static [visualization_msgs/MarkerArray]
* /carla/objects [derived_object_msgs/ObjectArray]
* /carla/status [carla_msgs/CarlaStatus]
* /carla/traffic_lights/info [carla_msgs/CarlaTrafficLightInfoList]
* /carla/traffic_lights/status [carla_msgs/CarlaTrafficLightStatusList]
* /carla/world_info [carla_msgs/CarlaWorldInfo]
* /clock [rosgraph_msgs/Clock]
* /rosout [rosgraph_msgs/Log]
* /tf [tf2_msgs/TFMessage] # 本车ego_vehicle与map,已经本车传感器的tf关系;
Subscriptions
* /carla/control [carla_msgs/CarlaControl]
* /carla/debug_marker [visualization_msgs/MarkerArray] # 可将marker显示到carla环境中;
* /carla/ego_vehicle/control/set_target_velocity [geometry_msgs/Twist] # 控制ego_vehicle按照此速度运动(不受运动学约束)
* /carla/ego_vehicle/control/set_transform [unknown type]
* /carla/ego_vehicle/enable_autopilot [std_msgs/Bool] # 使能自动驾驶(时能后,本车漫无目的运动,会避免碰撞并遵守交通规则)
* /carla/ego_vehicle/rgb_view/control/set_target_velocity [unknown type]
* /carla/ego_vehicle/rgb_view/control/set_transform [unknown type]
* /carla/ego_vehicle/vehicle_control_cmd [carla_msgs/CarlaEgoVehicleControl] # 非手动模式的控制量(油门\刹车\方向盘)
* /carla/ego_vehicle/vehicle_control_cmd_manual [carla_msgs/CarlaEgoVehicleControl] # 手动控制量
* /carla/ego_vehicle/vehicle_control_manual_override [std_msgs/Bool] # 是否启用手动控制
* /carla/weather_control [unknown type] # 场景天气
* /clock [rosgraph_msgs/Clock]
Services
* /carla/destroy_object
* /carla/get_blueprints
* /carla/spawn_object
* /carla_ros_bridge/get_loggers
* /carla_ros_bridge/set_logger_level
/carla/ego_vehicle/vehicle_info;
/carla/ego_vehicle/vehicle_status;
/carla/ego_vehicle/vehicle_control_cmd;
该模块根据ackerman指令,生成控制车辆底盘的油门\刹车\档位\手刹等量;
方向盘控制
output.steer = target.streering_angle/max_steering_angle;(归一化)
输出的方向盘控制量为归一化的值;
停车与档位控制
(1) 若 current_speed_abs < 0.1: (在低速下执行换挡与手刹动作)
if target_speed_abs < 0.001: 手刹;
else if target_speed > 0: D档;
else : R档位;
(2) 当实际车速与目标车速正负相反时:设定参考车速为0(通过控制回路执行减速);
速度控制回路
若ackerman指令有加速度,则直接利用此加速度信息作为输出:acc_target = acc_from_ackerman;
否则,执行速度调节:
acc_delta = PID(reference_speed, current_speed);
acc_target = acc_target + acc_delta;
加速度控制回路
根据目标加速度和实际加速度的差值,通过PID调节,计算出油门刹车开度值的增量;
pedal_delta = PID(acc_target, acc_feedback);
pedal_target = pedal_target + pedal_delta;
底盘控制量生成
将开度值分成了三个等级:油门踏板输出,油门与刹车都不输出,刹车踏板输出;
若 pedal_target > throttle_lower_border:
throttle = pedal_target - throttle_lower_border;
brake = 0.0;
若 brake_upper_border <= pedal_target <= throttle_lower_border:
throttle = 0.0;
brake = 0.0;
若 pedal_target < brake_upper_border:
throttle = 0.0;
brake = brake_upper_border - pedal_target;
在此ros包中有两个节点:
carla_ad_agent,根据红绿灯控制车辆的目标速度;
local_planner,生成控制车辆运动的底盘指令;
在参考路径上选择前瞻点,根据前瞻点与实际位置做横纵向的运动控制;