Fix simulator docker: CPU only for now (#20227)
* initial commit * CPU working in dokcer * Update selfdrive/manager.py Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * Update selfdrive/manager.py * fixes * fixing env var * fixes * building and running in docker * camerad fix * camerad fix * this ACTUALLY works * removing unused libraries * updating to CARLA 0.9.11 * removing useless flags * small changes * forgot this * sudo not needed for xhost * final changes Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>pull/20251/head
parent
d54e4bd60a
commit
968ed10200
|
@ -1,10 +1,11 @@
|
|||
#!/usr/bin/env python3
|
||||
# TODO: why are the keras models saved with python 2?
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
os.environ["OMP_NUM_THREADS"] = "1"
|
||||
|
||||
import onnxruntime as ort
|
||||
|
||||
def read(sz):
|
||||
|
@ -53,4 +54,3 @@ if __name__ == "__main__":
|
|||
ort_session = ort.InferenceSession(sys.argv[1], options)
|
||||
ort_session.set_providers([provider], None)
|
||||
run_loop(ort_session)
|
||||
|
||||
|
|
|
@ -6,40 +6,33 @@ RUN apt-get update && apt-get install -y \
|
|||
tar \
|
||||
curl \
|
||||
xz-utils \
|
||||
beignet-opencl-icd \
|
||||
libglvnd-dev \
|
||||
alien \
|
||||
dbus \
|
||||
gcc-arm-none-eabi \
|
||||
tmux \
|
||||
vim \
|
||||
lsb-core \
|
||||
libx11-6 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Intel OpenCL driver
|
||||
ARG INTEL_DRIVER=opencl_runtime_16.1.1_x64_ubuntu_6.4.0.25.tgz
|
||||
ARG INTEL_DRIVER_URL=http://registrationcenter-download.intel.com/akdlm/irc_nas/9019
|
||||
ARG INTEL_DRIVER=l_opencl_p_18.1.0.015.tgz
|
||||
ARG INTEL_DRIVER_URL=http://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/15532
|
||||
RUN mkdir -p /tmp/opencl-driver-intel
|
||||
WORKDIR /tmp/opencl-driver-intel
|
||||
RUN echo INTEL_DRIVER is $INTEL_DRIVER; \
|
||||
curl -O $INTEL_DRIVER_URL/$INTEL_DRIVER; \
|
||||
tar -xzf $INTEL_DRIVER; \
|
||||
for i in $(basename $INTEL_DRIVER .tgz)/rpm/*.rpm; do alien --to-deb $i; done; \
|
||||
dpkg -i *.deb; \
|
||||
rm -rf $INTEL_DRIVER $(basename $INTEL_DRIVER .tgz) *.deb; \
|
||||
mkdir -p /etc/OpenCL/vendors; \
|
||||
echo /opt/intel/*/lib64/libintelocl.so > /etc/OpenCL/vendors/intel.icd; \
|
||||
rm -rf /tmp/opencl-driver-intel;
|
||||
RUN echo INTEL_DRIVER is $INTEL_DRIVER && \
|
||||
curl -O $INTEL_DRIVER_URL/$INTEL_DRIVER && \
|
||||
tar -xzf $INTEL_DRIVER && \
|
||||
for i in $(basename $INTEL_DRIVER .tgz)/rpm/*.rpm; do alien --to-deb $i; done && \
|
||||
dpkg -i *.deb && \
|
||||
rm -rf $INTEL_DRIVER $(basename $INTEL_DRIVER .tgz) *.deb && \
|
||||
mkdir -p /etc/OpenCL/vendors && \
|
||||
echo /opt/intel/opencl_compilers_and_libraries_18.1.0.015/linux/compiler/lib/intel64_lin/libintelocl.so > /etc/OpenCL/vendors/intel.icd && \
|
||||
rm -rf /tmp/opencl-driver-intel
|
||||
|
||||
# Open[GL,CL] for gpu
|
||||
ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES},display
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
mesa-utils \
|
||||
ocl-icd-libopencl1 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN mkdir -p /etc/OpenCL/vendors && \
|
||||
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
|
||||
ENV NVIDIA_VISIBLE_DEVICES all
|
||||
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,display
|
||||
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
|
||||
ENV QTWEBENGINE_DISABLE_SANDBOX 1
|
||||
|
||||
RUN dbus-uuidgen > /etc/machine-id
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ parser.add_argument('--joystick', action='store_true')
|
|||
parser.add_argument('--town', type=str, default='Town04')
|
||||
parser.add_argument('--spawn_point', dest='num_selected_spawn_point',
|
||||
type=int, default=16)
|
||||
parser.add_argument('--cloudyness', default=0.1, type=float)
|
||||
parser.add_argument('--cloudiness', default=0.1, type=float)
|
||||
parser.add_argument('--precipitation', default=0.0, type=float)
|
||||
parser.add_argument('--precipitation_deposits', default=0.0, type=float)
|
||||
parser.add_argument('--wind_intensity', default=0.0, type=float)
|
||||
|
@ -62,7 +62,7 @@ def cam_callback(image):
|
|||
dat = messaging.new_message('roadCameraState')
|
||||
dat.roadCameraState = {
|
||||
"frameId": image.frame,
|
||||
"image": img.tostring(),
|
||||
"image": img.tobytes(),
|
||||
"transform": [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
|
||||
}
|
||||
pm.send('roadCameraState', dat)
|
||||
|
@ -118,7 +118,6 @@ def fake_driver_monitoring():
|
|||
"faceDetected": True,
|
||||
"isDistracted": False,
|
||||
"awarenessStatus": 1.,
|
||||
"isRHD": False,
|
||||
}
|
||||
pm.send('driverMonitoringState', dat)
|
||||
|
||||
|
@ -143,7 +142,7 @@ def go(q):
|
|||
|
||||
world_map = world.get_map()
|
||||
|
||||
vehicle_bp = blueprint_library.filter('vehicle.tesla.*')[0]
|
||||
vehicle_bp = blueprint_library.filter('vehicle.tesla.*')[1]
|
||||
spawn_points = world_map.get_spawn_points()
|
||||
assert len(spawn_points) > args.num_selected_spawn_point, \
|
||||
f'''No spawn point {args.num_selected_spawn_point}, try a value between 0 and
|
||||
|
@ -167,12 +166,12 @@ def go(q):
|
|||
blueprint.set_attribute('image_size_y', str(H))
|
||||
blueprint.set_attribute('fov', '70')
|
||||
blueprint.set_attribute('sensor_tick', '0.05')
|
||||
transform = carla.Transform(carla.Location(x=0.8, z=1.45))
|
||||
transform = carla.Transform(carla.Location(x=0.8, z=1.13))
|
||||
camera = world.spawn_actor(blueprint, transform, attach_to=vehicle)
|
||||
camera.listen(cam_callback)
|
||||
|
||||
world.set_weather(carla.WeatherParameters(
|
||||
cloudyness=args.cloudyness,
|
||||
cloudiness=args.cloudiness,
|
||||
precipitation=args.precipitation,
|
||||
precipitation_deposits=args.precipitation_deposits,
|
||||
wind_intensity=args.wind_intensity,
|
||||
|
@ -278,7 +277,7 @@ def go(q):
|
|||
sm.update(0)
|
||||
throttle_op = sm['carControl'].actuators.gas #[0,1]
|
||||
brake_op = sm['carControl'].actuators.brake #[0,1]
|
||||
steer_op = sm['controlsState'].angleSteersDes # degrees [-180,180]
|
||||
steer_op = sm['controlsState'].steeringAngleDesiredDeg # degrees [-180,180]
|
||||
|
||||
throttle_out = throttle_op
|
||||
steer_out = steer_op
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd /tmp
|
||||
FILE=CARLA_0.9.7.tar.gz
|
||||
FILE=CARLA_0.9.11.tar.gz
|
||||
rm -f $FILE
|
||||
curl -O http://carla-assets-internal.s3.amazonaws.com/Releases/Linux/$FILE
|
||||
curl -O https://carla-releases.s3.eu-west-3.amazonaws.com/Linux/$FILE
|
||||
|
||||
rm -rf carla_tmp
|
||||
mkdir -p carla_tmp
|
||||
cd carla_tmp
|
||||
tar xvf ../$FILE PythonAPI/
|
||||
easy_install PythonAPI/carla/dist/carla-0.9.7-py3.5-linux-x86_64.egg || true
|
||||
easy_install PythonAPI/carla/dist/carla-0.9.11-py3.7-linux-x86_64.egg || true
|
||||
|
||||
cd ..
|
||||
rm -rf /tmp/$FILE
|
||||
rm -rf carla_tmp
|
||||
|
|
|
@ -15,20 +15,14 @@ if ! $(apt list --installed | grep -q nvidia-container-toolkit); then
|
|||
fi
|
||||
fi
|
||||
|
||||
docker pull carlasim/carla:0.9.7
|
||||
|
||||
if [ -z "$WINDOW" ]; then
|
||||
docker run -it --net=host --gpus all carlasim/carla:0.9.7
|
||||
else
|
||||
docker run --name openpilot_carla \
|
||||
--privileged --rm \
|
||||
--net=host \
|
||||
-e SDL_VIDEODRIVER=x11 \
|
||||
-e DISPLAY=$DISPLAY \
|
||||
-v /tmp/.X11-unix:/tmp/.X11-unix \
|
||||
-it \
|
||||
--gpus all \
|
||||
carlasim/carla:0.9.7 \
|
||||
./CarlaUE4.sh -quality-level=Medium
|
||||
fi
|
||||
docker pull carlasim/carla:0.9.11
|
||||
|
||||
docker run \
|
||||
--rm \
|
||||
--net=host \
|
||||
-e SDL_VIDEODRIVER='offscreen' \
|
||||
-v /tmp/.X11-unix:/tmp/.X11-unix \
|
||||
-it \
|
||||
--gpus all \
|
||||
carlasim/carla:0.9.11 \
|
||||
./CarlaUE4.sh -quality-level=Medium
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
# expose X to the container
|
||||
xhost +local:root
|
||||
docker pull commaai/openpilot-sim:latest
|
||||
|
||||
docker run --net=host\
|
||||
--name openpilot_client \
|
||||
--rm \
|
||||
-it \
|
||||
--gpus all \
|
||||
--device=/dev/dri/ \
|
||||
--device=/dev/dri \
|
||||
-v /tmp/.X11-unix:/tmp/.X11-unix \
|
||||
--shm-size 1G \
|
||||
-e DISPLAY=$DISPLAY \
|
||||
-e QT_X11_NO_MITSHM=1 \
|
||||
commaai/openpilot-sim:latest \
|
||||
/bin/bash -c "cd tools && cd sim && sh tmux_script.sh $*"
|
||||
/bin/bash -c "cd /openpilot/tools/sim && ./tmux_script.sh $*"
|
||||
|
|
Loading…
Reference in New Issue