mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 18:53:55 +08:00
Move camerad to system/ (#24836)
* mv camerad
* add hardware symlink
* fix unit tests
old-commit-hash: 6123ab3d1c
This commit is contained in:
2
.github/workflows/selfdrive_tests.yaml
vendored
2
.github/workflows/selfdrive_tests.yaml
vendored
@@ -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
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
|
||||
|
||||
Reference in New Issue
Block a user