Skip to content

Commit

Permalink
Move selfdrive/hardware/ to system/ (commaai#24725)
Browse files Browse the repository at this point in the history
* move hardware to system/

* fix mypy

fix hardware
  • Loading branch information
spektor56 committed Jul 1, 2022
1 parent 58ffc52 commit f3e5820
Show file tree
Hide file tree
Showing 110 changed files with 136 additions and 135 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/selfdrive_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ jobs:
$UNIT_TEST selfdrive/locationd && \
$UNIT_TEST selfdrive/athena && \
$UNIT_TEST selfdrive/thermald && \
$UNIT_TEST selfdrive/hardware/tici && \
$UNIT_TEST system/hardware/tici && \
$UNIT_TEST tools/lib/tests && \
./common/tests/test_util && \
./common/tests/test_swaglog && \
Expand Down
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pipeline {
["test loggerd", "python selfdrive/loggerd/tests/test_loggerd.py"],
["test encoder", "python selfdrive/loggerd/tests/test_encoder.py"],
["test logcatd", "python selfdrive/logcatd/tests/test_logcatd_android.py"],
["test updater", "python selfdrive/hardware/eon/test_neos_updater.py"],
["test updater", "python system/hardware/eon/test_neos_updater.py"],
])
}
}
Expand Down Expand Up @@ -181,7 +181,7 @@ pipeline {
steps {
phone_steps("tici2", [
["build", "cd selfdrive/manager && ./build.py"],
["test power draw", "python selfdrive/hardware/tici/test_power_draw.py"],
["test power draw", "python system/hardware/tici/test_power_draw.py"],
["test boardd loopback", "python selfdrive/boardd/tests/test_boardd_loopback.py"],
["test loggerd", "python selfdrive/loggerd/tests/test_loggerd.py"],
["test encoder", "LD_LIBRARY_PATH=/usr/local/lib python selfdrive/loggerd/tests/test_encoder.py"],
Expand Down
2 changes: 1 addition & 1 deletion common/basedir.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from pathlib import Path

from selfdrive.hardware import PC
from system.hardware import PC

BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"))

Expand Down
2 changes: 1 addition & 1 deletion common/modeldata.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <array>
#include "common/mat.h"
#include "selfdrive/hardware/hw.h"
#include "system/hardware/hw.h"

const int TRAJECTORY_SIZE = 33;
const int LAT_MPC_N = 16;
Expand Down
2 changes: 1 addition & 1 deletion common/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "common/swaglog.h"
#include "common/util.h"
#include "selfdrive/hardware/hw.h"
#include "system/hardware/hw.h"

namespace {

Expand Down
2 changes: 1 addition & 1 deletion common/realtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from setproctitle import getproctitle # pylint: disable=no-name-in-module

from common.clock import sec_since_boot # pylint: disable=no-name-in-module, import-error
from selfdrive.hardware import PC, TICI
from system.hardware import PC, TICI


# time step for each process
Expand Down
2 changes: 1 addition & 1 deletion common/swaglog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "common/util.h"
#include "common/version.h"
#include "selfdrive/hardware/hw.h"
#include "system/hardware/hw.h"

class SwaglogState : public LogState {
public:
Expand Down
2 changes: 1 addition & 1 deletion common/tests/test_swaglog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "common/swaglog.h"
#include "common/util.h"
#include "common/version.h"
#include "selfdrive/hardware/hw.h"
#include "system/hardware/hw.h"

const char *SWAGLOG_ADDR = "ipc:///tmp/logmessage";
std::string daemon_name = "testy";
Expand Down
2 changes: 1 addition & 1 deletion common/transformations/camera.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np

import common.transformations.orientation as orient
from selfdrive.hardware import TICI
from system.hardware import TICI

## -- hardcoded hardware params --
eon_f_focal_length = 910.0
Expand Down
12 changes: 6 additions & 6 deletions launch_chffrplus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ function two_init {
# Check for NEOS update
if [ $(< /VERSION) != "$REQUIRED_NEOS_VERSION" ]; then
echo "Installing NEOS update"
NEOS_PY="$DIR/selfdrive/hardware/eon/neos.py"
MANIFEST="$DIR/selfdrive/hardware/eon/neos.json"
NEOS_PY="$DIR/system/hardware/eon/neos.py"
MANIFEST="$DIR/system/hardware/eon/neos.json"
$NEOS_PY --swap-if-ready $MANIFEST
$DIR/selfdrive/hardware/eon/updater $NEOS_PY $MANIFEST
$DIR/system/hardware/eon/updater $NEOS_PY $MANIFEST
fi
}

Expand All @@ -112,12 +112,12 @@ function tici_init {

# Check if AGNOS update is required
if [ $(< /VERSION) != "$AGNOS_VERSION" ]; then
AGNOS_PY="$DIR/selfdrive/hardware/tici/agnos.py"
MANIFEST="$DIR/selfdrive/hardware/tici/agnos.json"
AGNOS_PY="$DIR/system/hardware/tici/agnos.py"
MANIFEST="$DIR/system/hardware/tici/agnos.json"
if $AGNOS_PY --verify $MANIFEST; then
sudo reboot
fi
$DIR/selfdrive/hardware/tici/updater $AGNOS_PY $MANIFEST
$DIR/system/hardware/tici/updater $AGNOS_PY $MANIFEST
fi
}

Expand Down
47 changes: 24 additions & 23 deletions release/files_common
Original file line number Diff line number Diff line change
Expand Up @@ -190,29 +190,30 @@ selfdrive/controls/lib/longitudinal_mpc_lib/.gitignore
selfdrive/controls/lib/lateral_mpc_lib/*
selfdrive/controls/lib/longitudinal_mpc_lib/*

selfdrive/hardware/__init__.py
selfdrive/hardware/base.h
selfdrive/hardware/base.py
selfdrive/hardware/hw.h
selfdrive/hardware/eon/__init__.py
selfdrive/hardware/eon/androidd.py
selfdrive/hardware/eon/shutdownd.py
selfdrive/hardware/eon/hardware.h
selfdrive/hardware/eon/hardware.py
selfdrive/hardware/eon/neos.py
selfdrive/hardware/eon/neos.json
selfdrive/hardware/eon/updater
selfdrive/hardware/tici/__init__.py
selfdrive/hardware/tici/hardware.h
selfdrive/hardware/tici/hardware.py
selfdrive/hardware/tici/pins.py
selfdrive/hardware/tici/agnos.py
selfdrive/hardware/tici/agnos.json
selfdrive/hardware/tici/amplifier.py
selfdrive/hardware/tici/updater
selfdrive/hardware/tici/iwlist.py
selfdrive/hardware/pc/__init__.py
selfdrive/hardware/pc/hardware.py
selfdrive/hardware
system/hardware/__init__.py
system/hardware/base.h
system/hardware/base.py
system/hardware/hw.h
system/hardware/eon/__init__.py
system/hardware/eon/androidd.py
system/hardware/eon/shutdownd.py
system/hardware/eon/hardware.h
system/hardware/eon/hardware.py
system/hardware/eon/neos.py
system/hardware/eon/neos.json
system/hardware/eon/updater
system/hardware/tici/__init__.py
system/hardware/tici/hardware.h
system/hardware/tici/hardware.py
system/hardware/tici/pins.py
system/hardware/tici/agnos.py
system/hardware/tici/agnos.json
system/hardware/tici/amplifier.py
system/hardware/tici/updater
system/hardware/tici/iwlist.py
system/hardware/pc/__init__.py
system/hardware/pc/hardware.py

selfdrive/locationd/__init__.py
selfdrive/locationd/.gitignore
Expand Down
2 changes: 1 addition & 1 deletion scripts/disable-powersave.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
from selfdrive.hardware import HARDWARE
from system.hardware import HARDWARE

if __name__ == "__main__":
HARDWARE.set_power_save(False)
2 changes: 1 addition & 1 deletion selfdrive/athena/athenad.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from common.file_helpers import CallbackReader
from common.params import Params
from common.realtime import sec_since_boot, set_core_affinity
from selfdrive.hardware import HARDWARE, PC, TICI
from system.hardware import HARDWARE, PC, TICI
from selfdrive.loggerd.config import ROOT
from selfdrive.loggerd.xattr_cache import getxattr, setxattr
from selfdrive.statsd import STATS_DIR
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/athena/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from common.spinner import Spinner
from common.basedir import PERSIST
from selfdrive.controls.lib.alertmanager import set_offroad_alert
from selfdrive.hardware import HARDWARE, PC
from system.hardware import HARDWARE, PC
from selfdrive.swaglog import cloudlog


Expand Down
2 changes: 1 addition & 1 deletion selfdrive/boardd/boardd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "common/swaglog.h"
#include "common/timing.h"
#include "common/util.h"
#include "selfdrive/hardware/hw.h"
#include "system/hardware/hw.h"

#include "selfdrive/boardd/pigeon.h"

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/boardd/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "selfdrive/boardd/boardd.h"
#include "common/swaglog.h"
#include "common/util.h"
#include "selfdrive/hardware/hw.h"
#include "system/hardware/hw.h"

int main(int argc, char *argv[]) {
LOGW("starting boardd");
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/boardd/pandad.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from panda import DEFAULT_FW_FN, DEFAULT_H7_FW_FN, MCU_TYPE_H7, Panda, PandaDFU
from common.basedir import BASEDIR
from common.params import Params
from selfdrive.hardware import HARDWARE
from system.hardware import HARDWARE
from selfdrive.swaglog import cloudlog


Expand Down
2 changes: 1 addition & 1 deletion selfdrive/boardd/tests/test_boardd_loopback.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from common.timeout import Timeout
from selfdrive.boardd.boardd import can_list_to_can_capnp
from selfdrive.car import make_can_msg
from selfdrive.hardware import TICI
from system.hardware import TICI
from selfdrive.test.helpers import phone_only, with_processes


Expand Down
2 changes: 1 addition & 1 deletion selfdrive/camerad/cameras/camera_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "common/modeldata.h"
#include "common/swaglog.h"
#include "common/util.h"
#include "selfdrive/hardware/hw.h"
#include "system/hardware/hw.h"

#ifdef QCOM
#include "CL/cl_ext_qcom.h"
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/camerad/cameras/camera_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "common/queue.h"
#include "common/swaglog.h"
#include "common/visionimg.h"
#include "selfdrive/hardware/hw.h"
#include "system/hardware/hw.h"

#define CAMERA_ID_IMX298 0
#define CAMERA_ID_IMX179 1
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/camerad/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "common/params.h"
#include "common/util.h"
#include "selfdrive/hardware/hw.h"
#include "system/hardware/hw.h"

int main(int argc, char *argv[]) {
if (!Hardware::PC()) {
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/camerad/snapshot/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from cereal.visionipc.visionipc_pyx import VisionIpcClient, VisionStreamType # pylint: disable=no-name-in-module, import-error
from common.params import Params
from common.realtime import DT_MDL
from selfdrive.hardware import TICI, PC
from system.hardware import TICI, PC
from selfdrive.controls.lib.alertmanager import set_offroad_alert
from selfdrive.manager.process_config import managed_processes

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/camerad/test/test_camerad.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from selfdrive.test.helpers import with_processes

# only tests for EON and TICI
from selfdrive.hardware import EON, TICI
from system.hardware import EON, TICI

TEST_TIMESPAN = 30 # random.randint(60, 180) # seconds
SKIP_FRAME_TOLERANCE = 0
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/camerad/test/test_exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from selfdrive.test.helpers import with_processes
from selfdrive.camerad.snapshot.snapshot import get_snapshots

from selfdrive.hardware import EON, TICI
from system.hardware import EON, TICI

TEST_TIME = 45
REPEAT = 5
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from selfdrive.controls.lib.alertmanager import AlertManager, set_offroad_alert
from selfdrive.controls.lib.vehicle_model import VehicleModel
from selfdrive.locationd.calibrationd import Calibration
from selfdrive.hardware import HARDWARE, TICI, EON
from system.hardware import HARDWARE, TICI, EON
from selfdrive.manager.process_config import managed_processes

SOFT_DISABLE_TIME = 3 # seconds
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/lib/lane_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from common.filter_simple import FirstOrderFilter
from common.numpy_fast import interp
from common.realtime import DT_MDL
from selfdrive.hardware import EON, TICI
from system.hardware import EON, TICI
from selfdrive.swaglog import cloudlog


Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/plannerd.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from selfdrive.swaglog import cloudlog
from selfdrive.controls.lib.longitudinal_planner import Planner
from selfdrive.controls.lib.lateral_planner import LateralPlanner
from selfdrive.hardware import TICI
from system.hardware import TICI
import cereal.messaging as messaging


Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/radard.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from selfdrive.controls.lib.cluster.fastcluster_py import cluster_points_centroid
from selfdrive.controls.lib.radar_helpers import Cluster, Track, RADAR_TO_CAMERA
from selfdrive.swaglog import cloudlog
from selfdrive.hardware import TICI
from system.hardware import TICI


class KalmanParams():
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/loggerd/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from pathlib import Path
from selfdrive.hardware import PC
from system.hardware import PC

if os.environ.get('LOG_ROOT', False):
ROOT = os.environ['LOG_ROOT']
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/loggerd/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "cereal/messaging/messaging.h"
#include "common/util.h"
#include "common/swaglog.h"
#include "selfdrive/hardware/hw.h"
#include "system/hardware/hw.h"

const std::string LOG_ROOT = Path::log_root();

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/loggerd/loggerd.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "common/swaglog.h"
#include "common/timing.h"
#include "common/util.h"
#include "selfdrive/hardware/hw.h"
#include "system/hardware/hw.h"

#include "selfdrive/loggerd/encoder.h"
#include "selfdrive/loggerd/logger.h"
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/loggerd/tests/test_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from common.params import Params
from common.timeout import Timeout
from selfdrive.hardware import EON, TICI
from system.hardware import EON, TICI
from selfdrive.loggerd.config import ROOT
from selfdrive.manager.process_config import managed_processes
from tools.lib.logreader import LogReader
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/loggerd/tests/test_loggerd.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from common.basedir import BASEDIR
from common.params import Params
from common.timeout import Timeout
from selfdrive.hardware import TICI
from system.hardware import TICI
from selfdrive.loggerd.config import ROOT
from selfdrive.manager.process_config import managed_processes
from selfdrive.version import get_version
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/loggerd/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from common.api import Api
from common.params import Params
from common.realtime import set_core_affinity
from selfdrive.hardware import TICI
from system.hardware import TICI
from selfdrive.loggerd.xattr_cache import getxattr, setxattr
from selfdrive.loggerd.config import ROOT
from selfdrive.swaglog import cloudlog
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/manager/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from common.basedir import BASEDIR
from common.spinner import Spinner
from common.text_window import TextWindow
from selfdrive.hardware import TICI
from system.hardware import TICI
from selfdrive.swaglog import cloudlog, add_file_handler
from selfdrive.version import is_dirty

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from common.params import Params, ParamKeyType
from common.text_window import TextWindow
from selfdrive.boardd.set_time import set_time
from selfdrive.hardware import HARDWARE, PC
from system.hardware import HARDWARE, PC
from selfdrive.manager.helpers import unblock_stdout
from selfdrive.manager.process import ensure_running
from selfdrive.manager.process_config import managed_processes
Expand Down
Loading

0 comments on commit f3e5820

Please sign in to comment.