-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7df9086
commit 3a4dba5
Showing
352 changed files
with
15,975 additions
and
3,888 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Common variables | ||
NUPLAN_TEST_MAPS_VERSION="nuplan-maps-v1.0" | ||
|
||
# Simulation variables | ||
SIMULATION_CONTAINER_PORT=50050 | ||
SIMULATION_IMAGE="nuplan/nuplan" | ||
|
||
# Submission variables | ||
SUBMISSION_CONTAINER_PORT=50051 | ||
SUBMISSION_IMAGE="test-contestant/nuplan-test-submission" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
FROM ubuntu:20.04 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y curl gnupg2 software-properties-common default-jdk | ||
|
||
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn | ||
|
||
RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | apt-key add - \ | ||
&& curl -fsSL https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add - \ | ||
&& curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu20.04/nvidia-docker.list | tee /etc/apt/sources.list.d/nvidia-docker.list \ | ||
&& add-apt-repository "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" \ | ||
&& apt-get update \ | ||
&& apt-get install -y \ | ||
bazel \ | ||
file \ | ||
zip \ | ||
nvidia-container-toolkit \ | ||
software-properties-common \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Download miniconda and install silently. | ||
ENV PATH /opt/conda/bin:$PATH | ||
RUN curl -fsSLo Miniconda3-latest-Linux-x86_64.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ | ||
bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda && \ | ||
rm Miniconda3-latest-Linux-x86_64.sh && \ | ||
conda clean -a -y | ||
|
||
# Setup working environement | ||
ARG NUPLAN_HOME=/nuplan_devkit | ||
WORKDIR $NUPLAN_HOME | ||
|
||
COPY requirements.txt requirements_submission.txt $NUPLAN_HOME/ | ||
|
||
RUN bash -c "python -m pip install --upgrade pip --pre && \ | ||
pip install --no-cache-dir -r $NUPLAN_HOME/requirements.txt -f https://download.pytorch.org/whl/torch_stable.html && \ | ||
pip install --no-cache-dir -r $NUPLAN_HOME/requirements_submission.txt" | ||
|
||
RUN mkdir -p $NUPLAN_HOME/nuplan | ||
|
||
COPY setup.py $NUPLAN_HOME | ||
COPY nuplan $NUPLAN_HOME/nuplan | ||
|
||
RUN bash -c "pip install -e ." | ||
|
||
ENV NUPLAN_MAPS_ROOT=/data/sets/nuplan/maps \ | ||
NUPLAN_DATA_ROOT=/data/sets/nuplan \ | ||
NUPLAN_EXP_ROOT=/data/exp/nuplan | ||
|
||
CMD ["/bin/bash", "-c", "python nuplan/submission/submission_planner.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: "3.7" | ||
|
||
x-nuplan-volumes: &x-nuplan-volumes | ||
volumes: | ||
- "$NUPLAN_DATA_ROOT:/data/sets/nuplan:rw" | ||
|
||
|
||
services: | ||
submission: | ||
<<: *x-nuplan-volumes | ||
container_name: "test-contestant_nuplan-test-submission" | ||
image: ${SUBMISSION_IMAGE} | ||
env_file: | ||
- .env | ||
ports: | ||
- ${SUBMISSION_CONTAINER_PORT}:${SUBMISSION_CONTAINER_PORT} | ||
|
||
tty: true | ||
|
||
simulation: | ||
<<: *x-nuplan-volumes | ||
env_file: | ||
- .env | ||
environment: | ||
'NUPLAN_CHALLENGE': $NUPLAN_CHALLENGE | ||
'NUPLAN_PLANNER': $NUPLAN_PLANNER | ||
image: ${SIMULATION_IMAGE} | ||
ports: | ||
- ${SIMULATION_CONTAINER_PORT}:${SIMULATION_CONTAINER_PORT} | ||
tty: true | ||
depends_on: | ||
- submission | ||
entrypoint: /nuplan_devkit/nuplan/entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: nuplan | ||
channels: | ||
- conda-forge | ||
dependencies: | ||
- python=3.9 | ||
- pip=21.2.4 | ||
- nb_conda_kernels | ||
- pip: | ||
- -r requirements_torch.txt | ||
- -r requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
from __future__ import annotations | ||
|
||
from typing import List, Optional | ||
|
||
from nuplan.common.actor_state.state_representation import TimePoint | ||
from nuplan.planning.simulation.trajectory.predicted_trajectory import PredictedTrajectory | ||
|
||
|
||
class AgentTemporalState: | ||
""" | ||
Actor with current, multimodal future as well as past trajectory. | ||
The future trajectory probabilities have to sum up to 1.0. | ||
The past trajectory is only single modal with mode probability 1.0. | ||
The last waypoint in past trajectory has to be the same as current position (we check only timestamp). | ||
""" | ||
|
||
def __init__( | ||
self, | ||
initial_time_stamp: TimePoint, | ||
predictions: Optional[List[PredictedTrajectory]] = None, | ||
past_trajectory: Optional[PredictedTrajectory] = None, | ||
): | ||
""" | ||
Initialize actor temporal state which has past as well as future trajectory | ||
:param initial_time_stamp: time stamp the current detections | ||
:param predictions: future multimodal trajectory | ||
:param past_trajectory: past trajectory transversed | ||
""" | ||
self._initial_time_stamp = initial_time_stamp | ||
self.predictions: List[PredictedTrajectory] = predictions if predictions is not None else [] | ||
self.past_trajectory = past_trajectory | ||
|
||
@property | ||
def predictions(self) -> List[PredictedTrajectory]: | ||
""" | ||
Getter for agents predicted trajectories | ||
:return: Trajectories | ||
""" | ||
return self._predictions | ||
|
||
@predictions.setter | ||
def predictions(self, predicted_trajectories: List[PredictedTrajectory]) -> None: | ||
""" | ||
Setter for predicted trajectories, checks if the listed probabilities sum to one. | ||
:param predicted_trajectories: List of Predicted trajectories | ||
""" | ||
if not predicted_trajectories: | ||
self._predictions = predicted_trajectories | ||
return | ||
# Sanity check that if predictions are provided, probabilities sum to 1 | ||
probability_sum = sum(prediction.probability for prediction in predicted_trajectories) | ||
if not abs(probability_sum - 1) < 1e-6 and predicted_trajectories: | ||
raise ValueError(f"The provided trajectory probabilities did not sum to one, but to {probability_sum:.2f}!") | ||
self._predictions = predicted_trajectories | ||
|
||
@property | ||
def past_trajectory(self) -> Optional[PredictedTrajectory]: | ||
""" | ||
Getter for agents predicted trajectories | ||
:return: Trajectories | ||
""" | ||
return self._past_trajectory | ||
|
||
@past_trajectory.setter | ||
def past_trajectory(self, past_trajectory: Optional[PredictedTrajectory]) -> None: | ||
""" | ||
Setter for predicted trajectories, checks if the listed probabilities sum to one. | ||
:param past_trajectory: Driven Trajectory | ||
""" | ||
if not past_trajectory: | ||
# In case it is none, no check is needed | ||
self._past_trajectory = past_trajectory | ||
return | ||
|
||
# Make sure that the current state is set! | ||
last_waypoint = past_trajectory.waypoints[-1] | ||
if not last_waypoint: | ||
raise RuntimeError("Last waypoint represents current agent's state, this should not be None!") | ||
|
||
# Sanity check that last waypoint is at the same time index as the current one | ||
if last_waypoint.time_point != self._initial_time_stamp: | ||
raise ValueError( | ||
"The provided trajectory does not end at current agent state!" | ||
f" {last_waypoint.time_us} != {self._initial_time_stamp}" | ||
) | ||
self._past_trajectory = past_trajectory |
Oops, something went wrong.