From cdd6d62defb09bb508e00bd33842ac3411da4e71 Mon Sep 17 00:00:00 2001 From: deanlee Date: Sun, 22 Dec 2024 22:42:32 +0800 Subject: [PATCH 1/4] direct capnp to vector[CanData] conversion --- opendbc_repo | 2 +- selfdrive/pandad/pandad_api_impl.pyx | 29 ++++++++++++++++------------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/opendbc_repo b/opendbc_repo index 68c0996baf9aff..9556fcf55a1891 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 68c0996baf9affc6bbcfb2a4e8f5e80c9e855110 +Subproject commit 9556fcf55a189175ff779be96d33df51bf13cef4 diff --git a/selfdrive/pandad/pandad_api_impl.pyx b/selfdrive/pandad/pandad_api_impl.pyx index 787968f53e7db3..2a97e5952b629a 100644 --- a/selfdrive/pandad/pandad_api_impl.pyx +++ b/selfdrive/pandad/pandad_api_impl.pyx @@ -4,7 +4,7 @@ from cython.operator cimport dereference as deref, preincrement as preinc from libcpp.vector cimport vector from libcpp.string cimport string from libcpp cimport bool -from libc.stdint cimport uint8_t, uint32_t, uint64_t +from libc.stdint cimport uint8_t, uint32_t, uint64_t, uintptr_t cdef extern from "panda.h": cdef struct can_frame: @@ -41,16 +41,21 @@ def can_list_to_can_capnp(can_msgs, msgtype='can', valid=True): can_list_to_can_capnp_cpp(can_list, out, msgtype == 'sendcan', valid) return out + +cdef class ParsedCanData: + cdef vector[CanData] *data + + def __cinit__(self): + self.data = new vector[CanData]() + + def __dealloc__(self): + del self.data + + def get_data_pointer(self): + return self.data + + def can_capnp_to_list(strings, msgtype='can'): - cdef vector[CanData] data - can_capnp_to_can_list_cpp(strings, data, msgtype == 'sendcan') - - result = [] - cdef CanData *d - cdef vector[CanData].iterator it = data.begin() - while it != data.end(): - d = &deref(it) - frames = [(f.address, (&f.dat[0])[:f.dat.size()], f.src) for f in d.frames] - result.append((d.nanos, frames)) - preinc(it) + cdef ParsedCanData result = ParsedCanData() + can_capnp_to_can_list_cpp(strings, result.data[0], msgtype == 'sendcan') return result From e8de451f10194044056a07e74e69b1ca11f91fb5 Mon Sep 17 00:00:00 2001 From: deanlee Date: Thu, 2 Jan 2025 12:14:12 +0800 Subject: [PATCH 2/4] merge master --- opendbc_repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc_repo b/opendbc_repo index 9556fcf55a1891..68c0996baf9aff 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 9556fcf55a189175ff779be96d33df51bf13cef4 +Subproject commit 68c0996baf9affc6bbcfb2a4e8f5e80c9e855110 From f812cded63c2dd65c3ebd509e0853b7e66a57c9e Mon Sep 17 00:00:00 2001 From: deanlee Date: Thu, 2 Jan 2025 12:26:33 +0800 Subject: [PATCH 3/4] bump opendbc --- opendbc_repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc_repo b/opendbc_repo index 68c0996baf9aff..9556fcf55a1891 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 68c0996baf9affc6bbcfb2a4e8f5e80c9e855110 +Subproject commit 9556fcf55a189175ff779be96d33df51bf13cef4 From a4c3b9492f2e8ff967ae48cce677db7bad774cb1 Mon Sep 17 00:00:00 2001 From: deanlee Date: Sun, 12 Jan 2025 10:16:29 +0800 Subject: [PATCH 4/4] empty commit