mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-30 19:33:45 +08:00
Carla fixes (#19824)
* use carla provided frame_number * fix carla comm issues error * add minimal W-A-S-D keyboard controls * fix window from carla docker not showing * carla 0.9.7 uses `frame`, not `frame_number` * set safetyModel on health for simulator * safetyModel check now works with simulator * ignore ubloxRaw and frontFrame when running sim * Update selfdrive/controls/controlsd.py Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * added WINDOW flag for optional show carla window Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> old-commit-hash: c03a95f7f92ab3eda7fe3b3db9776062aae0cbac
This commit is contained in:
+3
-2
@@ -61,7 +61,7 @@ def cam_callback(image):
|
||||
|
||||
dat = messaging.new_message('frame')
|
||||
dat.frame = {
|
||||
"frameId": frame_id, # TODO: can we get frame ID from the CARLA camera?
|
||||
"frameId": image.frame,
|
||||
"image": img.tostring(),
|
||||
"transform": [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
|
||||
}
|
||||
@@ -89,7 +89,8 @@ def health_function():
|
||||
dat.health = {
|
||||
'ignitionLine': True,
|
||||
'hwType': "blackPanda",
|
||||
'controlsAllowed': True
|
||||
'controlsAllowed': True,
|
||||
'safetyModel': 'hondaNidec'
|
||||
}
|
||||
pm.send('health', dat)
|
||||
time.sleep(0.5)
|
||||
|
||||
@@ -44,6 +44,14 @@ def keyboard_poll_thread(q):
|
||||
q.put(str("cruise_down"))
|
||||
if c == '3':
|
||||
q.put(str("cruise_cancel"))
|
||||
if c == 'w':
|
||||
q.put(str("throttle_%f" % 1.0))
|
||||
if c == 'a':
|
||||
q.put(str("steer_%f" % 0.15))
|
||||
if c == 's':
|
||||
q.put(str("brake_%f" % 1.0))
|
||||
if c == 'd':
|
||||
q.put(str("steer_%f" % -0.15))
|
||||
if c == 'q':
|
||||
exit(0)
|
||||
|
||||
|
||||
@@ -16,4 +16,19 @@ if ! $(apt list --installed | grep -q nvidia-container-toolkit); then
|
||||
fi
|
||||
|
||||
docker pull carlasim/carla:0.9.7
|
||||
docker run -it --net=host --gpus all 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user