carla/Docs/getting_started.md

135 lines
4.9 KiB
Markdown
Raw Normal View History

<h1>Getting started with CARLA</h1>
![Welcome to CARLA](img/welcome.png)
2018-07-29 01:29:31 +08:00
!!! important
This tutorial refers to the latest development versions of CARLA, 0.9.0 or
later. For the documentation of the stable version please switch to the
[stable branch](https://carla.readthedocs.io/en/stable/getting_started/).
Welcome to CARLA! This tutorial provides the basic steps for getting started
using CARLA.
2018-12-13 20:56:10 +08:00
CARLA consists mainly of two modules, the **CARLA Simulator** and the **CARLA
Python API** module. The simulator does most of the heavy work, controls the
logic, physics, and rendering of all the actors and sensors in the scene; it
requires a machine with a dedicated GPU to run. The CARLA Python API is a module
that you can import into your Python scripts, it provides an interface for
controlling the simulator and retrieving data. With this Python API you can, for
instance, control any vehicle in the simulation, attach sensors to it, and read
back the data these sensors generate. Most of the aspects of the simulation are
accessible from our Python API, and more will be in future releases.
2018-12-13 20:56:10 +08:00
2018-12-17 06:35:54 +08:00
![CARLA Modules](img/carla_modules.png)
2018-12-13 20:56:10 +08:00
<h2>How to run CARLA</h2>
First of all, download the latest release from our GitHub page and extract all
the contents of the package in a folder of your choice.
<div class="build-buttons">
<!-- Latest release button -->
<p>
<a href="https://github.com/carla-simulator/carla/blob/master/Docs/download.md" target="_blank" class="btn btn-neutral" title="Go to the latest CARLA release">
<span class="icon icon-github"></span> Get the latest release</a>
</p>
2019-07-03 21:31:47 +08:00
<!-- Nightly build button -->
<p>
<a href="http://carla-assets-internal.s3.amazonaws.com/Releases/Linux/Dev/CARLA_Latest.tar.gz" target="_blank" class="btn btn-neutral" title="Go to the nightly CARLA build">
<span class="icon fa-cloud-download"></span> Get the nightly build</a>
</p>
</div>
2018-12-13 20:56:10 +08:00
The release package contains a precompiled version of the simulator, the Python
API module, and some Python scripts with usage examples. In order to run our
usage examples, you may need to install the following Python modules
2018-12-13 20:56:10 +08:00
```sh
pip install --user pygame numpy
```
2018-12-13 20:56:10 +08:00
Let's start by running the simulator. Launch a terminal window and go to the
2019-12-13 02:07:35 +08:00
folder you extracted CARLA to. Start the simulator with the following command:
2018-07-29 01:29:31 +08:00
2019-12-13 02:07:35 +08:00
_Linux:_
2018-12-13 20:56:10 +08:00
```sh
./CarlaUE4.sh
```
2018-07-29 01:29:31 +08:00
2019-12-13 02:07:35 +08:00
_Windows:_
2018-12-13 20:56:10 +08:00
```cmd
CarlaUE4.exe
```
2018-07-29 01:29:31 +08:00
2019-12-13 02:07:35 +08:00
This launches a window with a view over the city. This is the "spectator"
2018-12-13 20:56:10 +08:00
view, you can fly around the city using the mouse and WASD keys, but you cannot
interact with the world in this view. The simulator is now running as a server,
waiting for a client app to connect and interact with the world.
2018-07-29 01:29:31 +08:00
2018-12-13 20:56:10 +08:00
!!! note
CARLA requires two available TCP ports on your computer, by default 2000 and
2019-12-13 02:07:35 +08:00
1. Make sure you don't have a firewall or another application blocking
2018-12-13 20:56:10 +08:00
those ports. Alternatively, you can manually change the port by launching
the simulator with the command-line argument `-carla-port=N`, the second
port will be automatically set to `N+1`.
2018-07-29 01:29:31 +08:00
2019-12-13 02:07:35 +08:00
Let's see a few examples of these clients. Open a new terminal and navigate to
the `PythonAPI/examples` folder, where our python clients are located:
Updated TrafficManager (#2112) * Initial commit This commit imports files from scenario_runner repository * WIP TrafficDistributor Set horizontal integral component to 0 Fixed startup concurrency issue * TrafficDistributor first crude version * Code asthetics, Uncrustified. * Code clean up * Fixed more concurrency bugs * Reduced number of vehicles per core Fixed some unhandled exceptions * EOD commit 29AUG2018 * Re-organizing directory structure * WIP code re-organization * Redesigned PipelineStage Implemented Messenger to communicate between stages Implemented LocalizationStage Added StageEnum Removed unecessary files * WIP Testing LocalizationStage * Implemented and benchmarked LocalizationStage Achieved single stage throughput of 600,000,000 * Implemented CopyBufferList() in LocalizationStage * Fixed stage stalling and corrected benchmark * Setting worker thread count to 1 * Code re-organization for porting MotionPlannerStage * WIP - porting MotionPlanner * Moved thread management logic into PipelineStage base class * Implemented output data frame switching Moved relavent structures and types from MotionPlannerStage.h to PIDController.h * Re-organized directory structure to be consistent with rest of the project Initialized frame_selector in constructor * WIP - EOD commit 02SEP209 * WIP - managed to break deadlock between sender and receiver * Implemented common mutex sharing for thread management in PipelineStage Added small timeout for thread locking in PipelineStage Finally broke deadlocks in stage integration * Porting BatchControlStage to new design * Ported BatchControlStage to new design Fixed array indexing bug Messaging actor_id instead of actor pointer to BatchControlStage Improved thread co-ordination logic in PipelineStage * Fixed array exetreme indexing issue * Fixed thread co-ordination logic for multiple worker thread case * Ported PID state map to dynamically allocated vector Changed thread co-ordination time out to 1ms * WIP - EOD 03092019 * Ported CollisionStage to new design Added debug helper parameter Added directionality pre-condition to check polygon overlap Streamlined boundary functions Fixed actor id to array index map Passing individual buffers from localization Using unsigned int keys in VicinityGrid * WIP - fixing localization conflict on frame switching * Fixed localization frame switching bug * Ported TrafficLightStage to new design (#2078) * Implemented TrafficLightStage with new architecture * Implemented slowdown on approaching junction * Integrated all stages into Pipeline class * Ported PipelineExecutable.cpp to work with new Pipeline * WIP - Fixing TrafficDistributor * Switching to single thread stage actions Added release options to CMakeLists.txt Changed vicinity grid keys to string * Changed TrafficDistributor to TrafficDistribution This class only meant to keep track of vehicles acrros different road positions * Changed TrafficDistributor declaration in LocalizationStage * WIP - Lane changes * Streamlined traffic distribution implementation * Implemented a working lane change policy * Fixed const correctness for ActionThreadManager and Action methods Chaned varialbe++ to ++variable wherever suitable * Using STL's numeric_limits instead of arbitrary high values for infinity Made suitable constants static Camelcase starting with uppercase for InMemoryMap methods Fixed comment notions in all files * Streamlined boolean return values from methods in CollisionStage.cpp Using short hand for boost::geometry More comments on boundary calculation logic Camelcasing for methods * Fixed TrafficDistribution vehicle tracking logic Removed distance limit for lane change * Moved lane change logic to TrafficDistributor.cpp * Implemented logic to avoid collisions with unregistered actors * Implemented graceful stop functionality for traffic manager * Code aesthetics * Added debug support for TrafficDistributor.cpp Fixed Test.cpp * Defined constants in TrafficDistributor.cpp Code aesthetic changes * Update README.md * Aphabetical ordering of header include statements * Code streamlining and aesthetic changes * Review comment changes (#2116) Review comment changes Removed frame_map from TrafficLightStage * Made changes for review comments (#2117) * Fixed implicit private inheritence for LocalizationStage Removed unecessary using <method> statements in concrete stage classes * Removed break logic from all loops * Added detailed comments to all header files * Minor review comment changes to collision stage * Detailed comments for all .cpp files * Implemented batch spawn and delete * Added minimum distance check for lane change Increased wait time after sending batch spawn command * Simplified geodesic boundary creation in collision stage * Changing to unsigned integers when appropriate Shorter name aliasing * Changes for code reveiw comments * Removed white spaces * Code review changes Using carla::geom::Math::DistanceSquared whenever possible Better name aliasing Function signature checks * Code aesthetics, text formatting * Changes for appropriate auto keyword usage * Grammar check * Grammatical correction * Distance based check points and boundary generation instead of index based checks * Using explicit typing wherever possible instead of auto * Review comment changes * Review comment changes * Added time margin for approaching vehicles for lane change Increased minimum collision boundary Streamlined InMemoryMap::StructuredWaypoints Implemented gradual braking in PIDController Added left right checks in SimpleWaypoint Removed redundant method in SimpleWaypoint * Initial implementation for reproducibility * Fixed radomization during path selection * Added Vicinity grid-key checker for grid to actor_id map * WIP: junction negotiation enhancement * Polygon to polygon distance based collision negotiation * Update Linux.mk * Update CMakeLists.txt * Update Vars.mk * Update README.md * Update getting_started.md * Review comment changes Namespace aliasing checks Redundant function call checks Default constants defined in motion planner stage Removed hard braking to slow down near junctions Lane change approaching vehicle check time margin Added -h option to get help on traffic manager * Reverting to carla::client::Vehicle::GetTrafficlightState non-signalised junctions * Added communication timeout and implemented stopping when carla stops Removed throughtput measurement logic from PipelineExecutable * Updated gitignore * updated CHANGELOG.md * updated CHANGELOG.md * WIP: negotiating non-signalised junction * Time duration ticketing system for non-signalised junctions Changed from pre-randomised to run time randomised decisions at junctions * Removing debug draw statements * Fixed make and cmake, more work required * Added traffic manager build to jenkins * updated docs
2019-10-07 22:30:51 +08:00
```sh
2019-12-13 02:07:35 +08:00
cd PythonAPI/examples
Updated TrafficManager (#2112) * Initial commit This commit imports files from scenario_runner repository * WIP TrafficDistributor Set horizontal integral component to 0 Fixed startup concurrency issue * TrafficDistributor first crude version * Code asthetics, Uncrustified. * Code clean up * Fixed more concurrency bugs * Reduced number of vehicles per core Fixed some unhandled exceptions * EOD commit 29AUG2018 * Re-organizing directory structure * WIP code re-organization * Redesigned PipelineStage Implemented Messenger to communicate between stages Implemented LocalizationStage Added StageEnum Removed unecessary files * WIP Testing LocalizationStage * Implemented and benchmarked LocalizationStage Achieved single stage throughput of 600,000,000 * Implemented CopyBufferList() in LocalizationStage * Fixed stage stalling and corrected benchmark * Setting worker thread count to 1 * Code re-organization for porting MotionPlannerStage * WIP - porting MotionPlanner * Moved thread management logic into PipelineStage base class * Implemented output data frame switching Moved relavent structures and types from MotionPlannerStage.h to PIDController.h * Re-organized directory structure to be consistent with rest of the project Initialized frame_selector in constructor * WIP - EOD commit 02SEP209 * WIP - managed to break deadlock between sender and receiver * Implemented common mutex sharing for thread management in PipelineStage Added small timeout for thread locking in PipelineStage Finally broke deadlocks in stage integration * Porting BatchControlStage to new design * Ported BatchControlStage to new design Fixed array indexing bug Messaging actor_id instead of actor pointer to BatchControlStage Improved thread co-ordination logic in PipelineStage * Fixed array exetreme indexing issue * Fixed thread co-ordination logic for multiple worker thread case * Ported PID state map to dynamically allocated vector Changed thread co-ordination time out to 1ms * WIP - EOD 03092019 * Ported CollisionStage to new design Added debug helper parameter Added directionality pre-condition to check polygon overlap Streamlined boundary functions Fixed actor id to array index map Passing individual buffers from localization Using unsigned int keys in VicinityGrid * WIP - fixing localization conflict on frame switching * Fixed localization frame switching bug * Ported TrafficLightStage to new design (#2078) * Implemented TrafficLightStage with new architecture * Implemented slowdown on approaching junction * Integrated all stages into Pipeline class * Ported PipelineExecutable.cpp to work with new Pipeline * WIP - Fixing TrafficDistributor * Switching to single thread stage actions Added release options to CMakeLists.txt Changed vicinity grid keys to string * Changed TrafficDistributor to TrafficDistribution This class only meant to keep track of vehicles acrros different road positions * Changed TrafficDistributor declaration in LocalizationStage * WIP - Lane changes * Streamlined traffic distribution implementation * Implemented a working lane change policy * Fixed const correctness for ActionThreadManager and Action methods Chaned varialbe++ to ++variable wherever suitable * Using STL's numeric_limits instead of arbitrary high values for infinity Made suitable constants static Camelcase starting with uppercase for InMemoryMap methods Fixed comment notions in all files * Streamlined boolean return values from methods in CollisionStage.cpp Using short hand for boost::geometry More comments on boundary calculation logic Camelcasing for methods * Fixed TrafficDistribution vehicle tracking logic Removed distance limit for lane change * Moved lane change logic to TrafficDistributor.cpp * Implemented logic to avoid collisions with unregistered actors * Implemented graceful stop functionality for traffic manager * Code aesthetics * Added debug support for TrafficDistributor.cpp Fixed Test.cpp * Defined constants in TrafficDistributor.cpp Code aesthetic changes * Update README.md * Aphabetical ordering of header include statements * Code streamlining and aesthetic changes * Review comment changes (#2116) Review comment changes Removed frame_map from TrafficLightStage * Made changes for review comments (#2117) * Fixed implicit private inheritence for LocalizationStage Removed unecessary using <method> statements in concrete stage classes * Removed break logic from all loops * Added detailed comments to all header files * Minor review comment changes to collision stage * Detailed comments for all .cpp files * Implemented batch spawn and delete * Added minimum distance check for lane change Increased wait time after sending batch spawn command * Simplified geodesic boundary creation in collision stage * Changing to unsigned integers when appropriate Shorter name aliasing * Changes for code reveiw comments * Removed white spaces * Code review changes Using carla::geom::Math::DistanceSquared whenever possible Better name aliasing Function signature checks * Code aesthetics, text formatting * Changes for appropriate auto keyword usage * Grammar check * Grammatical correction * Distance based check points and boundary generation instead of index based checks * Using explicit typing wherever possible instead of auto * Review comment changes * Review comment changes * Added time margin for approaching vehicles for lane change Increased minimum collision boundary Streamlined InMemoryMap::StructuredWaypoints Implemented gradual braking in PIDController Added left right checks in SimpleWaypoint Removed redundant method in SimpleWaypoint * Initial implementation for reproducibility * Fixed radomization during path selection * Added Vicinity grid-key checker for grid to actor_id map * WIP: junction negotiation enhancement * Polygon to polygon distance based collision negotiation * Update Linux.mk * Update CMakeLists.txt * Update Vars.mk * Update README.md * Update getting_started.md * Review comment changes Namespace aliasing checks Redundant function call checks Default constants defined in motion planner stage Removed hard braking to slow down near junctions Lane change approaching vehicle check time margin Added -h option to get help on traffic manager * Reverting to carla::client::Vehicle::GetTrafficlightState non-signalised junctions * Added communication timeout and implemented stopping when carla stops Removed throughtput measurement logic from PipelineExecutable * Updated gitignore * updated CHANGELOG.md * updated CHANGELOG.md * WIP: negotiating non-signalised junction * Time duration ticketing system for non-signalised junctions Changed from pre-randomised to run time randomised decisions at junctions * Removing debug draw statements * Fixed make and cmake, more work required * Added traffic manager build to jenkins * updated docs
2019-10-07 22:30:51 +08:00
```
2019-12-13 02:07:35 +08:00
Let's add now some life to the city by running:
Updated TrafficManager (#2112) * Initial commit This commit imports files from scenario_runner repository * WIP TrafficDistributor Set horizontal integral component to 0 Fixed startup concurrency issue * TrafficDistributor first crude version * Code asthetics, Uncrustified. * Code clean up * Fixed more concurrency bugs * Reduced number of vehicles per core Fixed some unhandled exceptions * EOD commit 29AUG2018 * Re-organizing directory structure * WIP code re-organization * Redesigned PipelineStage Implemented Messenger to communicate between stages Implemented LocalizationStage Added StageEnum Removed unecessary files * WIP Testing LocalizationStage * Implemented and benchmarked LocalizationStage Achieved single stage throughput of 600,000,000 * Implemented CopyBufferList() in LocalizationStage * Fixed stage stalling and corrected benchmark * Setting worker thread count to 1 * Code re-organization for porting MotionPlannerStage * WIP - porting MotionPlanner * Moved thread management logic into PipelineStage base class * Implemented output data frame switching Moved relavent structures and types from MotionPlannerStage.h to PIDController.h * Re-organized directory structure to be consistent with rest of the project Initialized frame_selector in constructor * WIP - EOD commit 02SEP209 * WIP - managed to break deadlock between sender and receiver * Implemented common mutex sharing for thread management in PipelineStage Added small timeout for thread locking in PipelineStage Finally broke deadlocks in stage integration * Porting BatchControlStage to new design * Ported BatchControlStage to new design Fixed array indexing bug Messaging actor_id instead of actor pointer to BatchControlStage Improved thread co-ordination logic in PipelineStage * Fixed array exetreme indexing issue * Fixed thread co-ordination logic for multiple worker thread case * Ported PID state map to dynamically allocated vector Changed thread co-ordination time out to 1ms * WIP - EOD 03092019 * Ported CollisionStage to new design Added debug helper parameter Added directionality pre-condition to check polygon overlap Streamlined boundary functions Fixed actor id to array index map Passing individual buffers from localization Using unsigned int keys in VicinityGrid * WIP - fixing localization conflict on frame switching * Fixed localization frame switching bug * Ported TrafficLightStage to new design (#2078) * Implemented TrafficLightStage with new architecture * Implemented slowdown on approaching junction * Integrated all stages into Pipeline class * Ported PipelineExecutable.cpp to work with new Pipeline * WIP - Fixing TrafficDistributor * Switching to single thread stage actions Added release options to CMakeLists.txt Changed vicinity grid keys to string * Changed TrafficDistributor to TrafficDistribution This class only meant to keep track of vehicles acrros different road positions * Changed TrafficDistributor declaration in LocalizationStage * WIP - Lane changes * Streamlined traffic distribution implementation * Implemented a working lane change policy * Fixed const correctness for ActionThreadManager and Action methods Chaned varialbe++ to ++variable wherever suitable * Using STL's numeric_limits instead of arbitrary high values for infinity Made suitable constants static Camelcase starting with uppercase for InMemoryMap methods Fixed comment notions in all files * Streamlined boolean return values from methods in CollisionStage.cpp Using short hand for boost::geometry More comments on boundary calculation logic Camelcasing for methods * Fixed TrafficDistribution vehicle tracking logic Removed distance limit for lane change * Moved lane change logic to TrafficDistributor.cpp * Implemented logic to avoid collisions with unregistered actors * Implemented graceful stop functionality for traffic manager * Code aesthetics * Added debug support for TrafficDistributor.cpp Fixed Test.cpp * Defined constants in TrafficDistributor.cpp Code aesthetic changes * Update README.md * Aphabetical ordering of header include statements * Code streamlining and aesthetic changes * Review comment changes (#2116) Review comment changes Removed frame_map from TrafficLightStage * Made changes for review comments (#2117) * Fixed implicit private inheritence for LocalizationStage Removed unecessary using <method> statements in concrete stage classes * Removed break logic from all loops * Added detailed comments to all header files * Minor review comment changes to collision stage * Detailed comments for all .cpp files * Implemented batch spawn and delete * Added minimum distance check for lane change Increased wait time after sending batch spawn command * Simplified geodesic boundary creation in collision stage * Changing to unsigned integers when appropriate Shorter name aliasing * Changes for code reveiw comments * Removed white spaces * Code review changes Using carla::geom::Math::DistanceSquared whenever possible Better name aliasing Function signature checks * Code aesthetics, text formatting * Changes for appropriate auto keyword usage * Grammar check * Grammatical correction * Distance based check points and boundary generation instead of index based checks * Using explicit typing wherever possible instead of auto * Review comment changes * Review comment changes * Added time margin for approaching vehicles for lane change Increased minimum collision boundary Streamlined InMemoryMap::StructuredWaypoints Implemented gradual braking in PIDController Added left right checks in SimpleWaypoint Removed redundant method in SimpleWaypoint * Initial implementation for reproducibility * Fixed radomization during path selection * Added Vicinity grid-key checker for grid to actor_id map * WIP: junction negotiation enhancement * Polygon to polygon distance based collision negotiation * Update Linux.mk * Update CMakeLists.txt * Update Vars.mk * Update README.md * Update getting_started.md * Review comment changes Namespace aliasing checks Redundant function call checks Default constants defined in motion planner stage Removed hard braking to slow down near junctions Lane change approaching vehicle check time margin Added -h option to get help on traffic manager * Reverting to carla::client::Vehicle::GetTrafficlightState non-signalised junctions * Added communication timeout and implemented stopping when carla stops Removed throughtput measurement logic from PipelineExecutable * Updated gitignore * updated CHANGELOG.md * updated CHANGELOG.md * WIP: negotiating non-signalised junction * Time duration ticketing system for non-signalised junctions Changed from pre-randomised to run time randomised decisions at junctions * Removing debug draw statements * Fixed make and cmake, more work required * Added traffic manager build to jenkins * updated docs
2019-10-07 22:30:51 +08:00
```sh
2019-12-13 02:07:35 +08:00
python tm_spawn_npc.py
Updated TrafficManager (#2112) * Initial commit This commit imports files from scenario_runner repository * WIP TrafficDistributor Set horizontal integral component to 0 Fixed startup concurrency issue * TrafficDistributor first crude version * Code asthetics, Uncrustified. * Code clean up * Fixed more concurrency bugs * Reduced number of vehicles per core Fixed some unhandled exceptions * EOD commit 29AUG2018 * Re-organizing directory structure * WIP code re-organization * Redesigned PipelineStage Implemented Messenger to communicate between stages Implemented LocalizationStage Added StageEnum Removed unecessary files * WIP Testing LocalizationStage * Implemented and benchmarked LocalizationStage Achieved single stage throughput of 600,000,000 * Implemented CopyBufferList() in LocalizationStage * Fixed stage stalling and corrected benchmark * Setting worker thread count to 1 * Code re-organization for porting MotionPlannerStage * WIP - porting MotionPlanner * Moved thread management logic into PipelineStage base class * Implemented output data frame switching Moved relavent structures and types from MotionPlannerStage.h to PIDController.h * Re-organized directory structure to be consistent with rest of the project Initialized frame_selector in constructor * WIP - EOD commit 02SEP209 * WIP - managed to break deadlock between sender and receiver * Implemented common mutex sharing for thread management in PipelineStage Added small timeout for thread locking in PipelineStage Finally broke deadlocks in stage integration * Porting BatchControlStage to new design * Ported BatchControlStage to new design Fixed array indexing bug Messaging actor_id instead of actor pointer to BatchControlStage Improved thread co-ordination logic in PipelineStage * Fixed array exetreme indexing issue * Fixed thread co-ordination logic for multiple worker thread case * Ported PID state map to dynamically allocated vector Changed thread co-ordination time out to 1ms * WIP - EOD 03092019 * Ported CollisionStage to new design Added debug helper parameter Added directionality pre-condition to check polygon overlap Streamlined boundary functions Fixed actor id to array index map Passing individual buffers from localization Using unsigned int keys in VicinityGrid * WIP - fixing localization conflict on frame switching * Fixed localization frame switching bug * Ported TrafficLightStage to new design (#2078) * Implemented TrafficLightStage with new architecture * Implemented slowdown on approaching junction * Integrated all stages into Pipeline class * Ported PipelineExecutable.cpp to work with new Pipeline * WIP - Fixing TrafficDistributor * Switching to single thread stage actions Added release options to CMakeLists.txt Changed vicinity grid keys to string * Changed TrafficDistributor to TrafficDistribution This class only meant to keep track of vehicles acrros different road positions * Changed TrafficDistributor declaration in LocalizationStage * WIP - Lane changes * Streamlined traffic distribution implementation * Implemented a working lane change policy * Fixed const correctness for ActionThreadManager and Action methods Chaned varialbe++ to ++variable wherever suitable * Using STL's numeric_limits instead of arbitrary high values for infinity Made suitable constants static Camelcase starting with uppercase for InMemoryMap methods Fixed comment notions in all files * Streamlined boolean return values from methods in CollisionStage.cpp Using short hand for boost::geometry More comments on boundary calculation logic Camelcasing for methods * Fixed TrafficDistribution vehicle tracking logic Removed distance limit for lane change * Moved lane change logic to TrafficDistributor.cpp * Implemented logic to avoid collisions with unregistered actors * Implemented graceful stop functionality for traffic manager * Code aesthetics * Added debug support for TrafficDistributor.cpp Fixed Test.cpp * Defined constants in TrafficDistributor.cpp Code aesthetic changes * Update README.md * Aphabetical ordering of header include statements * Code streamlining and aesthetic changes * Review comment changes (#2116) Review comment changes Removed frame_map from TrafficLightStage * Made changes for review comments (#2117) * Fixed implicit private inheritence for LocalizationStage Removed unecessary using <method> statements in concrete stage classes * Removed break logic from all loops * Added detailed comments to all header files * Minor review comment changes to collision stage * Detailed comments for all .cpp files * Implemented batch spawn and delete * Added minimum distance check for lane change Increased wait time after sending batch spawn command * Simplified geodesic boundary creation in collision stage * Changing to unsigned integers when appropriate Shorter name aliasing * Changes for code reveiw comments * Removed white spaces * Code review changes Using carla::geom::Math::DistanceSquared whenever possible Better name aliasing Function signature checks * Code aesthetics, text formatting * Changes for appropriate auto keyword usage * Grammar check * Grammatical correction * Distance based check points and boundary generation instead of index based checks * Using explicit typing wherever possible instead of auto * Review comment changes * Review comment changes * Added time margin for approaching vehicles for lane change Increased minimum collision boundary Streamlined InMemoryMap::StructuredWaypoints Implemented gradual braking in PIDController Added left right checks in SimpleWaypoint Removed redundant method in SimpleWaypoint * Initial implementation for reproducibility * Fixed radomization during path selection * Added Vicinity grid-key checker for grid to actor_id map * WIP: junction negotiation enhancement * Polygon to polygon distance based collision negotiation * Update Linux.mk * Update CMakeLists.txt * Update Vars.mk * Update README.md * Update getting_started.md * Review comment changes Namespace aliasing checks Redundant function call checks Default constants defined in motion planner stage Removed hard braking to slow down near junctions Lane change approaching vehicle check time margin Added -h option to get help on traffic manager * Reverting to carla::client::Vehicle::GetTrafficlightState non-signalised junctions * Added communication timeout and implemented stopping when carla stops Removed throughtput measurement logic from PipelineExecutable * Updated gitignore * updated CHANGELOG.md * updated CHANGELOG.md * WIP: negotiating non-signalised junction * Time duration ticketing system for non-signalised junctions Changed from pre-randomised to run time randomised decisions at junctions * Removing debug draw statements * Fixed make and cmake, more work required * Added traffic manager build to jenkins * updated docs
2019-10-07 22:30:51 +08:00
```
Which will create an appropriate amount of cars given the specs of your machine.
2019-12-13 02:07:35 +08:00
Alternatively, you can use the `-n <NUMBER_OF_VEHICLES>` and/or
`-w <NUMBER_OF_WALKERS>` flag to choose how many actors you want to create.
Updated TrafficManager (#2112) * Initial commit This commit imports files from scenario_runner repository * WIP TrafficDistributor Set horizontal integral component to 0 Fixed startup concurrency issue * TrafficDistributor first crude version * Code asthetics, Uncrustified. * Code clean up * Fixed more concurrency bugs * Reduced number of vehicles per core Fixed some unhandled exceptions * EOD commit 29AUG2018 * Re-organizing directory structure * WIP code re-organization * Redesigned PipelineStage Implemented Messenger to communicate between stages Implemented LocalizationStage Added StageEnum Removed unecessary files * WIP Testing LocalizationStage * Implemented and benchmarked LocalizationStage Achieved single stage throughput of 600,000,000 * Implemented CopyBufferList() in LocalizationStage * Fixed stage stalling and corrected benchmark * Setting worker thread count to 1 * Code re-organization for porting MotionPlannerStage * WIP - porting MotionPlanner * Moved thread management logic into PipelineStage base class * Implemented output data frame switching Moved relavent structures and types from MotionPlannerStage.h to PIDController.h * Re-organized directory structure to be consistent with rest of the project Initialized frame_selector in constructor * WIP - EOD commit 02SEP209 * WIP - managed to break deadlock between sender and receiver * Implemented common mutex sharing for thread management in PipelineStage Added small timeout for thread locking in PipelineStage Finally broke deadlocks in stage integration * Porting BatchControlStage to new design * Ported BatchControlStage to new design Fixed array indexing bug Messaging actor_id instead of actor pointer to BatchControlStage Improved thread co-ordination logic in PipelineStage * Fixed array exetreme indexing issue * Fixed thread co-ordination logic for multiple worker thread case * Ported PID state map to dynamically allocated vector Changed thread co-ordination time out to 1ms * WIP - EOD 03092019 * Ported CollisionStage to new design Added debug helper parameter Added directionality pre-condition to check polygon overlap Streamlined boundary functions Fixed actor id to array index map Passing individual buffers from localization Using unsigned int keys in VicinityGrid * WIP - fixing localization conflict on frame switching * Fixed localization frame switching bug * Ported TrafficLightStage to new design (#2078) * Implemented TrafficLightStage with new architecture * Implemented slowdown on approaching junction * Integrated all stages into Pipeline class * Ported PipelineExecutable.cpp to work with new Pipeline * WIP - Fixing TrafficDistributor * Switching to single thread stage actions Added release options to CMakeLists.txt Changed vicinity grid keys to string * Changed TrafficDistributor to TrafficDistribution This class only meant to keep track of vehicles acrros different road positions * Changed TrafficDistributor declaration in LocalizationStage * WIP - Lane changes * Streamlined traffic distribution implementation * Implemented a working lane change policy * Fixed const correctness for ActionThreadManager and Action methods Chaned varialbe++ to ++variable wherever suitable * Using STL's numeric_limits instead of arbitrary high values for infinity Made suitable constants static Camelcase starting with uppercase for InMemoryMap methods Fixed comment notions in all files * Streamlined boolean return values from methods in CollisionStage.cpp Using short hand for boost::geometry More comments on boundary calculation logic Camelcasing for methods * Fixed TrafficDistribution vehicle tracking logic Removed distance limit for lane change * Moved lane change logic to TrafficDistributor.cpp * Implemented logic to avoid collisions with unregistered actors * Implemented graceful stop functionality for traffic manager * Code aesthetics * Added debug support for TrafficDistributor.cpp Fixed Test.cpp * Defined constants in TrafficDistributor.cpp Code aesthetic changes * Update README.md * Aphabetical ordering of header include statements * Code streamlining and aesthetic changes * Review comment changes (#2116) Review comment changes Removed frame_map from TrafficLightStage * Made changes for review comments (#2117) * Fixed implicit private inheritence for LocalizationStage Removed unecessary using <method> statements in concrete stage classes * Removed break logic from all loops * Added detailed comments to all header files * Minor review comment changes to collision stage * Detailed comments for all .cpp files * Implemented batch spawn and delete * Added minimum distance check for lane change Increased wait time after sending batch spawn command * Simplified geodesic boundary creation in collision stage * Changing to unsigned integers when appropriate Shorter name aliasing * Changes for code reveiw comments * Removed white spaces * Code review changes Using carla::geom::Math::DistanceSquared whenever possible Better name aliasing Function signature checks * Code aesthetics, text formatting * Changes for appropriate auto keyword usage * Grammar check * Grammatical correction * Distance based check points and boundary generation instead of index based checks * Using explicit typing wherever possible instead of auto * Review comment changes * Review comment changes * Added time margin for approaching vehicles for lane change Increased minimum collision boundary Streamlined InMemoryMap::StructuredWaypoints Implemented gradual braking in PIDController Added left right checks in SimpleWaypoint Removed redundant method in SimpleWaypoint * Initial implementation for reproducibility * Fixed radomization during path selection * Added Vicinity grid-key checker for grid to actor_id map * WIP: junction negotiation enhancement * Polygon to polygon distance based collision negotiation * Update Linux.mk * Update CMakeLists.txt * Update Vars.mk * Update README.md * Update getting_started.md * Review comment changes Namespace aliasing checks Redundant function call checks Default constants defined in motion planner stage Removed hard braking to slow down near junctions Lane change approaching vehicle check time margin Added -h option to get help on traffic manager * Reverting to carla::client::Vehicle::GetTrafficlightState non-signalised junctions * Added communication timeout and implemented stopping when carla stops Removed throughtput measurement logic from PipelineExecutable * Updated gitignore * updated CHANGELOG.md * updated CHANGELOG.md * WIP: negotiating non-signalised junction * Time duration ticketing system for non-signalised junctions Changed from pre-randomised to run time randomised decisions at junctions * Removing debug draw statements * Fixed make and cmake, more work required * Added traffic manager build to jenkins * updated docs
2019-10-07 22:30:51 +08:00
2019-12-13 02:07:35 +08:00
!!! note
We still support the old `spawn_npc.py` script, even if it will be removed
soon. This one uses the old and simple autopilot mode.
2018-07-29 01:29:31 +08:00
2019-12-13 02:07:35 +08:00
With this script we are adding vehicles to the world driving in "autopilot"
mode. Back to the simulator window we should see these vehicles driving around
the city. They will keep driving randomly until we stop the script. Let's leave
them there for now.
2018-07-29 01:29:31 +08:00
2018-12-13 20:56:10 +08:00
Now, it's nice and sunny in CARLA, but that's not a very interesting driving
condition. One of the cool features of CARLA is that you can control the weather
and lighting conditions of the world. We'll launch now a script that dynamically
controls the weather and time of the day, open yet another terminal window and
execute
2018-07-29 01:29:31 +08:00
2018-12-13 20:56:10 +08:00
```sh
python dynamic_weather.py
```
2018-12-13 20:56:10 +08:00
The city is now ready for us to drive, we can finally run
2018-07-29 01:29:31 +08:00
```sh
2018-12-13 20:56:10 +08:00
python manual_control.py
2018-07-29 01:29:31 +08:00
```
2018-12-13 20:56:10 +08:00
This should open a new window with a 3rd person view of a car, you can drive
this car with the WASD/arrow keys. Press 'h' to see all the options available.
![manual_control.py](img/manual_control.png)
As you have noticed, we can connect as many scripts as we want to control the
simulation and gather data. Even someone with a different computer can jump now
into your simulation and drive along with you
```sh
python manual_control.py --host=<your-ip-address-here>
```
<br>
Now that we covered the basics, in the next section we'll take a look at some of
the details of the Python API to help you write your own scripts.