Commit Graph

149 Commits

Author SHA1 Message Date
Justin Newberry
4291784b4d Messaging: DT Param on wait_for_readers_to_update (#529)
* dt param

* same as the others
2023-09-05 11:02:17 -07:00
Dean Lee
bf8db88407 cpplint: more filters (#522)
more filters
2023-08-24 11:31:53 -07:00
Adeeb Shihadeh
fa580de1b4 make services a map (#520) 2023-08-23 13:26:00 -07:00
Adeeb Shihadeh
3cac040c5b use time.monotonic() instead of importing from openpilot 2023-08-20 17:20:28 -07:00
Shane Smiskol
8dd787e9a6 mypy: check untyped definitions (#517)
* add cereal mypy.ini

* mypy doesn't use unittest asserts yet

* Argument 1 to "len" has incompatible type "object"; expected "Sized"  [arg-type]

* type ports

* int|none

* final thing

* move to pyproject.toml

* clean p
2023-08-17 20:19:01 -07:00
Justin Newberry
227c7ca55f Ruff: propogate config from OP (#513) 2023-08-14 12:53:17 -07:00
Justin Newberry
f01d677e1d CI: pylint to ruff (#512)
* pylint to ruff

* fix ruff
2023-08-07 15:55:35 -07:00
Mitchell Goff
ba3238ef9c Added MessageBuilder methods to serialize to an existing buffer (#511) 2023-08-07 13:45:35 -07:00
Maxime Desroches
aed9fd278a Update pycapnp (#499)
* context

* cython

* -Wno-parentheses-equality

* -Wno-everything

* remove werror
2023-07-18 13:09:49 -07:00
Adeeb Shihadeh
cf9c5cbb91 PubMaster: add wait_for_readers_to_update helper 2023-07-17 09:49:39 -07:00
Kacper Rączy
a2f1f0cb8d SubMaster: replace SIMULATION constant with property (#495)
* Add simulation property to python submaster

* decode bstrings before formatting error messages
2023-07-11 19:30:00 -07:00
Kacper Rączy
457753aa6a tests: fix recv_one_or_none test (#447)
* Fixed recv_one_or_none test

* Remove sleep

* Add skipIf to test_recv_one_or_none on ZMQ

* Add zmq_expected_failure decorator
2023-07-05 11:38:43 -07:00
Adeeb Shihadeh
11d560b9b9 sm: fix avg freq check 2023-06-22 23:29:20 -07:00
Adeeb Shihadeh
1f9d582a8d SubMaster: fix recv_dts initial state (#487)
* SubMaster: fix recv_dts initial state

* any len
2023-06-22 22:45:05 -07:00
Kacper Rączy
f495c6bb90 macOS: stub implementation of event API (#476)
* Add runtime checks for event API on macOS

* Fix stub ppoll impl

* Fix lint issues

* Remove assert from event_state_shm_mmap

* Add variable args in ppoll macro

* Skip fake socket tests on macOS

* Add missing newline

* PPOLL and ppoll_impl definitions

* Update macro signature

* Fix issues on linux

* Stub empty implementation of event for macos

* Go back to shorter fds/timeout initialization

* Complete stub implementation of event api

* Fix unused variable warning

* Remove extra space
2023-06-19 17:09:29 -07:00
Kacper Rączy
c27be716ec connect: add error messages when Socket connect fails (#456)
* Throw runtime_error in Socket::create

* Add messages to MessagingError

* Fix cython bindings

* Write a message to stderr instead of throwing runtime_error
2023-06-02 15:14:08 -07:00
Kacper Rączy
4e063ca166 FakeSubSocket and FakePubSocket for IPC synchronization (#439)
* Implementation of FakeSubSocket and FakePubSocket using eventfd with support for one-in/one-out synchronization

* Expose FakeEvent to Python

* Add demo showcasing synchronization between processes

* Fix linter errors

* Expose more FakeEvent APIs in Python bindings

* Add FakePoller implementation

* Remove suffix from poll env vars

* Set poller timeout to zero when events are enabled

* Replace poll with ppoll. Add invalidation methods

* Fix lint issues

* Fix comment indent

* Remove fake_demo

* Remove FakePubSocket. Simpler FakePoller implementation. Ability to wait for multiple events

* Rename FakeEvent to Event and move it to event.cc

* Rename event purpose constants in py

* Add support for timeout in wait methods

* Add tests for events and fake sockets

* Fix lint errors

* Add zmq sleeps

* Temporarly disable TestFakeSockets on ZMQ

* Add exception type specifiers to test_fake

* Event Manager implementation

* Fix fake sockets tests

* Update EventManager API

* Add test for enable/disable

* Add tests for cereal prefix

* Remove EventPurpose from python bindings

* Fix lint issues

* event_state_shm_mmap implementation shared by EventManager and FakeSubSocket

* Rename EventManager to SocketEventHandle

* More renames
2023-05-23 19:38:52 +02:00
Adeeb Shihadeh
d3de9ddd26 messaging: remove extern C (#443) 2023-05-10 10:59:18 -07:00
Adeeb Shihadeh
959ff79963 add cpplint (#401)
* add cpplint

* include what you use

* whitespace fixes

* passes
2022-12-31 16:33:09 -08:00
Adeeb Shihadeh
6e58b293ee include from project root (#402) 2022-12-31 14:19:29 -08:00
ntegan1
4ec689c0c4 fix set but unused warning (#390)
* fix set but unused warning

* re-run ci maybe
2022-11-30 11:36:17 -08:00
Willem Melching
72fb965dcf Add missing time.h include (#385)
add missing time.h include
2022-11-21 16:10:55 -08:00
Adeeb Shihadeh
1d25fc3f20 msgq: bump num readers up a bit (#379) 2022-10-24 17:53:32 -07:00
Kurt Nistelberger
e310f4860d Sensor events splitup (#357)
* change from sensorEvents to separated events

* fix numbering

* remove sensorEvent

* update after rebase

* .

* move bmx gyro and accel to its own channels

* address PR comments

* .

* inc frequency in tests

* .

* rename sensorEventsDEPRECATED sensorEvents

* readd sensorEvents in services.py

* .

Co-authored-by: Kurt Nistelberger <kurt.nistelberger@gmail.com>
2022-09-27 15:28:22 -07:00
Adeeb Shihadeh
452a9d8028 msgq: remove special queue size for camera states (#343) 2022-08-20 22:34:44 -07:00
Adeeb Shihadeh
98f795fd73 bridge: break early for do_exit 2022-06-11 18:16:47 -07:00
Adeeb Shihadeh
78870ba056 bridge: don't get stuck retrying while exiting 2022-06-11 17:51:23 -07:00
Shane Smiskol
9c0c517bc8 SubMaster: add poll argument to C++ class (#307)
* add poll to c++ submaster

* one line

* clean up

one line

* Update messaging/socketmaster.cc

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

* Update messaging/socketmaster.cc

* comment makes more sense

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-05-20 14:24:38 -07:00
Lukas Petersson
c09b92c72b messaging: support OPENPILOT_PREFIX (#299)
* messaging prefix

* cleanup

* cleanup

* cleanup

* bin

* clean dir

* max dirs working

* increase max dirs

* check if file exists

* filesystem except

* cleanup

* dont delete manager folder

* dont delete manager folder fix

* default dir

* create file structure

* tab size

* assert no prefix when zmq

* PR feedback

* create dir in test

* Update messaging/messaging.cc

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

* import

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-05-16 17:19:32 -07:00
Willem Melching
8e8831f8e0 fixes for mypy check for return-any 2022-05-12 14:14:05 +02:00
Comma Device
c7d3a0acba fix bridge dropping messages 2022-05-06 17:18:03 -07:00
Adeeb Shihadeh
582c379261 silence that 2022-05-06 17:09:31 -07:00
Adeeb Shihadeh
e1395936c0 msgq: remove common prints 2022-04-19 13:57:28 -07:00
Adeeb Shihadeh
6eb3994daa bridge: exit cleanly (#283) 2022-04-19 13:40:34 -07:00
Walter Morales
e52b26f886 Fixed cereal bug for simulation in Carla (#277) 2022-04-08 10:13:33 -07:00
Willem Melching
1620ce54ee add SubMaster.freq_ok (#274)
* add SubMaster.freq_ok

* actually check freq_ok

* include freq ok into alive again

* revert those changes

* split out from alive
2022-04-06 16:07:18 -07:00
Dylan Herman
bacb0604fc refactor Union[None, ...] with Optional (#264) 2022-03-24 11:05:50 -07:00
Willem Melching
e137c5731e Less open file permissions (#187) 2021-08-28 18:20:54 -07:00
Dean Lee
b366ea46a7 SubMaster: set traversalLimitInWords to max (#188)
* set traversalLimitInWords to max

* NO_TRAVERSAL_LIMIT

space

* log_from_bytes
2021-08-17 16:47:26 +02:00
ShaneSmiskol
127edd520f Unbridge - for republishing msgs sent from your laptop to openpilot (#160)
* duplicate bridge

* unbridge!

* some fixes

* combine bridge

* one if

* rm unbridge

* add --unbridge arg

* ip and unbridge arg parsing. segfaults if not given any ip value

* this is better than a python cli interface for now

* where did those tabs come from?

* bridge --unbridge is a little cumbersome to type...

...and only republish test messages

* more clear

* update

* only check --ip

* assume reverse if anything specified as ip

* refactor

* better ordering

* order imports

* use a whitelist

* combine into get_services
2021-06-07 18:11:25 -07:00
Adeeb Shihadeh
eb204d4a55 msgq: bump num readers to 10 2021-05-20 23:03:54 -07:00
ShaneSmiskol
284468e3cc SubMaster - allow dynamic service lists (#150) 2021-05-18 12:09:54 -07:00
Adeeb Shihadeh
3c895e7b33 construct pubmaster with vector instead of initializer list 2021-05-15 14:12:42 -07:00
Dean Lee
a6f4b6351d C++ SubMaster: make readers always valid (#139)
* refactor submaster

* cleanup
2021-05-14 22:24:40 -07:00
Willem Melching
bab2f2b95e SubMaster: Don't check alive when SIMULATION env variable is set 2021-05-05 15:25:02 +02:00
Willem Melching
9d83b15104 msgq_all_readers_updated: only return true when at least one reader is connected 2021-05-05 14:10:58 +02:00
Adeeb Shihadeh
3be0bf50c8 rename headers: hpp -> h 2021-05-03 20:40:36 -07:00
iejMac
8e5eb3ba4d SubMaster: split socket recv and update (#133)
* add update_msgs

* works, need to find a way to pair socket to message without map

* works with strings

* save changes

* fix

* style

* remove fixMaybe

* style

* void update

* removing dynamic_struct

* comments

* dont need include anymore

* map -> vector<pair>

* move to update_msgs

* uint64

* change

* refrence

* whitepsace after if
2021-04-22 21:45:26 -07:00
Shane Smiskol
c92be0564c Automatically generate service ports (#136)
* make sure specified port isn't reserved

* only sshd

* Add check to tests as well and test

* commonly define these safety check numbers in services and check in both places

* add function to generate new ports that aren't reserved

* port is guaranteed to not be a reserved port and above 8000 now

asserting the rate on runtime isn't necessary, just for testing

* create service_list dynamically

* redundant

* just add an offset equal to length of services dict

* fix test?

* only one reserved

* ignore the argument type error

* rm line

* Add back tests

* starts at 8001
2021-04-20 17:57:54 +02:00
Joost Wooning
957147cb84 some fixes and small changes for locationd in c++ (#135)
* Added getters

* extra service to ack messages in process replay

* fix allAliveAndValid ignoring ignoreValid services

* check if readers are updated

* default message valid true
2021-04-19 17:28:06 +02:00