Commit Graph

102 Commits

Author SHA1 Message Date
Gijs Koning
01968ca61b Simulator: Fix keyboard input (#24320)
* Fix keyboard input for simulator

* add unblock_stdout() to test

* Revert import change
2022-04-25 07:26:30 -07:00
Gijs Koning
9be23cbdb9 Simulator Tests (#24274)
* squash #24009

* Fix from other pr
Add low-quality arg

* Update tools/sim/test/test_carla_integration.py

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* Updates for comments. Not finished yet

* commit

* fix arguments

* Final changes for comments

* Final fixes

* increase carla client timeout to 10

* make test executable

* actually wait for controlsd to send messages

* Error proof test. Starting up carla at each test and closing down using docker (tried many things).

* commit test carla

* Removed some time.sleeps
Add some more retries for bridge.

* Stop while loop on shutdown

* Increase teardown waiting time

Co-authored-by: Willem Melching <willem.melching@gmail.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-04-22 18:00:49 +02:00
grekiki
b8b15d5cf1 mypy: enable --warn-unreachable (#24282)
* Optional solves mypy assuming None is always None

* oops

* spaces

* Update registration.py

* fix local error

Co-authored-by: Willem Melching <willem.melching@gmail.com>
2022-04-21 18:27:45 +02:00
Gijs Koning
13254cef2f Add wide camera to Carla (#23989)
* Add c3 camera flag to bridge.py

* Set c3_cameras to default

* add runtime error message

* Remove c2 arg

* Update to 163 fov to not see through car

* update comment

* Update tools/sim/bridge.py

Co-authored-by: Willem Melching <willem.melching@gmail.com>

* Revert camera.py changes

* Remove focal_length

* cleanup

Co-authored-by: Willem Melching <willem.melching@gmail.com>
2022-04-20 08:06:56 -07:00
Gijs Koning
e95a250bca Carla pip dependency and fix for git init (#24258)
* Add carla pip dependency for dev

* Revert other packages in pipfile

* Remove redundant carla install in docker

* Fix CI
Remove broken openpilot_build

* New run command
2022-04-20 05:23:27 -07:00
Adeeb Shihadeh
d1c3b7a20d sim: write params to enable in Dockerfile (#24113) 2022-04-04 09:05:20 -07:00
Adeeb Shihadeh
bb36a1c8b2 sim: add ignition toggling (#24043) 2022-03-25 14:17:45 -07:00
Jack Huang
db93275d87 CARLA: fix setting camera EOF (#24034)
* Fix Openpilot in Carla isn't accelerating

The scalars of the timestamp are different in real-world and simulation,
which will cause an infinite loop in selfdrive/modeld/modeld.cc.

* Set eof based on the frame ID

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* remove global

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-03-25 13:45:08 -07:00
Adeeb Shihadeh
8af20af66d pylint: enforce indentation (W0311) (#24039)
* pylint: enforce indentation (W0311)

* few more
2022-03-24 23:23:29 -07:00
Gijs Koning
3d8537ab23 Update carla script to easier install docker and nvidia-docker (#23986)
* Easier docker and nvidia-docker install in carla script

* Small cleanup

* cleanuo

* cleanup

* More comments

* Remove adding usergroup step
2022-03-18 14:07:39 -07:00
Gijs Koning
57b6fdc17a Rename RGB vision streams to match YUV streams (#23961)
* Renaming VISION_STREAM_RGB_.. to match yuv names like VISION_STREAM_ROAD
VISION_STREAM_RGB_BACK -> VISION_STREAM_RGB_ROAD
VISION_STREAM_RGB_FRONT -> VISION_STREAM_RGB_DRIVER

* little more

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-03-14 14:03:54 -07:00
Adeeb Shihadeh
36a3ec04be sim: fix bridge after default values removed from CANParser 2022-01-29 18:22:14 -08:00
Adeeb Shihadeh
fa3055f280 smaller docker image (#23469)
* save 2gb

* not used

* more cleanup

* little more

* wget too big

* follow

* needed for sim
2022-01-10 11:43:18 -08:00
Ewout ter Hoeven
332f568a82 Pyupgrade 3.6: Update syntax with Python 3.6+ features (#23305)
Updated Python code with Python 3.6+ features:
- utf-8 encoding is now the default (PEP 3120)
- Replace list comprehensions by Generator Expressions (PEP 289)
- Replace yield loop by yield from (PEP 380)
- Remove the (object) subclass when defining a class
- Replace the IOError alias by OSError (PEP 3151)
- Define sets with curly braces {} instead of set()
- Remove "r" parameter from open function, which is default

Co-Authored-By: Adeeb Shihadeh <8762862+adeebshihadeh@users.noreply.github.com>
Co-Authored-By: GregorKikelj <96022003+GregorKikelj@users.noreply.github.com>

Co-authored-by: Adeeb Shihadeh <8762862+adeebshihadeh@users.noreply.github.com>
Co-authored-by: GregorKikelj <96022003+GregorKikelj@users.noreply.github.com>
2021-12-24 11:18:39 -08:00
Ewout ter Hoeven
55390d273f Convert format strings strings to f-strings (#23241)
* Convert all text strings to f-strings

Reformats all the text from the old "%-formatted" and .format(...) format to the newer f-string format, as defined in PEP 498. This requires Python 3.6+.

Flynt 0.69 was used to reformat the strings. 120 f-strings were created in 51 files.

F-strings are in general more readable, concise and performant. See also: https://www.python.org/dev/peps/pep-0498/#rationale

* revert pyextra changes

* revert ublox.py

Co-authored-by: Willem Melching <willem.melching@gmail.com>
2021-12-16 14:58:17 +01:00
Dean Lee
348d2d2b0d rename yuv streams (#23071)
* rename yuv streams

* bump cereal

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-11-29 18:14:59 -08:00
Willem Melching
a4ca8e4835 sim: improve carla performance (#23046) 2021-11-28 11:32:37 +01:00
Adeeb Shihadeh
8160cf3c1b camerad: remove camera frame stream (#23045)
* camerad: remove camera frame stream

* fix release files
2021-11-27 21:58:21 -08:00
jimw
a58d272ae4 CARLA: send YUV and RGB over visionipc from bridge.py (#23012)
* CARLA: send YUV and RGB over visionipc

* CARLA: send YUV and RGB over visionipc-fix pipfile

* CARLA: send YUV and RGB over visionipc-Camerad class

* relock pipfile

* small bridge cleanup

* use tici camera resolution

* update vof

* HUD_SETTING has no counter

* no loggerd

Co-authored-by: jwolffe <wolffja@gmail.com>
Co-authored-by: Willem Melching <willem.melching@gmail.com>
2021-11-26 16:58:25 +01:00
Adeeb Shihadeh
45ced84acf sim: fix CAN error and block loggerd 2021-11-13 12:21:24 -08:00
Adeeb Shihadeh
e556d3d3d3 sim: set fingerprint with environment variable (#22679) 2021-10-24 21:59:50 -07:00
jimw
26c5e7b826 sim: send peripheralState message (#22541)
* controlsd: ignore peripheralState for Simulation

* controlsd: use fake peripheralState for Simulation

* controlsd: use fake peripheralState for Simulation

* controlsd: use fake peripheralState for Simulation

* Apply suggestions from code review

* sim: send peripheralState message

* sim: send peripheralState message

* sim: send peripheralState message

* sim: send peripheralState message

Co-authored-by: wolffja <wolffja@ubuntu20.04LTS>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-10-13 17:16:56 -07:00
xia0long
a3c26a912a sim: update CARLA to 0.9.12 (#22497)
* bump carla

* update dockerfile

* no need

* specify version

* some fixups

* fix start_carla

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-10-10 15:54:47 -07:00
Adeeb Shihadeh
04271fef55 improve sim readme 2021-10-10 15:50:30 -07:00
Robbe Derks
91987f38d4 Make pandaState and safetyMode a list (#22454)
* wip: move to pandaStates

* bump cereal

* wip: SafetyMode struct

* move to safetyMode

* fix typo

* this can be None

* fix potential empty pandaStates list

* fix thermald

* fix controlsd

* rename safetyModes to safetyConfigs

* update process_replay

* fix test_models

* bump cereal
2021-10-08 17:54:34 +02:00
Adeeb Shihadeh
5b641379ae phonelibs -> third_party (#22477)
* git mv to third_party

* find and replace

* fix release tests

* update pre-commit

* update tici bins

* update eon bins

Co-authored-by: Comma Device <device@comma.ai>
2021-10-07 16:32:44 -07:00
Adeeb Shihadeh
59c47f0334 sim: build openpilot with frame stream camera 2021-10-07 11:31:49 -07:00
Piotrek Rybiec
8412f607b7 sim: fix race condition in tmux script (#22365)
* carla simulator tmux script enhancement

* real name

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-09-28 14:07:41 -07:00
Alfonso Hernandez
703d0cb832 Fix throttle scaling in simulator to match gas 1.0 to NIDEC_ACCEL_MAX in Honda CarControllerParams (#22310) 2021-09-22 09:38:38 -07:00
HaraldSchafer
7081ab4fb7 Port lateral planning to ACADOS (#22080)
* lateral acados

* looks good!

* add another solve, needed for init somehow

* use copy

* init correctly

* cleanup sconstruct

* Update files_common

* update cpu usage

* reset when invalid

* fix cpu usage

* cost_set doesnt leak

* new ref

* non leaky reset

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
2021-09-13 19:06:54 -07:00
HaraldSchafer
1ac89f14aa Change car controller interface from gas/brake to acceleration (#21911)
* retune civic

* seems smooth

* back to normal

* new ref

* fix conflict

* runs

* rm

* accel scale is 4

* toyota should be good

* more cleanup

* fixup

* better naming

* update ref

* deprecated

* sending brake when not enable causes a fault

* rm gas and brake

* unused

* update ref

* acura logic is no more

* wrong before

* revert tuning cleanup

* adress comments

* update ref

* already on master

Co-authored-by: Willem Melching <willem.melching@gmail.com>
2021-08-30 09:32:52 -07:00
HaraldSchafer
6838e1c82c Refactor lateral lag compensation (#21334)
* add T_IDXS

* refactor

* fix test

* unused

* typo

* needs casting

* Update selfdrive/controls/lib/drive_helpers.py

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* deprecate field

* regen all

* new segs

* add todo

* split back

* clean

* bad names

* do in controls

* add arg

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-06-30 14:19:39 -07:00
orphen
325cabd4da fix: sim: gracefully shutdown the bridge (#21413) 2021-06-29 13:45:34 -07:00
HaraldSchafer
234971203b Simplify longitudinal tests (#21337)
* first pass

* passes!

* little more cleanup

* little more

* fix sim

* remove more plot stuff

* fix crash check

* fcw

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-06-24 21:03:18 -07:00
Alfonso Hernandez
22b632f407 Simulator: Complete GPS message from Carala State Values (#21357) 2021-06-21 13:52:46 +02:00
siggie0815
c798c5f027 CARLA: save calibration params as capnp (#21144) 2021-06-04 16:05:05 -07:00
Josh Smith
77321dbac4 Add type hints, small cleanups (#21080)
* improve tools.lib.kbhit and tools.sim.lib.keyboard_ctrl

* unpack more efficiently

* minor improvements

* agnos.py match spec better

* manual_ctrl test missing queue arg

* fix incorrect type annotation

* queues are generic

* varname reuse resulting in incorrect type inference

* bytes().hex() rather than bytes.hex(bytes())

* a bit of type hinting stuff
2021-06-03 12:21:04 +02:00
Cameron Reikes
fc4f27d20a sim: get GPS data from CARLA (#20717)
* Send simulated carla GPS to OP

* Use ublox enum from cereal

* Add more fields to carla gnss packet

* use math.degrees

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-05-18 19:52:09 -07:00
Cameron Reikes
12ce822252 Set standstill bit in sim (#20921) 2021-05-15 21:09:17 -07:00
siggie0815
4b7ea0a032 sim: mount working dir to the same dir in the container (#20908) 2021-05-14 20:00:13 -07:00
ChoMinSung
780654cb3b start_openpilot_docker.sh: pass in /dev/input for joystick support (#20563) 2021-04-06 09:55:18 +02:00
Willem Melching
c563968003 sim/build_container.sh: fix container name 2021-03-23 13:20:59 +01:00
ChoMinSung
34342b21a9 start_openpilot_docker.sh: fix docker container name (#20444) 2021-03-23 13:20:11 +01:00
iejMac
1830a87d9a update simulator README 2021-03-17 00:42:32 -07:00
iejMac
dc1506e382 mount openpilot in simulator docker image (#20379)
* mount parameter

* works

* fixes
2021-03-16 22:23:38 -07:00
wolterhv
5463469f71 Specify comma containers come from ghcr.io in docker pull commands. (#20342) 2021-03-14 12:59:05 -07:00
iejMac
1e5b04ba2f Minimize sim docker image size (#20324) 2021-03-11 19:04:29 -08:00
iejMac
c4031750f3 improving tools readme (#20305)
* rough draft

* plotjuggler and carla description

* testing someting

* this is cool

* very short replay and debug desc

* small change

* small change 2

* better word

* low quality mode

* better word

* fixes

* changes

* minor fixes

* ubuntu_setup fix + README changes

* Update tools/README.md

* Update README.md

* Update README.md

* Update README.md

* changes

* Update tools/sim/README.md

* final changes

* final change

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-03-11 15:28:37 -08:00
iejMac
baf07191d2 tuning simulator parameters (#20304)
* regular and low quality

* low_quality instead of quality

* fix
2021-03-10 21:57:24 -08:00
iejMac
ea5fec7636 optimizing simulator performance (#20295)
* 20 hz

* weird blank screen on Low quality

* Epic quality
2021-03-09 23:48:46 -08:00