mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-22 06:22:06 +08:00
Merge branch 'devel' of https://github.com/commaai/openpilot into devel-unsupported-cars
This commit is contained in:
Binary file not shown.
@@ -17,7 +17,9 @@ cdef extern from "common.h":
|
||||
HONDA_COUNTER,
|
||||
TOYOTA_CHECKSUM,
|
||||
PEDAL_CHECKSUM,
|
||||
PEDAL_COUNTER
|
||||
PEDAL_COUNTER,
|
||||
VOLKSWAGEN_CHECKSUM,
|
||||
VOLKSWAGEN_COUNTER
|
||||
|
||||
cdef struct Signal:
|
||||
const char* name
|
||||
|
||||
@@ -25,7 +25,7 @@ const Signal sigs_{{address}}[] = {
|
||||
.type = SignalType::HONDA_COUNTER,
|
||||
{% elif checksum_type == "toyota" and sig.name == "CHECKSUM" %}
|
||||
.type = SignalType::TOYOTA_CHECKSUM,
|
||||
{% elif checksum_type == "volkswagen" and sig.name == "CHECKSUM" %}
|
||||
{% elif checksum_type == "volkswagen" and sig.name == "CHECKSUM" %}
|
||||
.type = SignalType::VOLKSWAGEN_CHECKSUM,
|
||||
{% elif checksum_type == "volkswagen" and sig.name == "COUNTER" %}
|
||||
.type = SignalType::VOLKSWAGEN_COUNTER,
|
||||
|
||||
@@ -55,7 +55,6 @@ bool MessageState::parse(uint64_t sec, uint16_t ts_, uint8_t * dat) {
|
||||
}
|
||||
} else if (sig.type == SignalType::VOLKSWAGEN_COUNTER) {
|
||||
if (!update_counter_generic(tmp, sig.b2)) {
|
||||
INFO("0x%X CHECKSUM FAIL\n", address);
|
||||
return false;
|
||||
}
|
||||
} else if (sig.type == SignalType::PEDAL_CHECKSUM) {
|
||||
@@ -84,7 +83,7 @@ bool MessageState::update_counter_generic(int64_t v, int cnt_size) {
|
||||
if (((old_counter+1) & ((1 << cnt_size) -1)) != v) {
|
||||
counter_fail += 1;
|
||||
if (counter_fail > 1) {
|
||||
INFO("%X COUNTER FAIL %d -- %d vs %d\n", address, counter_fail, old_counter, (int)v);
|
||||
INFO("0x%X COUNTER FAIL %d -- %d vs %d\n", address, counter_fail, old_counter, (int)v);
|
||||
}
|
||||
if (counter_fail >= MAX_BAD_COUNTER) {
|
||||
return false;
|
||||
@@ -125,7 +124,7 @@ CANParser::CANParser(int abus, const std::string& dbc_name,
|
||||
}
|
||||
}
|
||||
if (!msg) {
|
||||
fprintf(stderr, "CANParser: could not find message 0x%X in dnc %s\n", op.address, dbc_name.c_str());
|
||||
fprintf(stderr, "CANParser: could not find message 0x%X in DBC %s\n", op.address, dbc_name.c_str());
|
||||
assert(false);
|
||||
}
|
||||
|
||||
@@ -193,7 +192,7 @@ void CANParser::UpdateValid(uint64_t sec) {
|
||||
const auto& state = kv.second;
|
||||
if (state.check_threshold > 0 && (sec - state.seen) > state.check_threshold) {
|
||||
if (state.seen > 0) {
|
||||
DEBUG("%X TIMEOUT\n", state.address);
|
||||
DEBUG("0x%X TIMEOUT\n", state.address);
|
||||
}
|
||||
can_valid = false;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ def main():
|
||||
msgs = [(address, msg_name, msg_size, sorted(msg_sigs, key=lambda s: s.name not in ("COUNTER", "CHECKSUM"))) # process counter and checksums first
|
||||
for address, ((msg_name, msg_size), msg_sigs) in sorted(can_dbc.msgs.items()) if msg_sigs]
|
||||
|
||||
def_vals = {a: set(b) for a,b in can_dbc.def_vals.items()} #remove duplicates
|
||||
def_vals = {a: sorted(set(b)) for a, b in can_dbc.def_vals.items()} # remove duplicates
|
||||
def_vals = sorted(def_vals.items())
|
||||
|
||||
if can_dbc.name.startswith(("honda_", "acura_")):
|
||||
|
||||
@@ -198,7 +198,12 @@ FINGERPRINTS = {
|
||||
# 2019 Taiwan Altis Hybrid
|
||||
{
|
||||
36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 401: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 713: 8, 728: 8, 740: 5, 742: 8, 743: 8, 761: 8, 765: 8, 800: 8, 810: 2, 829: 2, 830: 7, 835: 8, 836: 8, 865: 8, 869: 7, 870: 7, 871: 2, 877: 8, 881: 8, 885: 8, 896: 8, 898: 8, 918: 7, 921: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 987: 8, 993: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1082: 8, 1112: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1172: 8, 1235: 8, 1237: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1594: 8, 1595: 8, 1745: 8, 1775: 8, 1779: 8
|
||||
}],
|
||||
},
|
||||
# 2019 Chinese Levin Hybrid
|
||||
{
|
||||
36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 401: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 713: 8, 728: 8, 740: 5, 742: 8, 743: 8, 761: 8, 765: 8, 800: 8, 810: 2, 812: 8, 829: 2, 830: 7, 835: 8, 836: 8, 865: 8, 869: 7, 870: 7, 871: 2, 877: 8, 881: 8, 885: 8, 896: 8, 898: 8, 921: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 993: 8, 1002: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1172: 8, 1235: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1594: 8, 1595: 8, 1600: 8, 1649: 8, 1745: 8, 1775: 8, 1779: 8
|
||||
}
|
||||
],
|
||||
CAR.LEXUS_ES_TSS2: [
|
||||
{
|
||||
# 2019 Lexus ES200 from Shell
|
||||
|
||||
@@ -181,7 +181,7 @@ class CarController():
|
||||
idx = (CS.graMsgBusCounter + 1) % 16
|
||||
can_sends.append(volkswagencan.create_mqb_acc_buttons_control(self.packer_gw, canbus.extended, self.graButtonStatesToSend, CS, idx))
|
||||
self.graMsgSentCount += 1
|
||||
if self.graMsgSentCount >= 16:
|
||||
if self.graMsgSentCount >= P.GRA_VBP_COUNT:
|
||||
self.graButtonStatesToSend = None
|
||||
self.graMsgSentCount = 0
|
||||
|
||||
|
||||
@@ -51,13 +51,6 @@ FINGERPRINTS = {
|
||||
}],
|
||||
}
|
||||
|
||||
class ECU:
|
||||
CAM = 0
|
||||
|
||||
ECU_FINGERPRINT = {
|
||||
ECU.CAM: [294, 919], # HCA_01 Heading Control Assist, LDW_02 Lane Departure Warning
|
||||
}
|
||||
|
||||
DBC = {
|
||||
CAR.GOLF: dbc_dict('vw_mqb_2010', None),
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
#include "visionbuf.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
VisionBuf visionbuf_allocate(size_t len) {
|
||||
// const size_t alignment = 4096;
|
||||
// void* addr = aligned_alloc(alignment, alignment * ((len - 1) / alignment + 1));
|
||||
void* addr = calloc(1, len);
|
||||
|
||||
return (VisionBuf){
|
||||
.len = len, .addr = addr, .handle = 1, .fd = -1,
|
||||
};
|
||||
}
|
||||
|
||||
cl_mem visionbuf_to_cl(const VisionBuf* buf, cl_device_id device_id, cl_context ctx) {
|
||||
// HACK because this platform is just for convenience
|
||||
VisionBuf *w_buf = (VisionBuf*)buf;
|
||||
cl_mem ret;
|
||||
*w_buf = visionbuf_allocate_cl(buf->len, device_id, ctx, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
VisionBuf visionbuf_allocate_cl(size_t len, cl_device_id device_id, cl_context ctx, cl_mem *out_mem) {
|
||||
int err;
|
||||
assert(out_mem);
|
||||
|
||||
#if __OPENCL_VERSION__ >= 200
|
||||
void* host_ptr =
|
||||
clSVMAlloc(ctx, CL_MEM_READ_WRITE | CL_MEM_SVM_FINE_GRAIN_BUFFER, len, 0);
|
||||
assert(host_ptr);
|
||||
#else
|
||||
void* host_ptr = calloc(1, len);
|
||||
|
||||
cl_command_queue q = clCreateCommandQueue(ctx, device_id, 0, &err);
|
||||
assert(err == 0);
|
||||
#endif
|
||||
|
||||
cl_mem mem = clCreateBuffer(ctx, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, len, host_ptr, &err);
|
||||
assert(err == 0);
|
||||
|
||||
*out_mem = mem;
|
||||
|
||||
return (VisionBuf){
|
||||
.len = len, .addr = host_ptr, .handle = 0, .fd = -1,
|
||||
.device_id = device_id, .ctx = ctx, .buf_cl = mem,
|
||||
|
||||
#if __OPENCL_VERSION__ < 200
|
||||
.copy_q = q,
|
||||
#endif
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
void visionbuf_sync(const VisionBuf* buf, int dir) {
|
||||
int err = 0;
|
||||
if (!buf->buf_cl) return;
|
||||
|
||||
#if __OPENCL_VERSION__ < 200
|
||||
if (dir == VISIONBUF_SYNC_FROM_DEVICE) {
|
||||
err = clEnqueueReadBuffer(buf->copy_q, buf->buf_cl, CL_FALSE, 0, buf->len, buf->addr, 0, NULL, NULL);
|
||||
} else {
|
||||
err = clEnqueueWriteBuffer(buf->copy_q, buf->buf_cl, CL_FALSE, 0, buf->len, buf->addr, 0, NULL, NULL);
|
||||
}
|
||||
assert(err == 0);
|
||||
clFinish(buf->copy_q);
|
||||
#endif
|
||||
}
|
||||
|
||||
void visionbuf_free(const VisionBuf* buf) {
|
||||
if (buf->handle) {
|
||||
free(buf->addr);
|
||||
} else {
|
||||
int err = clReleaseMemObject(buf->buf_cl);
|
||||
assert(err == 0);
|
||||
#if __OPENCL_VERSION__ >= 200
|
||||
clSVMFree(buf->ctx, buf->addr);
|
||||
#else
|
||||
free(buf->addr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ class LatControlINDI():
|
||||
self.A_K = A - np.dot(K, C)
|
||||
self.x = np.matrix([[0.], [0.], [0.]])
|
||||
|
||||
self.enfore_rate_limit = CP.carName == "toyota"
|
||||
self.enforce_rate_limit = CP.carName == "toyota"
|
||||
|
||||
self.RC = CP.lateralTuning.indi.timeConstant
|
||||
self.G = CP.lateralTuning.indi.actuatorEffectiveness
|
||||
@@ -81,7 +81,7 @@ class LatControlINDI():
|
||||
delta_u = g_inv * accel_error
|
||||
|
||||
# Enforce rate limit
|
||||
if self.enfore_rate_limit:
|
||||
if self.enforce_rate_limit:
|
||||
steer_max = float(SteerLimitParams.STEER_MAX)
|
||||
new_output_steer_cmd = steer_max * (self.delayed_output + delta_u)
|
||||
prev_output_steer_cmd = steer_max * self.output_steer
|
||||
|
||||
@@ -377,8 +377,8 @@ def manager_thread():
|
||||
running_list = [" running %s %s" % (p, running[p]) for p in running]
|
||||
cloudlog.debug('\n'.join(running_list))
|
||||
|
||||
# is this still needed?
|
||||
if params.get("DoUninstall") == "1":
|
||||
# Exit main loop when uninstall is needed
|
||||
if params.get("DoUninstall", encoding='utf8') == "1":
|
||||
break
|
||||
|
||||
def get_installed_apks():
|
||||
@@ -555,7 +555,7 @@ def main():
|
||||
finally:
|
||||
cleanup_all_processes(None, None)
|
||||
|
||||
if params.get("DoUninstall") == "1":
|
||||
if params.get("DoUninstall", encoding='utf8') == "1":
|
||||
uninstall()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -189,11 +189,10 @@ def thermald_thread():
|
||||
max_comp_temp = max(max_cpu_temp, msg.thermal.mem / 10., msg.thermal.gpu / 10.)
|
||||
bat_temp = msg.thermal.bat/1000.
|
||||
|
||||
if health is not None:
|
||||
if health.health.hwType == log.HealthData.HwType.uno:
|
||||
fan_speed = handle_fan_uno(max_cpu_temp, bat_temp, fan_speed)
|
||||
else:
|
||||
fan_speed = handle_fan_eon(max_cpu_temp, bat_temp, fan_speed)
|
||||
if health is not None and health.health.hwType == log.HealthData.HwType.uno:
|
||||
fan_speed = handle_fan_uno(max_cpu_temp, bat_temp, fan_speed)
|
||||
else:
|
||||
fan_speed = handle_fan_eon(max_cpu_temp, bat_temp, fan_speed)
|
||||
|
||||
msg.thermal.fanSpeed = fan_speed
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ else
|
||||
|
||||
OPENCL_LIBS = -lOpenCL
|
||||
|
||||
TF_FLAGS = -I$(EXTERNAL)/tensorflow/include
|
||||
TF_LIBS = -L$(EXTERNAL)/tensorflow/lib -ltensorflow \
|
||||
-Wl,-rpath $(EXTERNAL)/tensorflow/lib
|
||||
#TF_FLAGS = -I$(EXTERNAL)/tensorflow/include
|
||||
#TF_LIBS = -L$(EXTERNAL)/tensorflow/lib -ltensorflow \
|
||||
# -Wl,-rpath $(EXTERNAL)/tensorflow/lib
|
||||
|
||||
SNPE_FLAGS = -I$(PHONELIBS)/snpe/include/
|
||||
SNPE_LIBS = -L$(PHONELIBS)/snpe/x86_64-linux-clang/ \
|
||||
@@ -69,7 +69,7 @@ else
|
||||
PLATFORM_OBJS = cameras/camera_frame_stream.o \
|
||||
../common/visionbuf_cl.o \
|
||||
../common/visionimg.o \
|
||||
runners/tfmodel.o
|
||||
# runners/tfmodel.o
|
||||
endif
|
||||
|
||||
SSL_FLAGS = -I/usr/include/openssl/
|
||||
|
||||
@@ -33,6 +33,8 @@ typedef struct CameraState {
|
||||
int fps;
|
||||
float digital_gain;
|
||||
|
||||
float cur_gain_frac;
|
||||
|
||||
mat3 transform;
|
||||
} CameraState;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user