CARLA 0.9.2: Upgraded ROS-bridge, Traffic scenario engine and a new Agent class to perform driving navigation from client side!

Posted by @germanros on December 24, 2018

We end 2018 realising CARLA 0.9.2! This release brings long-time awaited requests such as a new version of the ROS-bridge and new documentation and tutorials. It also introduces our new Scenario Runner, an engine to execute and evaluate agents in a variety of traffic situations. This is a critical piece in the development of CARLA towards achieving our goal of accelerating progress in Autonomous Driving R&D.

Get CARLA 0.9.2

Time to have a look at the highlights of this release!

Simulation of Traffic Scenarios

One of the key aspects of simulation in the field of Autonomous Driving is to explore and reproduce all those traffic situations that occur in real life, with the purpose of learning from them and at the same time to assess how AI algorithms cope with such situations.

Scenario01

Figure 1. Example of traffic scenario: Adversarial vehicle running a stop sign. Emergency brake needed.

Scenario02

Figure 2. Example of traffic scenario: Ego-vehicle losing control due to road bad conditions.

Scenario03

Figure 3. Example of traffic scenario: Adversarial vehicle running a red traffic light. Emergency brake needed.

To this end we have created Scenario_Runner, which serves as our new traffic scenarios engine built on top of the py_trees library. These scenarios are defined following templates in a way that it is possible to reuse general atomic behaviors that emerge in multiple situations. In this release we include some of the basic NHTSA pre-crash traffic scenarios:

  • FollowLeadingVehicle: hero vehicle must react to the decelerations of a leading vehicle
  • FollowLeadingVehicleWithObstacle: hero vehicle must react to a leading vehicle due to an obstacle blocking the road
  • StationaryObjectCrossing: hero vehicle must react to a cyclist or pedestrian blocking the road
  • DynamicObjectCrossing: hero vehicle must react to a cyclist or pedestrian suddenly crossing in front of it
  • OppositeVehicleRunningRedLight: hero vehicle must avoid a collision at an intersection regulated by traffic lights when the crossing traffic runs a red light
  • NoSignalJunctionCrossing: hero vehicle must cross a non-signalized intersection
  • VehicleTurningRight: hero vehicle must react to a cyclist or pedestrian crossing ahead after a right turn
  • VehicleTurningLeft: hero vehicle must react to a cyclist or pedestrian crossing ahead after a left turn

Implementing a traffic scenario can be done by following a simple recipe:

class MyScenario(BasicScenario):

    timeout = 60            # Timeout of scenario in seconds

    # ego vehicle parameters
    _ego_vehicle_model = 'vehicle.carlamotors.carlacola'
    _ego_vehicle_start = carla.Transform(
        carla.Location(...), carla.Rotation(yaw=0))


    def __init__(self, world, debug_mode=False):
        """
        Setup all relevant parameters and create scenario
        and instantiate scenario manager
        """

        super(MyScenario, self).__init__(
            name="ControlLoss",
            town="Town03",
            world=world,
            debug_mode=debug_mode)

    def _create_behavior(self):
		  ...
        return py_tree_sequence

    def _create_test_criteria(self):
        """
        A list of all test criteria will be created that is later used
        in parallel behavior tree.
        """
        criteria = []

        collision_criterion = CollisionTest(self.ego_vehicle)
        ...

        criteria.append(collision_criterion)
        criteria.append(reached_region_criterion)

        return criteria

These scenarios have some associated termination criteria that are used to automatic evaluate if the “hero” car performed as expected. Please, check out the examples to know more.

Upgraded ROS Bridge

There is no doubt about ROS being the most used system to put together robotics solutions. Hundreds of teams use ROS around the world to create their autonomous agents. For this reason, we took very seriously the task of updating CARLA’s ROS bridge to be fully compatible with the new 0.9.X branch. From 0.9.2 CARLA’s ROS bridge will live in its own repository here.

New Python Agents

New classes have been added to cope with vehicle navigation from client side in the form of agents. The first two of these agents are BasicAgent and RoamingAgent. BasicAgent is able to navigate to a point given location coordinates while dealing with other vehicles and traffic lights safely. RoamingAgent drives around making random choices when presented to multiple options.

agent = BasicAgent(world.vehicle)
            spawn_point = world.world.get_map().get_spawn_points()[0]
            agent.set_destination((spawn_point.location.x,
                                   spawn_point.location.y,
                                   spawn_point.location.z))
while True:
    control = agent.run_step()
    world.vehicle.apply_control(control)

These agents serve to present the basic ideas on how to implement more complex agents that will come soon. Try these agents out by running:

python PythonAPI/automatic_control.py

New version of Town03

Town03 has been upgraded to include a setup of traffic lights that is compatible with US standards. For the first time in CARLA we have also included unsignalized intersection, where agents negotiations needs to occur in order to safely cross the intersection.

New Documentation and Tutorials

Tutorials have been extended to cover relevant topics, such as how to use 0.9.X API or how to create new maps based on RoadRunner:

  • Python 0.9.X API tutorial link
  • How to create new maps using RoadRunner link

We will keep adding more tutorials periodically. Please, check our documentation folder Docs or the online documentation here for further information.

Things missing

  • Full synchronous mode
  • Simulation of pedestrians
  • GPU-accelerated LIDAR

These functionalities will be added very soon. We will keep improving this API in the coming releases. If you find any issues or have suggestions that can be added, please do not hesitate to share it with the community at our GitHub or Discord chat. For the full list of methods available take a look at the Python API Reference.


Full list of changes

  • Added Traffic Scenarios engine to reproduce complex traffic situations for training and evaluating driving agents
  • Added NHTSA Traffic Scenarios
    • FollowLeadingVehicle: hero vehicle must react to the decelerations of a leading vehicle
    • FollowLeadingVehicleWithObstacle: hero vehicle must react to a leading vehicle due to an obstacle blocking the road
    • StationaryObjectCrossing: hero vehicle must react to a cyclist or pedestrian blocking the road
    • DynamicObjectCrossing: hero vehicle must react to a cyclist or pedestrian suddenly crossing in front of it
    • OppositeVehicleRunningRedLight: hero vehicle must avoid a collision at an intersection regulated by traffic lights when the crossing traffic runs a red light
    • NoSignalJunctionCrossing: hero vehicle must cross a non-signalized intersection
    • VehicleTurningRight: hero vehicle must react to a cyclist or pedestrian crossing ahead after a right turn
    • VehicleTurningLeft: hero vehicle must react to a cyclist or pedestrian crossing ahead after a left turn
  • Added atomic behaviors using py_trees behavior trees library
    • InTriggerRegion: new behavior to check if an object is within a trigger region
    • InTriggerDistanceToVehicle: check if a vehicle is within certain distance with respect to a reference vehicle
    • InTriggerDistanceToLocation: check if a vehicle is within certain distance with respect to a reference location
    • TriggerVelocity: triggers if a velocity is met
    • InTimeToArrivalToLocation: check if a vehicle arrives within a given time budget to a reference location
    • InTimeToArrivalToVehicle: check if a vehicle arrives within a given time budget to a reference vehicle
    • AccelerateToVelocity: accelerate until reaching requested velocity
    • KeepVelocity: keep constant velocity
    • DriveDistance: drive certain distance
    • UseAutoPilot: enable autopilot
    • StopVehicle: stop vehicle
    • WaitForTrafficLightState: wait for the traffic light to have a given state
    • SyncArrival: sync the arrival of two vehicles to a given target
  • Updated ROS bridge for CARLA 0.9.X (moved to its own repository)
  • Added Python API “agents” extension, includes
    • Global route planner based on the Waypoints API (compatible with OpenDRIVE)
    • BasicAgent: new client agent that can drive to a given coordinate of the map using the waypoint API and PID controllers, attending to other vehicles and traffic lights
    • RoamingAgent: new client agent that can drive at different speeds following waypoints based on PID controllers, attending to other vehicles and traffic lights
    • LocalPlanner functionality to navigate waypoints using PID controllers
    • LateralControl and LongitudinalControl PIDs
  • Added support for manual gear shifting
  • Added “role_name” attribute to actors to easily identify the “hero” vehicle
  • Changed traffic lights in Town03 to American style
  • Added new junction types with only stop signs
  • Updates to documentation and tutorials
  • Simulator now starts by default in windowed mode
  • CMake version required downgraded to 3.5 for better compatibility
  • Fixed waypoints height were all placed at zero height
  • Fixed actors in world.get_actors() missing parent actor
  • Fixed some vehicles losing their wheels after calling set_simulate_physics
  • Fixed bounding box of Lincoln MkZ
  • Several fixes and improvements to OpenDriveActor