Commit Graph

139 Commits

Author SHA1 Message Date
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
Willem Melching
c803eddb33 add list for average frequency ignore (#132)
* add list for averge frequency ignore

* not simulation

* cleanup
2021-04-08 18:04:11 +02:00
Willem Melching
5980517cc9 dont check avg freq in simulation 2021-04-08 14:07:34 +02:00
Willem Melching
dffb99383e Add check for average frequency (#128)
* add check for average frequency

* fix mypy

* more type errors

* make less strict

* only check polled services

* add flag to disable avg check
2021-04-06 10:09:07 +02:00
Willem Melching
8203d55702 AlignedBuffer remove operator() to prevent out of scope usage 2021-03-17 14:22:59 +01:00
Dean Lee
97bfe99980 Added new util class AlignedBuffer (#125)
* AlignedBuffer

* rename function aligned to get

* add overloaded function for convenience
2021-03-15 17:27:20 +01:00
Willem Melching
a9290aa1d0 msgq: fixup larger queue size for frames 2021-02-22 10:12:04 +01:00
HaraldSchafer
a034837924 Best practice (#107)
* Update README.md

* Update README.md

* Split out sensors

* no duplicate ports

* not used

* misc cleanup

* fix tests

* only catch import error

* celcius is not SI

* better temp

* update servicespy

* add explicit

* -data

* save sensors for later

* more thermal

* little more

* thermal -> deviceState

* steering

* forgot deg

* explicit ids

Co-authored-by: Willem Melching <willem.melching@gmail.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-02-16 21:09:50 -08:00
Willem Melching
2748048829 Revert "lower alive threshold to 5x"
This reverts commit 8bf83edb7a.
2021-01-29 13:02:11 +01:00
Willem Melching
95e32803cd Visionipc v2.0 (#101)
* add visionbuf

make static

ignore that

* Needs decleration

* add test binary

* c++

* create some structure

* some impl

* socket stuff

* Accept socket connection

* Alloc some buffers

* Create pub sockets and send buffer id

* make listener private

* Implement receive

* use error check macros in cl_helpers

* constructors to pass in opencl context

* add some convenience values in struct

* refactor creating buffers

* rgb is not so simple

* add fake stride and expose buffers

* add comment

* add extra data struct

* support conflate

* init opencl on all buffers

* make ion compile

* fix qcom2

* correctly setup yuv pointers when importing buffer

* also included from c

* Remove send print statements

* send metadata

* reveive metadata

* also used in c code

* dont start listener automatically

* Was started in 2 places

* set 100ms timeout on socket

* verify server id to detect reconnects

* handle reconnect

* buffer cleanup

* let user handle opencl creation

* add default values

* Add support for aligned rgb buffers

* add align macro

* dont use namespace

* use poller

* apple ifdef in ipc.cc

* VisionBuf is C++ class

* Install opencl headers

* cppcheck c++

* remove c header guard

* fix mac build

* simplify constructors

* Update visionipc/visionipc.h

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

* Update visionipc/visionbuf_ion.cc

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

* add brackets

* s/VIPCBufExtra/VisionIpcBufExtra/g

* Add unittesting harness

* remove vipc demo

* very basic tests

* add conflate test

* Install opencl

* suppress msgq warnings

* Make it work using zmq

* cl in qcom replay

* run unittests in zmq mode as well

* non blocking connect

* always larger frame queues

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-01-08 14:54:41 +01:00
Adeeb Shihadeh
484edb6cab remove azure build status from msgq doc 2021-01-06 15:21:16 -08:00