Skip to content

Commit

Permalink
[WIP] Replicate TCP paper as brain
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiopaniego committed Nov 28, 2023
1 parent 59db63e commit f6d6b84
Show file tree
Hide file tree
Showing 99 changed files with 41,486 additions and 4 deletions.
64 changes: 64 additions & 0 deletions behavior_metrics/brains/CARLA/TCP/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import os

class GlobalConfig:
""" base architecture configurations """
# Data
seq_len = 1 # input timesteps
pred_len = 4 # future waypoints predicted

# data root
root_dir_all = "tcp_carla_data"

train_towns = ['town01', 'town03', 'town04', 'town06', ]
val_towns = ['town02', 'town05', 'town07', 'town10']
train_data, val_data = [], []
for town in train_towns:
train_data.append(os.path.join(root_dir_all, town))
train_data.append(os.path.join(root_dir_all, town+'_addition'))
for town in val_towns:
val_data.append(os.path.join(root_dir_all, town+'_val'))

ignore_sides = True # don't consider side cameras
ignore_rear = True # don't consider rear cameras

input_resolution = 256

scale = 1 # image pre-processing
crop = 256 # image pre-processing

lr = 1e-4 # learning rate

# Controller
turn_KP = 0.75
turn_KI = 0.75
turn_KD = 0.3
turn_n = 40 # buffer size

speed_KP = 5.0
speed_KI = 0.5
speed_KD = 1.0
speed_n = 40 # buffer size

max_throttle = 0.75 # upper limit on throttle signal value in dataset
brake_speed = 0.4 # desired speed below which brake is triggered
brake_ratio = 1.1 # ratio of speed to desired speed at which brake is triggered
clip_delta = 0.25 # maximum change in speed input to logitudinal controller


aim_dist = 4.0 # distance to search around for aim point
angle_thresh = 0.3 # outlier control detection angle
dist_thresh = 10 # target point y-distance for outlier filtering


speed_weight = 0.05
value_weight = 0.001
features_weight = 0.05

rl_ckpt = "roach/log/ckpt_11833344.pth"

img_aug = True


def __init__(self, **kwargs):
for k,v in kwargs.items():
setattr(self, k, v)
4 changes: 4 additions & 0 deletions behavior_metrics/brains/CARLA/TCP/leaderboard/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Latest changes

* Creating stable version for the CARLA online leaderboard
* Initial creation of the repository
21 changes: 21 additions & 0 deletions behavior_metrics/brains/CARLA/TCP/leaderboard/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 CARLA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 16 additions & 0 deletions behavior_metrics/brains/CARLA/TCP/leaderboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
The main goal of the CARLA Autonomous Driving Leaderboard is to evaluate the driving proficiency of autonomous agents in realistic traffic situations. The leaderboard serves as an open platform for the community to perform fair and reproducible evaluations, simplifying the comparison between different approaches.

Autonomous agents have to drive through a set of predefined routes. For each route, agents are initialized at a starting point and have to drive to a destination point. The agents will be provided with a description of the route. Routes will happen in a variety of areas, including freeways, urban scenes, and residential districts.

Agents will face multiple traffic situations based in the NHTSA typology, such as:

* Lane merging
* Lane changing
* Negotiations at traffic intersections
* Negotiations at roundabouts
* Handling traffic lights and traffic signs
* Coping with pedestrians, cyclists and other elements

The user can change the weather of the simulation, allowing the evaluation of the agent in a variety of weather conditions, including daylight scenes, sunset, rain, fog, and night, among others.

More information can be found [here](https://leaderboard.carla.org/)

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?xml version='1.0' encoding='UTF-8'?>
<routes>
<route id="0" town="Town02">
<weather id="HardRainNight" cloudiness="90.000000" precipitation="60.000000" precipitation_deposits="100.000000" wind_intensity="1.000000" sun_azimuth_angle="225.000000" sun_altitude_angle="-80.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="129.179062" y="191.611450" z="0.0" pitch="0.0" roll="0.0" yaw="0.026263"/>
<waypoint x="41.856991" y="269.960175" z="0.0" pitch="0.0" roll="0.0" yaw="89.995033"/>
</weather>
</route>
<route id="1" town="Town02">
<weather id="WetSunset" cloudiness="20.000000" precipitation="0.000000" precipitation_deposits="50.000000" wind_intensity="0.350000" sun_azimuth_angle="270.000000" sun_altitude_angle="15.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="46.149979" y="237.615067" z="0.0" pitch="0.0" roll="0.0" yaw="42.504929"/>
<waypoint x="124.981224" y="236.919449" z="0.0" pitch="0.0" roll="0.0" yaw="-539.965149"/>
</weather>
</route>
<route id="2" town="Town02">
<weather id="WetCloudyNight" cloudiness="90.000000" precipitation="0.000000" precipitation_deposits="50.000000" wind_intensity="0.350000" sun_azimuth_angle="225.000000" sun_altitude_angle="-80.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="84.699074" y="191.591064" z="0.0" pitch="0.0" roll="0.0" yaw="0.026263"/>
<waypoint x="136.145218" y="204.182037" z="0.0" pitch="0.0" roll="0.0" yaw="-89.941917"/>
</weather>
</route>
<route id="3" town="Town02">
<weather id="ClearNight" cloudiness="15.000000" precipitation="0.000000" precipitation_deposits="0.000000" wind_intensity="0.350000" sun_azimuth_angle="0.000000" sun_altitude_angle="-80.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="98.699081" y="191.597488" z="0.0" pitch="0.0" roll="0.0" yaw="0.026263"/>
<waypoint x="56.981239" y="236.878159" z="0.0" pitch="0.0" roll="0.0" yaw="-179.965195"/>
</weather>
</route>
<route id="4" town="Town02">
<weather id="HardRainSunset" cloudiness="80.000000" precipitation="60.000000" precipitation_deposits="100.000000" wind_intensity="1.000000" sun_azimuth_angle="0.000000" sun_altitude_angle="15.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="175.100922" y="187.632492" z="0.0" pitch="0.0" roll="0.0" yaw="180.026260"/>
<waypoint x="124.978798" y="240.919449" z="0.0" pitch="0.0" roll="0.0" yaw="0.034805"/>
</weather>
</route>
<route id="5" town="Town02">
<weather id="SoftRainNoon" cloudiness="90.000000" precipitation="15.000000" precipitation_deposits="50.000000" wind_intensity="0.350000" sun_azimuth_angle="315.000000" sun_altitude_angle="75.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="151.504059" y="109.440369" z="0.0" pitch="0.0" roll="0.0" yaw="359.961060"/>
<waypoint x="51.292122" y="187.575760" z="0.0" pitch="0.0" roll="0.0" yaw="-179.973694"/>
</weather>
</route>
<route id="6" town="Town02">
<weather id="HardRainSunset" cloudiness="80.000000" precipitation="60.000000" precipitation_deposits="100.000000" wind_intensity="1.000000" sun_azimuth_angle="0.000000" sun_altitude_angle="15.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="189.693253" y="260.576782" z="0.0" pitch="0.0" roll="0.0" yaw="90.039192"/>
<waypoint x="45.852272" y="215.589844" z="0.0" pitch="0.0" roll="0.0" yaw="-90.004967"/>
</weather>
</route>
<route id="7" town="Town02">
<weather id="WetNoon" cloudiness="20.000000" precipitation="0.000000" precipitation_deposits="50.000000" wind_intensity="0.350000" sun_azimuth_angle="45.000000" sun_altitude_angle="75.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="90.699074" y="191.593826" z="0.0" pitch="0.0" roll="0.0" yaw="0.026263"/>
<waypoint x="136.664078" y="302.559845" z="0.0" pitch="0.0" roll="0.0" yaw="180.019424"/>
</weather>
</route>
<route id="8" town="Town02">
<weather id="WetCloudyNoon" cloudiness="90.000000" precipitation="0.000000" precipitation_deposits="50.000000" wind_intensity="0.350000" sun_azimuth_angle="180.000000" sun_altitude_angle="75.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="45.853607" y="230.992218" z="0.0" pitch="0.0" roll="0.0" yaw="-450.004944"/>
<waypoint x="193.684601" y="182.603119" z="0.0" pitch="0.0" roll="0.0" yaw="-450.012909"/>
</weather>
</route>
<route id="9" town="Town02">
<weather id="SoftRainNoon" cloudiness="90.000000" precipitation="15.000000" precipitation_deposits="50.000000" wind_intensity="0.350000" sun_azimuth_angle="315.000000" sun_altitude_angle="75.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="88.981239" y="236.897583" z="0.0" pitch="0.0" roll="0.0" yaw="-179.965195"/>
<waypoint x="41.857166" y="271.960175" z="0.0" pitch="0.0" roll="0.0" yaw="89.995033"/>
</weather>
</route>
<route id="10" town="Town02">
<weather id="HardRainNight" cloudiness="90.000000" precipitation="60.000000" precipitation_deposits="100.000000" wind_intensity="1.000000" sun_azimuth_angle="225.000000" sun_altitude_angle="-80.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="-7.457922" y="171.245422" z="0.0" pitch="0.0" roll="0.0" yaw="89.987068"/>
<waypoint x="189.676834" y="284.576782" z="0.0" pitch="0.0" roll="0.0" yaw="90.039192"/>
</weather>
</route>
<route id="11" town="Town02">
<weather id="SoftRainNoon" cloudiness="90.000000" precipitation="15.000000" precipitation_deposits="50.000000" wind_intensity="0.350000" sun_azimuth_angle="315.000000" sun_altitude_angle="75.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="34.658630" y="302.539520" z="0.0" pitch="0.0" roll="0.0" yaw="-180.039032"/>
<waypoint x="125.179070" y="191.609619" z="0.0" pitch="0.0" roll="0.0" yaw="0.026263"/>
</weather>
</route>
<route id="12" town="Town02">
<weather id="ClearSunset" cloudiness="15.000000" precipitation="0.000000" precipitation_deposits="0.000000" wind_intensity="0.350000" sun_azimuth_angle="45.000000" sun_altitude_angle="15.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="193.699524" y="248.577713" z="0.0" pitch="0.0" roll="0.0" yaw="-90.012947"/>
<waypoint x="41.855949" y="257.960175" z="0.0" pitch="0.0" roll="0.0" yaw="89.995033"/>
</weather>
</route>
<route id="13" town="Town02">
<weather id="CloudyNight" cloudiness="80.000000" precipitation="0.000000" precipitation_deposits="0.000000" wind_intensity="0.350000" sun_azimuth_angle="45.000000" sun_altitude_angle="-80.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="-3.452053" y="197.239578" z="0.0" pitch="0.0" roll="0.0" yaw="-90.012932"/>
<waypoint x="41.858555" y="287.960175" z="0.0" pitch="0.0" roll="0.0" yaw="89.995033"/>
</weather>
</route>
<route id="14" town="Town02">
<weather id="SoftRainNight" cloudiness="90.000000" precipitation="15.000000" precipitation_deposits="50.000000" wind_intensity="0.350000" sun_azimuth_angle="270.000000" sun_altitude_angle="-80.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="189.700562" y="147.087280" z="0.0" pitch="0.0" roll="0.0" yaw="90.077835"/>
<waypoint x="50.721245" y="236.874359" z="0.0" pitch="0.0" roll="0.0" yaw="-539.965149"/>
</weather>
</route>
<route id="15" town="Town02">
<weather id="WetNoon" cloudiness="20.000000" precipitation="0.000000" precipitation_deposits="50.000000" wind_intensity="0.350000" sun_azimuth_angle="45.000000" sun_altitude_angle="75.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="42.498779" y="242.125732" z="0.0" pitch="0.0" roll="0.0" yaw="-247.246216"/>
<waypoint x="193.688324" y="199.089539" z="0.0" pitch="0.0" roll="0.0" yaw="-90.012947"/>
</weather>
</route>
<route id="16" town="Town02">
<weather id="WetNight" cloudiness="20.000000" precipitation="0.000000" precipitation_deposits="50.000000" wind_intensity="0.350000" sun_azimuth_angle="225.000000" sun_altitude_angle="-80.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="28.621359" y="306.543640" z="0.0" pitch="0.0" roll="0.0" yaw="-0.039055"/>
<waypoint x="189.076874" y="297.649384" z="0.0" pitch="0.0" roll="0.0" yaw="114.249596"/>
</weather>
</route>
<route id="17" town="Town02">
<weather id="WetNight" cloudiness="20.000000" precipitation="0.000000" precipitation_deposits="50.000000" wind_intensity="0.350000" sun_azimuth_angle="225.000000" sun_altitude_angle="-80.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="-3.447191" y="197.408600" z="0.0" pitch="0.0" roll="0.0" yaw="272.104706"/>
<waypoint x="94.700897" y="187.595657" z="0.0" pitch="0.0" roll="0.0" yaw="180.026260"/>
</weather>
</route>
<route id="18" town="Town02">
<weather id="WetNoon" cloudiness="20.000000" precipitation="0.000000" precipitation_deposits="50.000000" wind_intensity="0.350000" sun_azimuth_angle="45.000000" sun_altitude_angle="75.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="167.504059" y="109.429504" z="0.0" pitch="0.0" roll="0.0" yaw="359.961060"/>
<waypoint x="90.981232" y="236.898804" z="0.0" pitch="0.0" roll="0.0" yaw="-179.965195"/>
</weather>
</route>
<route id="19" town="Town02">
<weather id="ClearNight" cloudiness="15.000000" precipitation="0.000000" precipitation_deposits="0.000000" wind_intensity="0.350000" sun_azimuth_angle="0.000000" sun_altitude_angle="-80.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="15.400912" y="187.559296" z="0.0" pitch="0.0" roll="0.0" yaw="180.026260"/>
<waypoint x="90.659309" y="306.544250" z="0.0" pitch="0.0" roll="0.0" yaw="0.019417"/>
</weather>
</route>
<route id="20" town="Town02">
<weather id="ClearSunset" cloudiness="15.000000" precipitation="0.000000" precipitation_deposits="0.000000" wind_intensity="0.350000" sun_azimuth_angle="45.000000" sun_altitude_angle="15.000000" fog_density="0.000000" fog_distance="0.000000" fog_falloff="0.000000" wetness="0.000000">
<waypoint x="48.636131" y="306.530029" z="0.0" pitch="0.0" roll="0.0" yaw="-0.009153"/>
<waypoint x="52.700909" y="187.576401" z="0.0" pitch="0.0" roll="0.0" yaw="-179.973694"/>
</weather>
</route>
</routes>
Loading

0 comments on commit f6d6b84

Please sign in to comment.