Merge branch 'dev-priv/master-priv' into hkg-canfd-all-long

This commit is contained in:
Jason Wen
2024-02-15 15:41:48 -05:00
14 changed files with 165 additions and 32 deletions
+68 -21
View File
@@ -12,6 +12,7 @@ variables:
stages:
- build
- sanity
- publish
- notify
@@ -70,6 +71,7 @@ build:
paths:
- "${CI_DIR}/scons_cache"
before_script:
- find $BUILD_DIR/ -mindepth 1 -delete
- *default_before_script
- "echo Starting build stage..."
- "echo BUILD_DIR: ${BUILD_DIR}"
@@ -79,7 +81,6 @@ build:
- git config --global --add safe.directory ${CI_PROJECT_DIR}
script:
- export PYTHONPATH="$BUILD_DIR"
- "echo Calling to build [${CI_DIR}/build.sh ${CI_PROJECT_DIR} ${BUILD_DIR} ${VERSION}]"
- "echo Building Panda..."
- scons -j$(nproc) cache_dir=${CI_DIR}/scons_cache ${CI_PROJECT_DIR}/panda
- mkdir -p ${BUILD_DIR}
@@ -89,28 +90,50 @@ build:
- cd $BUILD_DIR
- sed -i '/from .board.jungle import PandaJungle, PandaJungleDFU/s/^/#/' panda/__init__.py # comment panda jungle when prebuilt
- scons -j$(nproc) cache_dir=${CI_DIR}/scons_cache
# Cleanup
- echo "Doing cleanup for prebuilt\n\n"
- echo "Deleting specified files..."
- find ${BUILD_DIR} \( -name '*.a' -o -name '*.o' -o -name '*.os' -o -name '*.pyc' -o -name 'moc_*' -o -name '*.cc' -o -name "Jenkinsfile" -o -name "supercombo.onnx" -o -name ".sconsign.dblite" \) -print -delete
- echo "Deleting Headers from selfdrive/ui path..."
- find ${BUILD_DIR}/selfdrive/ui -type f -name '*.h' -print -delete
- echo "Deleting the following folders and subdirectories..."
- find "${BUILD_DIR}" -type d \( -path "*panda/board" -o -path "*panda/certs" -o -path "*panda/crypto" -o -path "*release" -o -path "*.github" -o -path "*selfdrive/ui/replay" -o -path "*__pycache__" \) -print -exec rm -rf {} +
# Move back signed panda fw
- mkdir -p ${BUILD_DIR}/panda/board/obj
- cp ${CI_PROJECT_DIR}/panda/board/obj/panda.bin.signed ${BUILD_DIR}/panda/board/obj/panda.bin.signed
- cp ${CI_PROJECT_DIR}/panda/board/obj/panda_h7.bin.signed ${BUILD_DIR}/panda/board/obj/panda_h7.bin.signed
- cp ${CI_PROJECT_DIR}/panda/board/obj/bootstub.panda.bin ${BUILD_DIR}/panda/board/obj/bootstub.panda.bin
- cp ${CI_PROJECT_DIR}/panda/board/obj/bootstub.panda_h7.bin ${BUILD_DIR}/panda/board/obj/bootstub.panda_h7.bin
- touch ${BUILD_DIR}/prebuilt
- sudo rm -rf ${OUTPUT_DIR}
- mkdir -p ${OUTPUT_DIR}
- shopt -s dotglob && mv ${BUILD_DIR}/* ${OUTPUT_DIR}
- sudo chown -R comma:comma ${OUTPUT_DIR}
# We first include the paths we want to keep, even if we later will be excluding the other things on those paths
- rsync -av
--include='**/panda/board/'
--include='**/panda/board/obj'
--include='**/panda/board/obj/panda.bin.signed'
--include='**/panda/board/obj/panda_h7.bin.signed'
--include='**/panda/board/obj/bootstub.panda.bin'
--include='**/panda/board/obj/bootstub.panda_h7.bin'
--exclude='.sconsign.dblite'
--exclude='*.a'
--exclude='*.A'
--exclude='*.o'
--exclude='*.O'
--exclude='*.os'
--exclude='*.OS'
--exclude='*.pyc'
--exclude='*.PYC'
--exclude='moc_*'
--exclude='MOC_*'
--exclude='*.cc'
--exclude='*.CC'
--exclude='Jenkinsfile'
--exclude='supercombo.onnx'
--exclude='**/panda/board/*'
--exclude='**/panda/board/obj/**'
--exclude='**/panda/certs/'
--exclude='**/panda/crypto/'
--exclude='**/release/'
--exclude='**/.github/'
--exclude='**/selfdrive/ui/replay/'
--exclude='**/__pycache__/'
--exclude='**/selfdrive/ui/*.h'
--exclude='**/selfdrive/ui/**/*.h'
--exclude='**/selfdrive/ui/qt/offroad/sunnypilot/'
--exclude='**/.git/'
--delete-excluded
--chown=comma:comma
${BUILD_DIR}/ ${OUTPUT_DIR}/
after_script:
# cleanup build dir after doing work
- find $BUILD_DIR/ -mindepth 1 -delete
artifacts:
paths:
- ${OUTPUT_DIR}/
@@ -120,6 +143,27 @@ build:
when: manual
- if: $NEW_BRANCH
when: always
check no source code sent:
stage: sanity
variables:
FORBIDDEN_FILE_EXTENSIONS: "*.a,*.o,*.os,*.pyc,moc_*,*.cc,Jenkinsfile,supercombo.onnx,.sconsign.dblite"
FORBIDDEN_DIR_PATTERNS: "*panda/certs,*panda/crypto,*release,*.github,*selfdrive/ui/replay,*__pycache__"
REQUIRED_FILE_EXTENSIONS: "*.py,*.json"
REQUIRED_DIR_PATTERNS: "*selfdrive/ui,*openpilot"
before_script:
- apk update && apk upgrade
- apk add bash findutils
script:
- cd ${OUTPUT_DIR}
- echo "Checking that we have properly cleaned up"
- ${CI_DIR}/sanity_check.sh "$FORBIDDEN_FILE_EXTENSIONS" "$FORBIDDEN_DIR_PATTERNS" true
- echo "Checking that our sanity check works and also checking that some required files are indeed found"
- ${CI_DIR}/sanity_check.sh "$REQUIRED_FILE_EXTENSIONS" "$REQUIRED_DIR_PATTERNS" false
rules:
- if: $NEW_BRANCH
when: on_success
- when: never
.publish_base: &publish_base
variables:
@@ -128,6 +172,9 @@ build:
needs:
- job: build
artifacts: true
- job: "check no source code sent"
artifacts: false
optional: false
before_script:
- 'apk update && apk upgrade'
- 'apk add git bash openssh'
+4 -3
View File
@@ -4,6 +4,7 @@ sunnypilot - 0.9.6.0 (2024-xx-xx)
* NEW❗: Default Driving Model: Los Angeles v2 (January 24, 2024)
* UPDATED: Driving Model Selector v3
* NEW❗: Driving Model additions
* Certified Herbalist v2 (February 13, 2024) - CHv2
* Certified Herbalist (February 5, 2024) - CH
* Los Angeles v2 (January 24, 2024) - LAv2
* Los Angeles (January 22, 2024) - LAv1
@@ -16,15 +17,15 @@ sunnypilot - 0.9.6.0 (2024-xx-xx)
* Blue Diamond (November 18, 2023) - BDv1
* Farmville (November 7, 2023) - FV
* Night Strike (October 3, 2023) - NS
* Certain features are deprecated with Legacy Driving Models
* Certain features are deprecated with newer Driving Models
* Dynamic Lane Profile
* Custom Offsets
* UPDATED: Dynamic Lane Profile (DLP)
* Continued support for Legacy Driving Models (e.g., ND, BDv2, BDv1, FV, NS)
* Deprecate support for newer Driving Models (e.g., CH, LAv2, LAv1)
* Deprecate support for newer Driving Models (e.g., CHv2, CH, LAv2, LAv1)
* UPDATED: Custom Offsets
* Continued support for Legacy Driving Models (e.g., ND, BDv2, BDv1, FV, NS)
* Deprecate support for newer Driving Models (e.g., CH, LAv2, LAv1)
* Deprecate support for newer Driving Models (e.g., CHv2, CH, LAv2, LAv1)
* FIXED: New comma 3X support
* FIXED: New comma eSIM support
* Bug fixes and performance improvements
+1
View File
@@ -64,6 +64,7 @@ set_gitlab_directory_permissions() {
sudo chmod g+s "$GITLAB_BASE_DIR"
}
# Please note that when the gitlab runner is started, linux implicitly executes "source /etc/profile" for every logged shell. This will make scons available
create_gitlab_runner_service() {
cat <<EOL | sudo tee /etc/systemd/system/${SERVICE_NAME}.service
[Unit]
+75
View File
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
# Check if the correct number of arguments are provided
if [ "$#" -lt 2 ]; then
echo "Error: Missing required arguments."
echo "Usage: $0 \"ext1,ext2,...\" \"dir1,dir2,...\" [expect_no_match]"
exit 1
fi
# Convert comma-separated lists of extensions and directory patterns to arrays
IFS=',' read -r -a file_extensions <<< "$1"
IFS=',' read -r -a dir_patterns <<< "$2"
# Boolean argument to determine the script's behavior when matches are found
expect_no_match=${3:-true} # Default to true if not provided
# Validate that file_extensions and dir_patterns are not empty
if [ ${#file_extensions[@]} -eq 0 ]; then
echo "Error: No file extensions provided."
exit 1
fi
if [ ${#dir_patterns[@]} -eq 0 ]; then
echo "Error: No directory patterns provided."
exit 1
fi
# Define the command and arguments as an array
find_command=(find . \( -false)
for ext in "${file_extensions[@]}"; do
find_command+=(-o -type f -name "*$ext")
done
for dir in "${dir_patterns[@]}"; do
find_command+=(-o -type d -path "$dir")
done
find_command+=(\) -print)
# Debug print
echo "Executing find_command ${find_command[@]}"
# Execute the find command
FOUND=$("${find_command[@]}")
# Function to handle found matches
handle_found() {
local count=$(echo "$FOUND" | grep -c '^')
if [ "$expect_no_match" = true ]; then
echo "Failure: Unexpected match$( [ "$count" -gt 1 ] && echo "es" ) found ($count):"
echo "$FOUND"
exit 1
else
echo "Success: Expected match$( [ "$count" -gt 1 ] && echo "es" ) found ($count):"
echo "$FOUND"
exit 0
fi
}
# Function to handle no matches found
handle_not_found() {
if [ "$expect_no_match" = false ]; then
echo "Failure: Expected matches not found."
exit 1
else
echo "Success: No matches found as expected."
exit 0
fi
}
# Check if any files or directories are found and handle accordingly
if [ -n "$FOUND" ]; then
handle_found
else
handle_not_found
fi
View File
+1
View File
@@ -102,6 +102,7 @@ selfdrive/car/tests/__init__.py
selfdrive/car/tests/test_car_interfaces.py
selfdrive/car/torque_data/*.toml
selfdrive/car/torque_data/lat_models/*
selfdrive/car/torque_data/neural_ff_weights.json
selfdrive/car/body/*.py
selfdrive/car/chrysler/*.py
+1 -1
View File
@@ -40,7 +40,7 @@ class NissanCarInfo(CarInfo):
CAR_INFO: Dict[str, Optional[Union[NissanCarInfo, List[NissanCarInfo]]]] = {
CAR.XTRAIL: NissanCarInfo("Nissan X-Trail 2017"),
CAR.LEAF: NissanCarInfo("Nissan Leaf 2018-23", video_link="https://youtu.be/vaMbtAh_0cY"),
CAR.LEAF_IC: None, # same platforms
CAR.LEAF_IC: NissanCarInfo("Nissan Leaf Instrument Cluster 2018-23", video_link="https://youtu.be/vaMbtAh_0cY"), # same platforms
CAR.ROGUE: NissanCarInfo("Nissan Rogue 2018-20"),
CAR.ALTIMA: NissanCarInfo("Nissan Altima 2019-20", car_parts=CarParts.common([CarHarness.nissan_b])),
}
+1
View File
@@ -180,6 +180,7 @@
"Mazda CX-9 2021-23": "MAZDA CX-9 2021",
"Nissan Altima 2019-20": "NISSAN ALTIMA 2020",
"Nissan Leaf 2018-23": "NISSAN LEAF 2018",
"Nissan Leaf Instrument Cluster 2018-23": "NISSAN LEAF 2018 Instrument Cluster",
"Nissan Rogue 2018-20": "NISSAN ROGUE 2019",
"Nissan X-Trail 2017": "NISSAN X-TRAIL 2017",
"Ram 1500 2019-24": "RAM 1500 5TH GEN",
+6 -5
View File
@@ -189,12 +189,13 @@ class LatControlTorque(LatControl):
lateral_jerk_measurement = 0
lookahead_lateral_jerk = 0
if self.use_nn or self.use_lateral_jerk:
model_good = model_data is not None and len(model_data.orientation.x) >= CONTROL_N
if model_good and (self.use_nn or self.use_lateral_jerk):
# prepare "look-ahead" desired lateral jerk
lookahead = interp(CS.vEgo, self.friction_look_ahead_bp, self.friction_look_ahead_v)
friction_upper_idx = next((i for i, val in enumerate(ModelConstants.T_IDXS) if val > lookahead), 16)
predicted_lateral_jerk = get_predicted_lateral_jerk(model_data.acceleration.y, self.t_diffs)
desired_lateral_jerk = (interp(self.desired_lat_jerk_time, ModelConstants.T_IDXS, model_data.acceleration.y) - actual_lateral_accel) / self.desired_lat_jerk_time
desired_lateral_jerk = (interp(self.desired_lat_jerk_time, ModelConstants.T_IDXS, model_data.acceleration.y) - desired_lateral_accel) / self.desired_lat_jerk_time
lookahead_lateral_jerk = get_lookahead_value(predicted_lateral_jerk[LAT_PLAN_MIN_IDX:friction_upper_idx], desired_lateral_jerk)
if self.use_steering_angle or lookahead_lateral_jerk == 0.0:
lookahead_lateral_jerk = 0.0
@@ -203,12 +204,12 @@ class LatControlTorque(LatControl):
lateral_jerk_setpoint = self.lat_jerk_friction_factor * lookahead_lateral_jerk
lateral_jerk_measurement = self.lat_jerk_friction_factor * actual_lateral_jerk
model_good = model_data is not None and len(model_data.orientation.x) >= CONTROL_N
if self.use_nn and model_good:
# update past data
roll = params.roll
pitch = self.pitch.update(llk.calibratedOrientationNED.value[1])
roll = roll_pitch_adjust(roll, pitch)
if len(llk.calibratedOrientationNED.value) > 1:
pitch = self.pitch.update(llk.calibratedOrientationNED.value[1])
roll = roll_pitch_adjust(roll, pitch)
self.roll_deque.append(roll)
self.lateral_accel_desired_deque.append(desired_lateral_accel)
+4
View File
@@ -166,6 +166,10 @@ def manager_init() -> None:
if os.path.isfile(os.path.join(sentry.CRASHES_DIR, 'error.txt')):
os.remove(os.path.join(sentry.CRASHES_DIR, 'error.txt'))
models_dir = "/data/media/0/models"
if not os.path.exists(models_dir):
os.makedirs(models_dir)
# preimport all processes
for p in managed_processes.values():
p.prepare()
+3 -1
View File
@@ -15,6 +15,7 @@ from openpilot.common.params import Params
from openpilot.common.realtime import set_realtime_priority
from openpilot.selfdrive.modeld.constants import ModelConstants
from openpilot.selfdrive.modeld.runners import ModelRunner, Runtime
from openpilot.selfdrive.sunnypilot import get_model_generation
NAV_INPUT_SIZE = 256*256
NAV_FEATURE_LEN = 256
@@ -51,7 +52,8 @@ class ModelState:
assert ctypes.sizeof(NavModelResult) == NAV_OUTPUT_SIZE * ctypes.sizeof(ctypes.c_float)
self.output = np.zeros(NAV_OUTPUT_SIZE, dtype=np.float32)
self.param_s = Params()
if self.param_s.get_bool("CustomDrivingModel"):
self.custom_model, self.model_gen = get_model_generation(self.param_s)
if self.custom_model and self.model_gen != 0:
_model_name = self.param_s.get("NavModelText", encoding="utf8")
_model_paths = {
ModelRunner.SNPE: f"{CUSTOM_MODEL_PATH}/navmodel_q_{_model_name}.dlc"}
@@ -68,7 +68,7 @@ QString SoftwarePanelSP::GetModelName() {
return selectedModelToDownload->displayName;
}
if (params.getBool("CustomDrivingModel")) {
if (params.getBool("CustomDrivingModel") && QString::fromStdString(params.get("DrivingModelGeneration")) != "0") {
return QString::fromStdString(params.get("DrivingModelName"));
}