Testing the CARLA Gym environment

To make it easy to test the basics of our environment implementation, we will implement a simple main() routine so we can run the environment as a script. This will show us if the basic interfaces have been set up correctly, as well as how the environment actually looks!

The main routine of the carla_env.py file is shown in the following snippet. This file creates an instance of the default CarlaEnv and runs five episodes with a fixed action of going forward. The ENV_CONFIG action, which we created during initialization, can be changed to use discrete or continuous action spaces, as follows:

# Part of https://github.com/PacktPublishing/Hands-On-Intelligent-Agents-with-OpenAI-Gym/ch7/carla-gym/carla_gym/envs/carla_env.py ...

Get Hands-On Intelligent Agents with OpenAI Gym now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.