Commit Graph

297 Commits (master)

Author SHA1 Message Date
Dean Lee 3d63b3d414
covert rgb_to_yuv.c to rgb_to_yuv.cc (#2757) 2020-12-12 16:52:15 -08:00
Dean Lee 3c08d0f1f7
clutil refactor (#2733)
* cleaup clutil.h

* clutil.c -> clutil.cc

* std::hash

* try simplify functions

* using namespace group help functions

* continue

* add function get_platform_info

* continue

* remove caching

* struct CLContext

* std::cout & CL_ERR_TO_STR

* remove CLU_NO_CACHE

* Revert "struct CLContext"

This reverts commit 882e413f22.

* cl_get_error_string : remove undefied error codes

* replace all printf with std::cout

* util::read_file

* cleanup

* revert CL_ERR_TO_STR

* simplify

* add macro CL_ERR_TO_STR

* cl_get_error_string: fix undeclared errors

* log_size should not +1

* use std::stirng log

* apply review
2020-12-11 13:05:32 +01:00
Willem Melching 7b998a7c21 Add thumbnails to camera_frame_stream 2020-12-11 13:02:45 +01:00
Dean Lee f0d240a7e3
camerad: fix memory leak in create_thumbnail (#2743)
* fix memory leak in create_thumbnail

* free memory returned from jpeg_mem_dest

* OMG
2020-12-11 13:02:16 +01:00
Dean Lee 1e9e31d6e1
destroy rgb_to_yuv_state (#2702) 2020-12-10 19:39:46 -08:00
komma zwei fef8d4093f rhd dm AE sign flip 2020-12-10 19:27:45 -08:00
Comma Device 0e84e04539 make qcom2 robust to moving v4l-subdevs 2020-12-10 05:44:59 +00:00
Adeeb Shihadeh 90d7331312 fix camerad exiting on pc 2020-12-08 20:20:42 -08:00
Dean Lee 24a84b2aff
simplify common_camera_process_front (#2470)
* refactor camera_process_front

* improve
2020-12-03 16:28:32 -08:00
ZwX1616 d3387d540a
tici timing improvements (#2613)
* relocate

* impatience

* should be fine without

Co-authored-by: Comma Device <device@comma.ai>
2020-12-02 16:18:31 -08:00
Dean Lee bd4f6650fa
simplify building capnp messages with arrays (#2617) 2020-11-30 12:08:52 +01:00
Dean Lee 42183d913f
Error checking macros for opencl (#2615)
* macro CL_CHECK&CL_CHECK_ERR

* trigger checks
2020-11-30 12:04:49 +01:00
ZwX1616 f244b7c7e1
tici front/wide encodeIdx msgs (#2564)
* different msgs

* also add timestamps

* keep impatient log, remove the other

* meaningless
2020-11-19 16:12:02 -08:00
Comma Device b9b6ed2d52 underflew 2020-11-19 04:03:16 +00:00
ZwX1616 c630cd44da
send frame in packet on demand (#2567)
* focus lens helper2

* fix

* yes screen

* s

* new/del

* once

* cleanup

Co-authored-by: Comma Device <device@comma.ai>
2020-11-18 13:39:50 -08:00
George Hotz 2f3e42169c
was wasting a ton of GPU on this debayer (#2566)
Co-authored-by: Comma Device <device@comma.ai>
2020-11-17 16:52:06 -08:00
ZwX1616 4954db0381
use different SubMasters for driverState/sensorEvents (#2522)
* use different sms

* rename
2020-11-11 13:53:11 -08:00
Christo Mitov 029be49012
switch build flags to use opengl framework rather than gl library for OSX (#2467)
* switch build flags to use opengl framework rather than library for OSX

* little cleaner

* arch

Co-authored-by: thatsaboi <thatsa@boi.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2020-11-03 19:54:29 -08:00
George Hotz 4d5efb5789
Focus Actuator Comments (#2478)
* comments from DW9800W datasheet

* more comments
2020-11-03 07:45:16 -08:00
Dean Lee c21ccccd61
webcam cleanup: remove unused variables (#2450) 2020-10-29 20:30:46 -07:00
ZwX1616 b5617c17c8
just use the same (#2419) 2020-10-28 17:43:16 -07:00
ZwX1616 d7052094c4
restore behavior (#2418) 2020-10-26 14:49:28 -07:00
ZwX1616 efa9180258
camerad AE hotfix (#2371)
* duplicate offset

* use widthx3 instead of stride
2020-10-20 17:26:05 -07:00
Adeeb Shihadeh 4c4b53beda
prevent snapshot while onroad (#2366)
* prevent snapshot while onroad

* fix offroad check
2020-10-20 14:04:18 -07:00
Willem Melching 339d1967cb
--std=c++17 (#2330)
* switch to c++17

* more 17

* 1z

* use std::clamp

* Fix types in clamp

* bump submodules

* bump laika

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2020-10-17 13:33:12 -07:00
ZwX1616 6b020241c9
Clean up and test camerad refactor (#2310)
* refactor

add function get_camerabuf_by_type

remove cl_free

use camera_id

move front stuff into frontview_thread

bigger refactor

more

typo

rename camerabuf *c to *b

cleanup header files

remove wideview_thread

camera_qcom.c to c++

fix SConscript

camera_process_buf

space

sendrgb same with before

do autoexposure in processing_thread

correct sendrgb

add camera_common.cc

move yuv_transform to CameraBuf

* use C to keep consitent

* rebase master

* rebase master

* continue refactor

* refactor all camera related data&function out of main

 done

* cleanup

* -use buf.rgb_width&height

* remoe ,

* rebase master

* remove unused std::vector

* add func common_camera_process_front

* fix max

* fix sendrgb

* less crap being logged

* fix indents

* add back thumbnails

* thumbnail fixed on tici

* junk junk junk

* unify api

* fix ptr ref

* lol!

* cleanup

* more simplified

* typos

* remove terminate

* use standard polling

* ops_thread refactor, too much code!

* fix build

* ok

* assert

* listen

* incl more

* wq!

* fix more build

* macos

* fix exp targets

* front is different

* const

* bye

* remath

* remove irrelevant

* do ops in a thread

* fix init

* return null

* QCOM2 ops

* qcom2 build

* missing comma

Co-authored-by: deanlee <deanlee3@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
2020-10-16 21:58:05 -07:00
Adeeb Shihadeh f4e18e0b74
Build openpilot with webcam support in CI (#2070) 2020-10-16 15:16:17 -07:00
Willem Melching 2e182e5c57
Params refactor, simplified (#2300)
* always c++

* Create C++ params class

* get works

* tests hang now

* passes tests

* cleanup string formatting

* handle interrupt in blocking read

* fix memory leak

* remove unused constructor

* Use delete_db_value directly

* Rename put -> write_db_value

* filename cleanup

* no semicolons in cython

* Update common/SConscript

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

* add std::string version of delete_db_value

* This is handled

* cleanup encoding

* Add clear method to clear all

* add persistent params

* fix android build

* Should be called clear_all

* only import params when needed

* set params path on manager import

* recusrively create directories

* Fix function order

* cleanup mkdirp

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
2020-10-13 16:23:23 +02:00
Dean Lee 8fc9cfea38
fix webcam build error (#2320) 2020-10-11 22:45:19 -07:00
ZwX1616 cb58e79ee8
Test camerad in CI (#2297)
* remove unused junk

* check frame pkts

* from magic

* self

* cleanup

* add todo

* no opencv

* run in J

* fix conv

* make 250x faster

* abs

* should be +1

* depends on starting phase

* block on furniture refactor

* fixed

* restart test

* check ex

* need scaling
2020-10-09 16:31:25 -07:00
ZwX1616 00b642146f
tici camera art II (#2223)
* protect highlights

* fix modeld scale factor

* rewrite logic for accurate and smooth AE

* fix condition

* tune speed

* move to qcom2

* not exactly 2x

* avoid hunting due to ettr policy

* tune to new curve

* gain kickdowns

* log params

* 4x legroom

* no limit needed here

* simple lowpass

* tweak

* pin to a remote core

* speedup AE and lower night exp

* this curve makes more sense

* tuning from fleet data

* fix ui

* only qcom2

Co-authored-by: Comma Device <device@comma.ai>
2020-10-09 16:26:43 -07:00
ZwX1616 84e83e88a3
Fix dcamera inaccurate fps on OP3T and LP3 (#2305)
* fix op3t pclk

* fix leeco fps
2020-10-09 11:26:32 -07:00
ZwX1616 2b974150c4
Refactor loggerd rotations (#2247)
* loggerd:refactor rotate encoder

* change notify_all to notify_one

* finish

* cancelWait

* start front_encoder_thread on need

* rebase master to resolve conflict

* tici qcam works, but

* ifs are ugly

* synced rotate off frame ids

* only start counting frames after modeld alive

* typo

* fix some bugs

* never over rotate

* works

* missing space

* zero frame count tolerance

* lol

* add back omx race protection

* not need that

* not to confuse different locks

* playing with locks is playing with fire

* tici now has qcam

* size is overrated

* make cppcheck happy

* fall back if no camera

* warn

* missing condition

* first is freestyle

* no stream id before connecting

* wait for increment

* first will be imperfect

* wait is futile

* block frames when writing state

* just log write time

* exit loops when exit

* tici qcamera

* fixed

* add atomics

* incl

Co-authored-by: deanlee <deanlee3@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
2020-10-03 07:56:16 -07:00
Comma Device b94b435387 qcom2 needs cc conversion (#2125) 2020-09-24 22:52:35 +00:00
Dean Lee 9f34d1ff66
camerad: close file descriptors (#2065)
* close file descriptors

* fix struct indent

* add some new lines
2020-09-24 13:39:27 -07:00
ZwX1616 911206fc41
tici camera art (#2188)
* nerf highlights

* prioritize less noise

* no overhead

* make focus easier

* cant finetune under high gain

* add some comments

* inspired by xx mindset

Co-authored-by: Comma Device <device@comma.ai>
2020-09-18 11:43:41 -07:00
Adeeb Shihadeh 92922ce2ae these should be debug logs 2020-09-17 13:14:18 -07:00
Adeeb Shihadeh ef21b83937
Improve realtime performance on NEOS (#2166)
* fix setting core affinity

* dmonitoringd doesn't need rt priority

* android only gets two cores

* model and planner get core 2

* log missed cycle count

* neos update

* prod image

* revert NEOS changes

* still need this
2020-09-16 15:33:12 -07:00
Adeeb Shihadeh 0604f194b3 bump max vision clients for tici 2020-09-14 21:29:46 -07:00
Comma Device c9183c11bd fix tbuffer img tearing 2020-09-15 03:32:29 +00:00
ZwX1616 13588e4255
improve tici camerad robustness (#2135)
* equalize performance on three threads

* need to request first

* clean up indexing

* obsolete

* handling skips and drops

* clean up repeated chunks

* use main frame id

* oneshot

* real skip check

* move to test

* should be cropped H here

Co-authored-by: Comma Device <device@comma.ai>
2020-09-14 16:05:57 -07:00
Adeeb Shihadeh 4d5733924a
message builder (#2161)
* use custom MessageBuilder from cereal

* use MesageBuilder.toBytes

* bump cereal

* unused

* another one

* fix ui msg

Co-authored-by: deanlee <deanlee3@gmail.com>
2020-09-12 21:48:15 -07:00
Comma Device 18884743a6 remove recurrent LOGD and prints 2020-09-01 20:15:39 +00:00
Comma Device 80838f3693 use buffered meta 2020-09-01 18:55:15 +00:00
Adeeb Shihadeh 63436373d2
Remove opencv from phonelibs (#2107)
* remove opencv from phonelibs

* clean that up too
2020-08-30 18:23:23 -07:00
Adeeb Shihadeh 349040d958
driver monitoring cleanup (#2101)
* read rhd from param

* don't need that anymore

* fix build

* bump cereal

* read param from camerad too

* add read_db_bool helper

* bump model replay ref commit, IsRHD wasn't set
2020-08-29 17:16:00 -07:00
Willem Melching 658e9d8316 open by path instead of number 2020-08-27 09:44:52 +00:00
robbederks 37d6472bfa
Tici camerad (#2048)
* fix camera config

* typos

* oops

* more typo

* lambless

* forget to send

* visualize hist

* more typo

* 0xC000

* simple

* data loss prevention, clean up later

* loggerd

* back up code

* backup

* fixed memory leak

* fix vsync

* upload ecam

* WB

* 3stream

* fix OMX crash on loggerd rotation

* rewritten debayer kernel

* update viewer

* improved AE

* no artifact lines/grids

* standard trigger

* cleanups

* CCM

* cleanups

* slight tweak

* upd push sock

* build all these

* update tele fl

* update cereal

* upd viewer

* DualCameraState -> MultiCameraState

* cameras_open

* disable frame zmq push by default

* more cleanup

* no apks

* fix submodule error

* wat

* clean up trash

* remove junk

* only build on qcom2

* no need to check these

* update cereal

* some more minor cleanup

* bump panda

* add todo

* minor typo

* Revert "minor typo"

This reverts commit 9233a1df7c.

* not care

* use consistent hdr

* some cleanup

* Update selfdrive/camerad/main.cc

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

* more cleanups

* remove irrelevant stuff

* this too

* cleanup

* rerun ci

Co-authored-by: ZwX1616 <zwx1616@gmail.com>
Co-authored-by: Tici <robbe@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2020-08-26 19:59:56 -07:00
Dean Lee d158837617
add function cl_get_device_id (#1948)
* add func cl_get_device_id

cleanup

* add fix from review
2020-08-17 11:24:39 +02:00
Adeeb Shihadeh 862259a94b
exit camerad cleanly on PC (#2035) 2020-08-16 16:11:09 -07:00
Adeeb Shihadeh 8e63f06540
Alert when updated consistently fails (#2013)
* alert when update fails more than 10 times

* bring over offroad alert refactor from other branch

* and we have tests

* use it in snapshot

* bump apk

* don't show exceptions on release branches

* only write when changed

* why does delete use so much cpu

* clean that up

* little more
2020-08-11 16:23:57 -07:00
Dean Lee f3fb406eee
camerad: protect concurrent access to shared variables and avoid race conditions (#1966)
* Protect concurrent access for shared resources

* fix
2020-08-11 11:40:11 -07:00
Dean Lee 55ece6991e
camerad: close ops_sock in camera_close (#1998) 2020-08-08 15:55:09 -07:00
Dean Lee fb41b984b0
release opencl objects (#1978) 2020-08-06 15:44:26 -07:00
Dean Lee c1e7b761a9
camerad: cache rgb_roi_buf&conv_result (#1979)
lgtm
2020-08-05 13:39:03 -07:00
Willem Melching 405d94ec6d qcom2 build fixes 2020-07-27 16:13:25 +00:00
Adeeb Shihadeh eb1aa3d831
Wunused (#1841)
* enable Wunused, first pass

* unused stuff in snpe model

* these are used on phone

* handle sigint and sigterm in modeld

* fix phone build

* camera qcom

* QCOM build works

* delete unused camerad vars

Co-authored-by: Comma Device <device@comma.ai>
2020-07-09 09:25:32 -07:00
ZwX1616 1036c68251
Reduce C2 dcamera noise at night (#1798) 2020-06-30 19:58:40 -07:00
ZwX1616 55aee68ca0
camerad: don't crash zmq if get interrupt from msgq (#1790)
* not crash zmq if get interrupt from msgq

* also filter eagain
2020-06-26 18:11:36 -07:00
ZwX1616 3aa99a01d7
recover EON/C2 AF (#1665) 2020-06-23 14:33:32 -07:00
George Hotz 344a9a3699
Fixups for Mac, and a bunch for PC (#1654)
* fix mac nui

* fix cereal

* builds on mac without warnings

* ui swap shouldn't be instant on pc

* camerad builds on mac

* modeld, and now everything, builds on mac

* ui draws pictures on mac now

* fix camerad shutdown

* support ui looping on pc

* python3 on that

* SCNu64 should be cross platform

* bump cereal and new apk

* clean up

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2020-06-11 18:21:59 -07:00
Jason Young 68531b071c
Reduce scheduler latency for realtime processes (#1638)
* WIP: reduce boardd and other lags

* Copypasta fault

* Silence spurious startup warning

Co-authored-by: Comma Device <device@comma.ai>
2020-06-05 17:09:41 -04:00
Willem Melching 63c8e8439b
Model + camerad test (#1622)
* kind of works

* move that

* hack to get camerad to reliably terminate

* not sure why SIGTERM wasn't working before

* compare bytes

* clean up some hacks

* gitignore

* fix that

* WIP

* no reboot

* comparison works

* pretty print

* fix build

* run in jenkins

* python path

* space

* raise timeout

* new eon

* skip the copy

* spinner

* spin less

* update model ref commit

* reenable that

* clean up

* fix jenkinsfile

* parallel

* wrap it in a stage

* fix linter

* better progress

* lower timeout

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2020-06-04 18:57:25 -07:00
Adeeb ab83e48ec4
Add pre-commit hooks (#1629) 2020-06-03 12:54:49 -07:00
Adeeb Shihadeh efd5dffb1e enable flake8 E231: missing whitespace after comma 2020-05-31 12:49:11 -07:00
Adeeb 6051061ff8
Flake8 E22X (#1607)
* e221

* e225

* bump opendbc
2020-05-31 00:48:47 -07:00
Adeeb d9bf9f0a40
Enable more flake8 checks (#1602)
* enable some more flake8 checks

* some more quick ones

* bump opendbc

* e401

* e711 e712

* e115 e116

* e222

* e301

* remove that

* e129

* e701 e702

* e125 e131

* e227

* e306

* e262

* W503

* e713

* e704

* e731

* bump opendbc

* fix some e722
2020-05-30 20:14:58 -07:00
Willem Melching ba2ac1207a
Running pre-commit in CI (#1590)
* Running pre-commit in CI

* fix dockerfile syntax

* dont run on submodule repo folders

* Fix some import errors in ci

* more stuff

* That should be the last one
2020-05-28 15:40:48 -07:00
Willem Melching 29aaa44740
flake8 in pre-commit(#1583) 2020-05-27 20:33:05 -07:00
Willem Melching ab5af232b2
Use C++ version of SubMaster and PubMaster (#1548)
* add PubMaster & SubMaster

remove 'delete msg'

remove headers

* use constructor to initial all submster

* modify drain sockets

* fix typo in ssconscript.remove lines

no checkValid in loggerd

last modify

handle_message:event->&event

fix type

remove heads

event to auto

* new interface

* api changed

* Revert "use constructor to initial all submster"

This reverts commit 73be7ea46250a325ce41d3a0445e34395a2ae692.

* change to new api

* revert loggerd

* dd

* use new PubSub api

* update to new interface

don't modify loggerd

reset panda

reset opendbc

remove empty lines

* switch to new pubMaster

* update to the new inteface

change

remove error code

. to ->

merge paramsd.cc

update panda

fix typo

simplify

fix typo

* Fix build

* always conflate

Co-authored-by: deanlee <deanlee3@gmail.com>
2020-05-21 16:04:33 -07:00
Dean Lee b6d6f52032
camerad: move c-capnp to c++ (#1472)
* convert c-capnp to c++

change paramater type

* remove c-capnp header from commonmodel.c

* unsigned short -> uint16_t

* MSM_CAMERA_I2C_ADDR_TYPE_MAX->4
2020-05-07 20:14:30 -07:00
Adeeb Shihadeh 9670f8fb9f these don't need json 2020-05-04 23:37:07 -07:00
George Hotz d5ca841b0f Revert "Bypass alignment related copy whenever possible (#1443)"
This reverts commit b225016628.
2020-05-04 09:54:05 -07:00
ZwX1616 968e2585cc
bad AF state logging (#1365) 2020-05-02 21:40:43 -07:00
Dean Lee b225016628
Bypass alignment related copy whenever possible (#1443)
remove blank lines

add file messagehelp.h

remove blank line

simplify

after review
2020-05-01 19:21:00 -07:00
Dean Lee 25ab2521ab
fixes the error with OpenCL depreciation warnings (#1394) 2020-04-19 14:04:33 -07:00
ZwX1616 133b1a20b4
RHD support for driver monitoring (#1299) 2020-04-15 16:48:44 -07:00
George Hotz cfcf3f9368
tici: fix loggerd (#1302)
* loggerd builds

* codec

* add frame_id cams

* working

* no qcam on tici

* pthread always

Co-authored-by: Tici <robbe@comma.ai>
2020-03-31 18:25:05 -07:00
George Hotz 8db0993663
tici: add (somewhat) broken camerad support (#1300)
* capnparm

* building in progress

* scons build works

* that script fixes opencl

* start new camera code

* includes and more camera scripts

* control c works now

* no device control yet

* phy too

* just one camera for now

* fix capnparm

* hmm, the inits are needed

* more cameras

* link stop start

* doesn't work yet

* fix ion on qcom2

* start poll ish

* 4 pictures and done

* no jpeg

* it works to picture

* destroy sync obj

* both work for now

* defined QCOM2

* fix fd leak

* run modeld

* 10 bit mode

* real frame stride

* needs digital gain

* dnew

* no color correcting on new

* that snpe doesn't work

* qcom2 gate

* cleanups

* oops, fix aarch64 detector

* update cereal

* modeld works with SNPE

* fix driver monitoring model

Co-authored-by: Tici <robbe@comma.ai>
2020-03-31 16:34:55 -07:00
ZwX1616 4bcfe54efd cleanups 2020-03-27 11:44:06 -07:00
ZwX1616 a95e61edf4
add webcam to cameras (#1201) 2020-03-26 19:19:47 -07:00
Willem Melching e69e0486ff camerad zmq_poll, also recover from EAGAIN 2020-03-17 13:40:07 -07:00
Willem Melching 7cd2c4c18f Check IsTakingSnapshot is not set before starting snapshot 2020-03-17 11:42:17 -07:00
Willem Melching a4c94128c2 No logging on EINTR, and log all the errnos 2020-03-16 14:58:21 -07:00
Willem Melching 439b4625b6 Add logging to poll EINTR handling, add another catch in camerad/main.cc 2020-03-16 14:55:12 -07:00
Willem Melching 7669a783d6 Camerad add errno logging, and continue on EINTR 2020-03-16 14:40:24 -07:00
ZwX1616 0608b99cd0 rear not front 2020-03-12 16:11:38 -07:00
ZwX1616 9362b7eacf log focus state 2020-03-12 15:13:35 -07:00
Shane Smiskol 6ff881f789
initialize all messages in 1 line (#1206) 2020-03-05 17:32:52 -08:00
ZwX1616 9563f77302
revert AF for master (#1159) 2020-02-24 13:36:27 -08:00
ZwX1616 435a36cdff
AF: improve general responsiveness (#1137)
* sync control with readout; always assume worst

* faster recover
2020-02-20 13:41:28 -08:00
ZwX1616 bba7fbb490
no random factors 2020-02-17 13:52:47 -08:00
ZwX1616 57b2864370
AF only trust high confidence & high coverage 2020-02-17 12:41:20 -08:00
ZwX1616 08042ab649
fix not focusing when all readings broken (#1072) 2020-02-10 15:28:35 -08:00
ZwX1616 2b97ff70b5
Focusss (#1059) 2020-02-07 13:30:45 -08:00
ZwX1616 6322a275d6
dmonitoringd (#1016) 2020-01-30 19:12:44 -08:00
George Hotz 84560ccd55 selfdrive/camerad 2020-01-17 10:52:42 -08:00