Move camerad to system/ (#24836)

* mv camerad

* add hardware symlink

* fix unit tests
old-commit-hash: 6123ab3d1c
taco
Adeeb Shihadeh 3 years ago committed by GitHub
parent 61e4dc0552
commit d9d83b0225
  1. 2
      .github/workflows/selfdrive_tests.yaml
  2. 4
      Jenkinsfile
  3. 4
      SConstruct
  4. 6
      docs/c_docs.rst
  5. 31
      release/files_common
  6. 6
      release/files_tici
  7. 2
      selfdrive/athena/athenad.py
  8. 2
      selfdrive/loggerd/encoder/encoder.h
  9. 2
      selfdrive/loggerd/loggerd.h
  10. 4
      selfdrive/manager/process_config.py
  11. 4
      selfdrive/test/process_replay/test_debayer.py
  12. 2
      selfdrive/ui/qt/widgets/cameraview.h
  13. 2
      selfdrive/ui/replay/logreader.h
  14. 0
      system/camerad/SConscript
  15. 0
      system/camerad/__init__.py
  16. 8
      system/camerad/cameras/camera_common.cc
  17. 2
      system/camerad/cameras/camera_common.h
  18. 4
      system/camerad/cameras/camera_qcom2.cc
  19. 2
      system/camerad/cameras/camera_qcom2.h
  20. 0
      system/camerad/cameras/real_debayer.cl
  21. 0
      system/camerad/cameras/sensor2_i2c.h
  22. 0
      system/camerad/imgproc/conv.cl
  23. 0
      system/camerad/imgproc/pool.cl
  24. 2
      system/camerad/imgproc/utils.cc
  25. 0
      system/camerad/imgproc/utils.h
  26. 0
      system/camerad/include/media/cam_cpas.h
  27. 0
      system/camerad/include/media/cam_defs.h
  28. 0
      system/camerad/include/media/cam_fd.h
  29. 0
      system/camerad/include/media/cam_icp.h
  30. 0
      system/camerad/include/media/cam_isp.h
  31. 0
      system/camerad/include/media/cam_isp_ife.h
  32. 0
      system/camerad/include/media/cam_isp_vfe.h
  33. 0
      system/camerad/include/media/cam_jpeg.h
  34. 0
      system/camerad/include/media/cam_lrme.h
  35. 0
      system/camerad/include/media/cam_req_mgr.h
  36. 0
      system/camerad/include/media/cam_sensor.h
  37. 0
      system/camerad/include/media/cam_sensor_cmn_header.h
  38. 0
      system/camerad/include/media/cam_sync.h
  39. 0
      system/camerad/include/msm_cam_sensor.h
  40. 0
      system/camerad/include/msm_camsensor_sdk.h
  41. 0
      system/camerad/include/msmb_camera.h
  42. 0
      system/camerad/include/msmb_isp.h
  43. 0
      system/camerad/include/msmb_ispif.h
  44. 2
      system/camerad/main.cc
  45. 0
      system/camerad/snapshot/__init__.py
  46. 2
      system/camerad/snapshot/snapshot.py
  47. 0
      system/camerad/test/.gitignore
  48. 2
      system/camerad/test/ae_gray_test.cc
  49. 0
      system/camerad/test/ae_gray_test.h
  50. 0
      system/camerad/test/camera_test.h
  51. 0
      system/camerad/test/check_skips.py
  52. 0
      system/camerad/test/frame_test.py
  53. 0
      system/camerad/test/get_thumbnails_for_segment.py
  54. 0
      system/camerad/test/stress_restart.sh
  55. 0
      system/camerad/test/test_camerad.py
  56. 2
      system/camerad/test/test_exposure.py
  57. 2
      system/camerad/transforms/rgb_to_yuv.cc
  58. 0
      system/camerad/transforms/rgb_to_yuv.cl
  59. 0
      system/camerad/transforms/rgb_to_yuv.h
  60. 2
      system/camerad/transforms/rgb_to_yuv_test.cc
  61. 4
      tools/webcam/README.md

@ -310,7 +310,7 @@ jobs:
./selfdrive/loggerd/tests/test_logger &&\
./system/proclogd/tests/test_proclog && \
./selfdrive/ui/replay/tests/test_replay && \
./selfdrive/camerad/test/ae_gray_test && \
./system/camerad/test/ae_gray_test && \
coverage xml"
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v2

4
Jenkinsfile vendored

@ -139,8 +139,8 @@ pipeline {
steps {
phone_steps("tici-party", [
["build", "cd selfdrive/manager && ./build.py"],
["test camerad", "python selfdrive/camerad/test/test_camerad.py"],
["test exposure", "python selfdrive/camerad/test/test_exposure.py"],
["test camerad", "python system/camerad/test/test_camerad.py"],
["test exposure", "python system/camerad/test/test_exposure.py"],
])
}
}

@ -94,7 +94,7 @@ if arch == "larch64":
"/usr/lib/aarch64-linux-gnu"
]
cpppath += [
"#selfdrive/camerad/include",
"#system/camerad/include",
]
cflags = ["-DQCOM2", "-mcpu=cortex-a57"]
cxxflags = ["-DQCOM2", "-mcpu=cortex-a57"]
@ -379,6 +379,7 @@ SConscript(['rednose/SConscript'])
# Build system services
SConscript([
'system/camerad/SConscript',
'system/clocksd/SConscript',
'system/proclogd/SConscript',
])
@ -396,7 +397,6 @@ SConscript(['third_party/SConscript'])
SConscript(['common/kalman/SConscript'])
SConscript(['common/transformations/SConscript'])
SConscript(['selfdrive/camerad/SConscript'])
SConscript(['selfdrive/modeld/SConscript'])
SConscript(['selfdrive/controls/lib/cluster/SConscript'])

@ -28,11 +28,11 @@ selfdrive
camerad
^^^^^^^
.. autodoxygenindex::
:project: selfdrive_camerad_cameras
:project: system_camerad_cameras
.. autodoxygenindex::
:project: selfdrive_camerad_transforms
:project: system_camerad_transforms
.. autodoxygenindex::
:project: selfdrive_camerad_imgproc
:project: system_camerad_imgproc
locationd
^^^^^^^^^

@ -182,6 +182,7 @@ selfdrive/controls/lib/longitudinal_mpc_lib/.gitignore
selfdrive/controls/lib/lateral_mpc_lib/*
selfdrive/controls/lib/longitudinal_mpc_lib/*
selfdrive/hardware
system/hardware/__init__.py
system/hardware/base.h
system/hardware/base.py
@ -298,24 +299,24 @@ selfdrive/ui/replay/*.h
selfdrive/ui/qt/maps/*.cc
selfdrive/ui/qt/maps/*.h
selfdrive/camerad/SConscript
selfdrive/camerad/main.cc
system/camerad/SConscript
system/camerad/main.cc
selfdrive/camerad/snapshot/*
selfdrive/camerad/include/*
selfdrive/camerad/cameras/camera_common.h
selfdrive/camerad/cameras/camera_common.cc
selfdrive/camerad/cameras/sensor2_i2c.h
system/camerad/snapshot/*
system/camerad/include/*
system/camerad/cameras/camera_common.h
system/camerad/cameras/camera_common.cc
system/camerad/cameras/sensor2_i2c.h
selfdrive/camerad/transforms/rgb_to_yuv.cc
selfdrive/camerad/transforms/rgb_to_yuv.h
selfdrive/camerad/transforms/rgb_to_yuv.cl
selfdrive/camerad/transforms/rgb_to_yuv_test.cc
system/camerad/transforms/rgb_to_yuv.cc
system/camerad/transforms/rgb_to_yuv.h
system/camerad/transforms/rgb_to_yuv.cl
system/camerad/transforms/rgb_to_yuv_test.cc
selfdrive/camerad/imgproc/conv.cl
selfdrive/camerad/imgproc/pool.cl
selfdrive/camerad/imgproc/utils.cc
selfdrive/camerad/imgproc/utils.h
system/camerad/imgproc/conv.cl
system/camerad/imgproc/pool.cl
system/camerad/imgproc/utils.cc
system/camerad/imgproc/utils.h
selfdrive/manager/__init__.py
selfdrive/manager/build.py

@ -7,9 +7,9 @@ system/timezoned.py
selfdrive/assets/navigation/*
selfdrive/assets/training_wide/*
selfdrive/camerad/cameras/camera_qcom2.cc
selfdrive/camerad/cameras/camera_qcom2.h
selfdrive/camerad/cameras/real_debayer.cl
system/camerad/cameras/camera_qcom2.cc
system/camerad/cameras/camera_qcom2.h
system/camerad/cameras/real_debayer.cl
selfdrive/ui/qt/spinner_larch64
selfdrive/ui/qt/text_larch64

@ -493,7 +493,7 @@ def getNetworks():
@dispatcher.add_method
def takeSnapshot():
from selfdrive.camerad.snapshot.snapshot import jpeg_write, snapshot
from system.camerad.snapshot.snapshot import jpeg_write, snapshot
ret = snapshot()
if ret is not None:
def b64jpeg(x):

@ -8,7 +8,7 @@
#include "cereal/visionipc/visionipc.h"
#include "common/queue.h"
#include "selfdrive/loggerd/video_writer.h"
#include "selfdrive/camerad/cameras/camera_common.h"
#include "system/camerad/cameras/camera_common.h"
#define V4L2_BUF_FLAG_KEYFRAME 8

@ -15,7 +15,7 @@
#include "cereal/services.h"
#include "cereal/visionipc/visionipc.h"
#include "cereal/visionipc/visionipc_client.h"
#include "selfdrive/camerad/cameras/camera_common.h"
#include "system/camerad/cameras/camera_common.h"
#include "common/params.h"
#include "common/swaglog.h"
#include "common/timing.h"

@ -18,6 +18,8 @@ def logging(started, params, CP: car.CarParams) -> bool:
return started and run
procs = [
# due to qualcomm kernel bugs SIGKILLing camerad sometimes causes page table corruption
NativeProcess("camerad", "system/camerad", ["./camerad"], unkillable=True, callback=driverview),
NativeProcess("clocksd", "system/clocksd", ["./clocksd"]),
NativeProcess("logcatd", "system/logcatd", ["./logcatd"]),
NativeProcess("proclogd", "system/proclogd", ["./proclogd"]),
@ -25,8 +27,6 @@ procs = [
PythonProcess("timezoned", "system.timezoned", enabled=not PC, offroad=True),
DaemonProcess("manage_athenad", "selfdrive.athena.manage_athenad", "AthenadPid"),
# due to qualcomm kernel bugs SIGKILLing camerad sometimes causes page table corruption
NativeProcess("camerad", "selfdrive/camerad", ["./camerad"], unkillable=True, callback=driverview),
NativeProcess("dmonitoringmodeld", "selfdrive/modeld", ["./dmonitoringmodeld"], enabled=(not PC or WEBCAM), callback=driverview),
NativeProcess("encoderd", "selfdrive/loggerd", ["./encoderd"]),
NativeProcess("loggerd", "selfdrive/loggerd", ["./loggerd"], onroad=False, callback=logging),

@ -10,7 +10,7 @@ from system.hardware import PC, TICI
from common.basedir import BASEDIR
from selfdrive.test.openpilotci import BASE_URL, get_url
from system.version import get_commit
from selfdrive.camerad.snapshot.snapshot import yuv_to_rgb
from system.camerad.snapshot.snapshot import yuv_to_rgb
from tools.lib.logreader import LogReader
from tools.lib.filereader import FileReader
@ -62,7 +62,7 @@ def unbzip_frames(url):
def init_kernels(frame_offset=0):
ctx = cl.create_some_context(interactive=False)
with open(os.path.join(BASEDIR, 'selfdrive/camerad/cameras/real_debayer.cl')) as f:
with open(os.path.join(BASEDIR, 'system/camerad/cameras/real_debayer.cl')) as f:
build_args = ' -cl-fast-relaxed-math -cl-denorms-are-zero -cl-single-precision-constant' + \
f' -DFRAME_STRIDE={FRAME_STRIDE} -DRGB_WIDTH={FRAME_WIDTH} -DRGB_HEIGHT={FRAME_HEIGHT} -DFRAME_OFFSET={frame_offset} -DCAM_NUM=0'
if PC:

@ -17,7 +17,7 @@
#endif
#include "cereal/visionipc/visionipc_client.h"
#include "selfdrive/camerad/cameras/camera_common.h"
#include "system/camerad/cameras/camera_common.h"
#include "selfdrive/ui/ui.h"
const int FRAME_BUFFER_SIZE = 5;

@ -6,7 +6,7 @@
#endif
#include "cereal/gen/cpp/log.capnp.h"
#include "selfdrive/camerad/cameras/camera_common.h"
#include "system/camerad/cameras/camera_common.h"
#include "selfdrive/ui/replay/filereader.h"
const CameraType ALL_CAMERAS[] = {RoadCam, DriverCam, WideRoadCam};

@ -1,4 +1,4 @@
#include "selfdrive/camerad/cameras/camera_common.h"
#include "system/camerad/cameras/camera_common.h"
#include <unistd.h>
@ -10,7 +10,7 @@
#include "libyuv.h"
#include <jpeglib.h>
#include "selfdrive/camerad/imgproc/utils.h"
#include "system/camerad/imgproc/utils.h"
#include "common/clutil.h"
#include "common/modeldata.h"
#include "common/swaglog.h"
@ -20,9 +20,9 @@
#ifdef QCOM2
#include "CL/cl_ext_qcom.h"
#include "selfdrive/camerad/cameras/camera_qcom2.h"
#include "system/camerad/cameras/camera_qcom2.h"
#else
#include "selfdrive/camerad/test/camera_test.h"
#include "system/camerad/test/camera_test.h"
#endif
ExitHandler do_exit;

@ -9,7 +9,7 @@
#include "cereal/visionipc/visionbuf.h"
#include "cereal/visionipc/visionipc.h"
#include "cereal/visionipc/visionipc_server.h"
#include "selfdrive/camerad/transforms/rgb_to_yuv.h"
#include "system/camerad/transforms/rgb_to_yuv.h"
#include "common/mat.h"
#include "common/queue.h"
#include "common/swaglog.h"

@ -1,4 +1,4 @@
#include "selfdrive/camerad/cameras/camera_qcom2.h"
#include "system/camerad/cameras/camera_qcom2.h"
#include <fcntl.h>
#include <poll.h>
@ -20,7 +20,7 @@
#include "media/cam_sensor_cmn_header.h"
#include "media/cam_sync.h"
#include "common/swaglog.h"
#include "selfdrive/camerad/cameras/sensor2_i2c.h"
#include "system/camerad/cameras/sensor2_i2c.h"
// For debugging:
// echo "4294967295" > /sys/module/cam_debug_util/parameters/debug_mdl

@ -6,7 +6,7 @@
#include <media/cam_req_mgr.h>
#include "selfdrive/camerad/cameras/camera_common.h"
#include "system/camerad/cameras/camera_common.h"
#include "common/util.h"
#define FRAME_BUF_COUNT 4

@ -1,4 +1,4 @@
#include "selfdrive/camerad/imgproc/utils.h"
#include "system/camerad/imgproc/utils.h"
#include <algorithm>
#include <cassert>

@ -1,4 +1,4 @@
#include "selfdrive/camerad/cameras/camera_common.h"
#include "system/camerad/cameras/camera_common.h"
#include <cassert>

@ -13,7 +13,7 @@ from system.hardware import PC
from selfdrive.controls.lib.alertmanager import set_offroad_alert
from selfdrive.manager.process_config import managed_processes
LM_THRESH = 120 # defined in selfdrive/camerad/imgproc/utils.h
LM_THRESH = 120 # defined in system/camerad/imgproc/utils.h
VISION_STREAMS = {
"roadCameraState": VisionStreamType.VISION_STREAM_ROAD,

@ -8,7 +8,7 @@
#include <cstring>
#include "common/util.h"
#include "selfdrive/camerad/cameras/camera_common.h"
#include "system/camerad/cameras/camera_common.h"
int main() {
// set up fake camerabuf

@ -4,7 +4,7 @@ import unittest
import numpy as np
from selfdrive.test.helpers import with_processes
from selfdrive.camerad.snapshot.snapshot import get_snapshots
from system.camerad.snapshot.snapshot import get_snapshots
from system.hardware import TICI

@ -1,4 +1,4 @@
#include "selfdrive/camerad/transforms/rgb_to_yuv.h"
#include "system/camerad/transforms/rgb_to_yuv.h"
#include <cassert>
#include <cstdio>

@ -30,7 +30,7 @@
#include <CL/cl.h>
#include "libyuv.h"
#include "selfdrive/camerad/transforms/rgb_to_yuv.h"
#include "system/camerad/transforms/rgb_to_yuv.h"
#include "common/clutil.h"
static inline double millis_since_boot() {

@ -23,14 +23,14 @@ git clone https://github.com/commaai/openpilot.git
```
cd ~/openpilot
```
- check out selfdrive/camerad/cameras/camera_webcam.cc lines 72 and 146 before building if any camera is upside down
- check out system/camerad/cameras/camera_webcam.cc lines 72 and 146 before building if any camera is upside down
```
USE_WEBCAM=1 scons -j$(nproc)
```
## Connect the hardware
- Connect the road facing camera first, then the driver facing camera
- (default indexes are 1 and 2; can be modified in selfdrive/camerad/cameras/camera_webcam.cc)
- (default indexes are 1 and 2; can be modified in system/camerad/cameras/camera_webcam.cc)
- Connect your computer to panda
## GO

Loading…
Cancel
Save