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.
Time to have a look at the highlights of this release!
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.
Figure 1. Example of traffic scenario: Adversarial vehicle running a stop sign. Emergency brake needed.
Figure 2. Example of traffic scenario: Ego-vehicle losing control due to road bad conditions.
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:
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.
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 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
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.
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:
We will keep adding more tutorials periodically. Please, check our documentation folder Docs or the online documentation here for further information.
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.