Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into master3
Browse files Browse the repository at this point in the history
  • Loading branch information
eFiniLan committed Jun 27, 2024
2 parents 39525c1 + 504dd45 commit a0a83dc
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 45 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/selfdrive_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@ jobs:
docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }}
- uses: ./.github/workflows/compile-openpilot
timeout-minutes: ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 15 || 30) }} # allow more time when we missed the scons cache

build_mac:
name: build macos
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: git lfs pull
- name: Install dependencies
run: ./tools/mac_setup.sh
env:
SKIP_PROMPT: 1
# package install has DeprecationWarnings
PYTHONWARNINGS: default
- name: Test openpilot environment
run: poetry run scons -h

static_analysis:
name: static analysis
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ persist
selfdrive/pandad/pandad
cereal/services.h
cereal/gen
cereal/messaging/bridge
selfdrive/logcatd/logcatd
selfdrive/mapd/default_speeds_by_region.json
system/proclogd/proclogd
Expand Down
10 changes: 0 additions & 10 deletions cereal/messaging/.gitignore

This file was deleted.

14 changes: 2 additions & 12 deletions cereal/messaging/messaging.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@
#include <string>
#include <vector>
#include <utility>
#include <time.h>

#include <capnp/serialize.h>

#include "cereal/gen/cpp/log.capnp.h"
#include "common/timing.h"
#include "msgq/ipc.h"

#ifdef __APPLE__
#define CLOCK_BOOTTIME CLOCK_MONOTONIC
#endif

#define MSG_MULTIPLE_PUBLISHERS 100


class SubMaster {
public:
SubMaster(const std::vector<const char *> &service_list, const std::vector<const char *> &poll = {},
Expand Down Expand Up @@ -53,10 +46,7 @@ class MessageBuilder : public capnp::MallocMessageBuilder {

cereal::Event::Builder initEvent(bool valid = true) {
cereal::Event::Builder event = initRoot<cereal::Event>();
struct timespec t;
clock_gettime(CLOCK_BOOTTIME, &t);
uint64_t current_time = t.tv_sec * 1000000000ULL + t.tv_nsec;
event.setLogMonoTime(current_time);
event.setLogMonoTime(nanos_since_boot());
event.setValid(valid);
return event;
}
Expand Down
8 changes: 0 additions & 8 deletions cereal/messaging/socketmaster.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <time.h>
#include <assert.h>
#include <stdlib.h>
#include <string>
Expand All @@ -7,15 +6,8 @@
#include "cereal/services.h"
#include "cereal/messaging/messaging.h"


const bool SIMULATION = (getenv("SIMULATION") != nullptr) && (std::string(getenv("SIMULATION")) == "1");

static inline uint64_t nanos_since_boot() {
struct timespec t;
clock_gettime(CLOCK_BOOTTIME, &t);
return t.tv_sec * 1000000000ULL + t.tv_nsec;
}

static inline bool inList(const std::vector<const char *> &list, const char *value) {
for (auto &v : list) {
if (strcmp(value, v) == 0) return true;
Expand Down
2 changes: 1 addition & 1 deletion panda
7 changes: 6 additions & 1 deletion selfdrive/car/gm/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ def torque_from_lateral_accel_siglin(self, latcontrol_inputs: LatControlInputs,
friction = get_friction(lateral_accel_error, lateral_accel_deadzone, FRICTION_THRESHOLD, torque_params, friction_compensation)

def sig(val):
return 1 / (1 + exp(-val)) - 0.5
# https://timvieira.github.io/blog/post/2014/02/11/exp-normalize-trick
if val >= 0:
return 1 / (1 + exp(-val)) - 0.5
else:
z = exp(val)
return z / (1 + z) - 0.5

# The "lat_accel vs torque" relationship is assumed to be the sum of "sigmoid + linear" curves
# An important thing to consider is that the slope at 0 should be > 0 (ideally >1)
Expand Down
1 change: 1 addition & 0 deletions selfdrive/car/hyundai/fingerprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,7 @@
b'\xf1\x00NE1 MFC AT USA LHD 1.00 1.03 99211-GI010 220401',
b'\xf1\x00NE1 MFC AT USA LHD 1.00 1.05 99211-GI010 220614',
b'\xf1\x00NE1 MFC AT USA LHD 1.00 1.06 99211-GI010 230110',
b'\xf1\x00NE1 MFC AT EUR LHD 1.00 1.01 99211-GI100 240110',
],
},
CAR.HYUNDAI_IONIQ_6: {
Expand Down
4 changes: 0 additions & 4 deletions selfdrive/controls/lib/longitudinal_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,11 @@ def publish(self, sm, pm):

plan_send.valid = sm.all_checks(service_list=['carState', 'controlsState'])


longitudinalPlan = plan_send.longitudinalPlan
longitudinalPlan.modelMonoTime = sm.logMonoTime['modelV2']
longitudinalPlan.processingDelay = (plan_send.logMonoTime / 1e9) - sm.logMonoTime['modelV2']
longitudinalPlan.solverExecutionTime = self.mpc.solve_time

longitudinalPlan.allowBrake = True
longitudinalPlan.allowThrottle = True

longitudinalPlan.speeds = self.v_desired_trajectory.tolist()
longitudinalPlan.accels = self.a_desired_trajectory.tolist()
longitudinalPlan.jerks = self.j_desired_trajectory.tolist()
Expand Down
4 changes: 0 additions & 4 deletions selfdrive/ui/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ if GetOption('extras') and arch != "Darwin":
if "internal" in name:
d['INTERNAL'] = "1"

import requests
r = requests.get("https://github.com/commaci2.keys")
r.raise_for_status()
d['SSH_KEYS'] = f'\\"{r.text.strip()}\\"'
obj = senv.Object(f"installer/installers/installer_{name}.o", ["installer/installer.cc"], CPPDEFINES=d)
f = senv.Program(f"installer/installers/installer_{name}", [obj, cont], LIBS=qt_libs)
# keep installers small
Expand Down
4 changes: 3 additions & 1 deletion selfdrive/ui/installer/installer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,12 @@ void Installer::cloneFinished(int exitCode, QProcess::ExitStatus exitStatus) {
#ifdef INTERNAL
run("mkdir -p /data/params/d/");

// https://github.com/commaci2.keys
const std::string ssh_keys = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMX2kU8eBZyEWmbq0tjMPxksWWVuIV/5l64GabcYbdpI";
std::map<std::string, std::string> params = {
{"SshEnabled", "1"},
{"RecordFrontLock", "1"},
{"GithubSshKeys", SSH_KEYS},
{"GithubSshKeys", ssh_keys},
};
for (const auto& [key, value] : params) {
std::ofstream param;
Expand Down
11 changes: 7 additions & 4 deletions tools/lib/logreader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
import bz2
from functools import partial
from functools import cache, partial
import multiprocessing
import capnp
import enum
Expand Down Expand Up @@ -87,18 +87,21 @@ class ReadMode(enum.StrEnum):

InternalUnavailableException = Exception("Internal source not available")


@cache
def default_valid_file(fn: LogPath) -> bool:
return fn is not None and file_exists(fn)


def auto_strategy(rlog_paths: LogPaths, qlog_paths: LogPaths, interactive: bool, valid_file: ValidFileCallable) -> LogPaths:
# auto select logs based on availability
if any(rlog is None or not valid_file(rlog) for rlog in rlog_paths) and all(qlog is not None and valid_file(qlog) for qlog in qlog_paths):
missing_rlogs = [rlog is None or not valid_file(rlog) for rlog in rlog_paths].count(True)
if missing_rlogs != 0:
if interactive:
if input("Some rlogs were not found, would you like to fallback to qlogs for those segments? (y/n) ").lower() != "y":
if input(f"{missing_rlogs} rlogs were not found, would you like to fallback to qlogs for those segments? (y/n) ").lower() != "y":
return rlog_paths
else:
cloudlog.warning("Some rlogs were not found, falling back to qlogs for those segments...")
cloudlog.warning(f"{missing_rlogs} rlogs were not found, falling back to qlogs for those segments...")

return [rlog if valid_file(rlog) else (qlog if valid_file(qlog) else None)
for (rlog, qlog) in zip(rlog_paths, qlog_paths, strict=True)]
Expand Down

0 comments on commit a0a83dc

Please sign in to comment.