Energy consumption tracking for CARLA simulator.
All scripts in this directory run independently from each other and can be run from the command line. When in doubt, opt for multitracking.py. This program is the most up-to-date and offers most of the functionality of both unitracking.py and automatic_control.py, plus more.
More information about usage and options can be obtained with the -h
option.
See also QUICKSTART.MD.
-
automatic_control.py tracks a vehicle which is automatically controlled on the client side.
Basic Usage
- Start the CARLA server.
- Run
python automatic_control.py
.
Known issues:
- Much like the average driver, the vehicle does not stop at stop signs.
- Unlike the average driver, the vehicle brakes frequently instead of reducing throttle.
-
manual_control_steeringwheel.py tracks power usage of a vehicle which the user drives using a steering wheel controller.
Basic Usage
- Start the CARLA server.
- Run
python manual_control_steeringwheel.py input/examples/tracked_agent.csv
.
-
manual_control_reporting.py does the same as manual_control_steeringwheel.py but with live reporting to the terminal.
Basic Usage
- Start the CARLA server.
- Run
python manual_control_reporting.py input/examples/tracked_agent.csv
.
-
multitracking.py tracks multiple vehicles at once. These vehicles can be controlled by the Traffic Manager or one of the agents under
agents/navigation/
.- The
-d
option is strongly recommended. Try0.05
at first. For BehaviorAgents, ensuredelta
time step is below0.02
.
Basic Usage
- Start the CARLA server.
- Run
python multitracking.py input/examples/tracked_agent.csv output/
.- This will save all data to the
output/
directory, potentially overwriting data that is already there.output/
can be replaced by any path to a directory or potential directory.
- This will save all data to the
- The
-
unitracking.py shows a usage example allowing greater control over a single vehicle. This spawns traffic and tracks energy usage and other data about a simulated Tesla Model 3, displaying updates every second. At the end, it graphs the power consumed as compared with velocity, acceleration and road grade, then plots a heatmap of the areas the vehicle travelled to.
- The
-t
option is strongly recommended.
Basic Usage
- Start the CARLA server.
- Run
python unitracking.py
.
- The
-
docs/
contains additional software documentation. -
interface/
is an interface between the user-facing programs contained in this directory and the inner workings of the core logic. See its README. -
input/
contains example input files for automatic_control.py, unitracking.py and multitracking.py. It also contains some scripts to help create those files. See its README for input file documentation. -
navigation/
contains some functions for getting oriented to CARLA maps and wireless chargers. See its README. -
plots
contains code for example plots based on simulation data. -
tests/
has all of the unit tests for the project. See its README.
Follow CARLA installation instructions for both server and client. In addition, use pip
or conda
to install matplotlib
, pandas
, shapely
, and networkx
. This code was tested on CARLA v0.9.14
, Python v3.8.16
.
All software is included under the MIT License.